Return extended krb5 error strings
authorAlexandra Ellwood <lxs@mit.edu>
Thu, 24 Jul 2008 21:26:14 +0000 (21:26 +0000)
committerAlexandra Ellwood <lxs@mit.edu>
Thu, 24 Jul 2008 21:26:14 +0000 (21:26 +0000)
Use krb5_get_error_message instead of error_message for
detailed krb5 error strings.  Also removed a few remaining
instances of types ending in _t and fixed up some
whitespace issues.

Recommend ignoring whitespace diff.

ticket: new

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20579 dc483132-0cff-0310-8789-dd5450dbe970

19 files changed:
src/include/kim/kim_options.h
src/kim/lib/kim_ccache.c
src/kim/lib/kim_ccache_private.h
src/kim/lib/kim_credential.c
src/kim/lib/kim_error.c
src/kim/lib/kim_error_private.h
src/kim/lib/kim_identity.c
src/kim/lib/kim_identity_private.h
src/kim/lib/kim_options.c
src/kim/lib/kim_options_private.h
src/kim/lib/kim_preferences.c
src/kim/lib/kim_preferences_private.h
src/kim/lib/kim_selection_hints_private.h
src/kim/lib/kim_string.c
src/kim/lib/kim_string_private.h
src/kim/lib/mac/kim_os_preferences.c
src/kim/lib/mac/kim_os_private.h
src/kim/lib/mac/kim_os_selection_hints.c
src/kim/lib/mac/kim_os_string.c

index 9699501529ea18cd2b50528181e8f6a03404fcf9..bf30b75b6680b7af5125465858e34a1188beaa8e 100644 (file)
@@ -28,9 +28,9 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-
+    
 #include <kim/kim_types.h>
-
+    
 /*!
  * \addtogroup kim_types_reference
  * @{
@@ -51,7 +51,7 @@ extern "C" {
  * This value determines what type of user interface is displayed.
  * See \ref kim_options_custom_prompt_callback for more information.
  */
-typedef uint32_t kim_prompt_type_t;
+typedef uint32_t kim_prompt_type;
 
 enum kim_prompt_type_enum {
     kim_prompt_type_password = 0,
@@ -62,45 +62,45 @@ enum kim_prompt_type_enum {
  * The prompt callback used to display a prompt to the user.
  * See \ref kim_options_custom_prompt_callback for more information.
  */
-typedef kim_error_code (*kim_prompt_callback_t) (kim_options       *io_options, 
-                                                   kim_prompt_type_t    in_type,
-                                                   kim_string         in_title,
-                                                   kim_string         in_message,
-                                                   kim_string         in_description,
-                                                   void               **out_reply);
+typedef kim_error_code (*kim_prompt_callback) (kim_options       *io_options, 
+                                               kim_prompt_type    in_type,
+                                               kim_string         in_title,
+                                               kim_string         in_message,
+                                               kim_string         in_description,
+                                               void               **out_reply);
 
 /*!
  * The default prompt callback.
  * See \ref kim_options_custom_prompt_callback for more information.
  */
 kim_error_code kim_prompt_callback_default (kim_options       *io_options, 
-                                              kim_prompt_type_t    in_type,
-                                              kim_string         in_title,
-                                              kim_string         in_message,
-                                              kim_string         in_description,
-                                              void               **out_reply);
+                                            kim_prompt_type    in_type,
+                                            kim_string         in_title,
+                                            kim_string         in_message,
+                                            kim_string         in_description,
+                                            void             **out_reply);
 
 /*!
  * The graphical prompt callback.
  * See \ref kim_options_custom_prompt_callback for more information.
  */
 kim_error_code kim_prompt_callback_gui (kim_options       *io_options, 
-                                          kim_prompt_type_t    in_type,
-                                          kim_string         in_title,
-                                          kim_string         in_message,
-                                          kim_string         in_description,
-                                          void               **out_reply);
+                                        kim_prompt_type    in_type,
+                                        kim_string         in_title,
+                                        kim_string         in_message,
+                                        kim_string         in_description,
+                                        void             **out_reply);
 
 /*!
  * The command line prompt callback.
  * See \ref kim_options_custom_prompt_callback for more information.
  */
 kim_error_code kim_prompt_callback_cli (kim_options       *io_options, 
-                                          kim_prompt_type_t    in_type,
-                                          kim_string         in_title,
-                                          kim_string         in_message,
-                                          kim_string         in_description,
-                                          void               **out_reply);
+                                        kim_prompt_type    in_type,
+                                        kim_string         in_title,
+                                        kim_string         in_message,
+                                        kim_string         in_description,
+                                        void             **out_reply);
 
 /*!
  * The prompt callback which always returns an error.
@@ -109,11 +109,11 @@ kim_error_code kim_prompt_callback_cli (kim_options       *io_options,
  * See \ref kim_options_custom_prompt_callback for more information.
  */
 kim_error_code kim_prompt_callback_none (kim_options       *io_options, 
-                                           kim_prompt_type_t    in_type,
-                                           kim_string         in_title,
-                                           kim_string         in_message,
-                                           kim_string         in_description,
-                                           void               **out_reply);
+                                         kim_prompt_type    in_type,
+                                         kim_string         in_title,
+                                         kim_string         in_message,
+                                         kim_string         in_description,
+                                         void             **out_reply);
 
 /*! @} */
 
@@ -305,7 +305,7 @@ kim_error kim_options_create (kim_options *out_options);
  * \brief Copy options.
  */
 kim_error kim_options_copy (kim_options *out_options,
-                              kim_options  in_options);
+                            kim_options  in_options);
 
 /*!
  * \param io_options         an options object to modify.
@@ -317,7 +317,7 @@ kim_error kim_options_copy (kim_options *out_options,
  * \sa kim_options_get_prompt_callback()
  */
 kim_error kim_options_set_prompt_callback (kim_options         io_options,
-                                             kim_prompt_callback_t in_prompt_callback);
+                                           kim_prompt_callback in_prompt_callback);
 
 /*!
  * \param in_options          an options object.
@@ -331,7 +331,7 @@ kim_error kim_options_set_prompt_callback (kim_options         io_options,
  * \sa kim_options_set_prompt_callback()
  */
 kim_error kim_options_get_prompt_callback (kim_options          in_options,
-                                             kim_prompt_callback_t *out_prompt_callback);
+                                           kim_prompt_callback *out_prompt_callback);
 
 /*!
  * \param io_options  an options object to modify.
@@ -345,7 +345,7 @@ kim_error kim_options_get_prompt_callback (kim_options          in_options,
  * \sa kim_options_get_data()
  */
 kim_error kim_options_set_data (kim_options  io_options,
-                                  const void    *in_data);
+                                const void    *in_data);
 
 /*!
  * \param in_options  an options object.
@@ -360,7 +360,7 @@ kim_error kim_options_set_data (kim_options  io_options,
  * \sa kim_options_set_data()
  */
 kim_error kim_options_get_data (kim_options   in_options,
-                                  const void    **out_data);
+                                const void  **out_data);
 
 /*!
  * \param io_options     an options object to modify.
@@ -376,9 +376,9 @@ kim_error kim_options_get_data (kim_options   in_options,
  * NULL (no response is set by default)
  * \sa kim_options_get_prompt_response()
  */
-kim_error kim_options_set_prompt_response (kim_options     io_options,
-                                             kim_prompt_type_t in_prompt_type,
-                                             void             *in_response);
+kim_error kim_options_set_prompt_response (kim_options      io_options,
+                                           kim_prompt_type  in_prompt_type,
+                                           void            *in_response);
 
 /*!
  * \param in_options     an options object.
@@ -397,8 +397,8 @@ kim_error kim_options_set_prompt_response (kim_options     io_options,
  * \sa kim_options_set_prompt_response()
  */
 kim_error kim_options_get_prompt_response (kim_options       in_options,
-                                             kim_prompt_type_t   in_prompt_type,
-                                             void              **out_response);
+                                           kim_prompt_type   in_prompt_type,
+                                           void            **out_response);
 
 /*!
  * \param io_options    an options object to modify.
@@ -414,7 +414,7 @@ kim_error kim_options_get_prompt_response (kim_options       in_options,
  * \sa kim_options_get_start_time(), kim_credential_validate(), kim_ccache_validate(), kim_identity_validate()
  */
 kim_error kim_options_set_start_time (kim_options io_options,
-                                        kim_time    in_start_time);
+                                      kim_time    in_start_time);
 
 /*!
  * \param in_options     an options object.
@@ -430,7 +430,7 @@ kim_error kim_options_set_start_time (kim_options io_options,
  * \sa kim_options_set_start_time(), kim_credential_validate(), kim_ccache_validate(), kim_identity_validate()
  */
 kim_error kim_options_get_start_time (kim_options  in_options,
-                                        kim_time    *out_start_time);
+                                      kim_time    *out_start_time);
 
 /*!
  * \param io_options  an options object to modify.
@@ -445,7 +445,7 @@ kim_error kim_options_get_start_time (kim_options  in_options,
  * Read from the user's preferences and the Kerberos configuration. 10 hours if unspecified.
  */
 kim_error kim_options_set_lifetime (kim_options  io_options,
-                                      kim_lifetime in_lifetime);
+                                    kim_lifetime in_lifetime);
 
 /*!
  * \param in_options   an options object.
@@ -460,10 +460,10 @@ kim_error kim_options_set_lifetime (kim_options  io_options,
  * \sa kim_options_set_lifetime()
  */
 kim_error kim_options_get_lifetime (kim_options   in_options,
-                                      kim_lifetime *out_lifetime);
+                                    kim_lifetime *out_lifetime);
 
 /*!
-* \param io_options    an options object to modify.
+ * \param io_options    an options object to modify.
  * \param in_renewable a boolean value indicating whether or not to request a renewable 
  *                     credential.
  * \return On success, #KIM_NO_ERROR.  On failure, an error object representing the failure.
@@ -473,10 +473,10 @@ kim_error kim_options_get_lifetime (kim_options   in_options,
  * \sa kim_options_get_renewable()
  */
 kim_error kim_options_set_renewable (kim_options io_options,
-                                       kim_boolean in_renewable);
+                                     kim_boolean in_renewable);
 
 /*!
-* \param in_options     an options object.
+ * \param in_options     an options object.
  * \param out_renewable on exit, a boolean value indicating whether or \a in_options will 
  *                      request a renewable credential.
  * \return On success, #KIM_NO_ERROR.  On failure, an error object representing the failure.
@@ -486,7 +486,7 @@ kim_error kim_options_set_renewable (kim_options io_options,
  * \sa kim_options_set_renewable()
  */
 kim_error kim_options_get_renewable (kim_options  in_options,
-                                       kim_boolean *out_renewable);
+                                     kim_boolean *out_renewable);
 
 /*!
  * \param io_options          an options object to modify.
@@ -501,7 +501,7 @@ kim_error kim_options_get_renewable (kim_options  in_options,
  * \sa kim_options_get_renewal_lifetime(), kim_identity_renew(), kim_credential_renew(), kim_ccache_renew()
  */
 kim_error kim_options_set_renewal_lifetime (kim_options  io_options,
-                                              kim_lifetime in_renewal_lifetime);
+                                            kim_lifetime in_renewal_lifetime);
 
 /*!
  * \param in_options   an options object.
@@ -517,7 +517,7 @@ kim_error kim_options_set_renewal_lifetime (kim_options  io_options,
  * \sa kim_options_set_renewal_lifetime(), kim_identity_renew(), kim_credential_renew(), kim_ccache_renew()
  */
 kim_error kim_options_get_renewal_lifetime (kim_options   in_options,
-                                              kim_lifetime *out_renewal_lifetime);
+                                            kim_lifetime *out_renewal_lifetime);
 
 /*!
  * \param io_options     an options object to modify.
@@ -530,7 +530,7 @@ kim_error kim_options_get_renewal_lifetime (kim_options   in_options,
  * \sa kim_options_get_forwardable()
  */
 kim_error kim_options_set_forwardable (kim_options io_options,
-                                         kim_boolean in_forwardable);
+                                       kim_boolean in_forwardable);
 
 /*!
  * \param in_options      an options object.
@@ -543,7 +543,7 @@ kim_error kim_options_set_forwardable (kim_options io_options,
  * \sa kim_options_set_forwardable()
  */
 kim_error kim_options_get_forwardable (kim_options  in_options,
-                                         kim_boolean *out_forwardable);
+                                       kim_boolean *out_forwardable);
 
 /*!
  * \param io_options   an options object to modify.
@@ -556,7 +556,7 @@ kim_error kim_options_get_forwardable (kim_options  in_options,
  * \sa kim_options_get_proxiable()
  */
 kim_error kim_options_set_proxiable (kim_options io_options,
-                                       kim_boolean in_proxiable);
+                                     kim_boolean in_proxiable);
 
 /*!
  * \param in_options    an options object.
@@ -569,7 +569,7 @@ kim_error kim_options_set_proxiable (kim_options io_options,
  * \sa kim_options_set_proxiable()
  */
 kim_error kim_options_get_proxiable (kim_options  in_options,
-                                       kim_boolean *out_proxiable);
+                                     kim_boolean *out_proxiable);
 
 /*!
  * \param io_options     an options object to modify.
@@ -582,7 +582,7 @@ kim_error kim_options_get_proxiable (kim_options  in_options,
  * \sa kim_options_get_addressless()
  */
 kim_error kim_options_set_addressless (kim_options io_options,
-                                         kim_boolean in_addressless);
+                                       kim_boolean in_addressless);
 
 /*!
  * \param in_options      an options object.
@@ -595,7 +595,7 @@ kim_error kim_options_set_addressless (kim_options io_options,
  * \sa kim_options_set_addressless()
  */
 kim_error kim_options_get_addressless (kim_options  in_options,
-                                         kim_boolean *out_addressless);
+                                       kim_boolean *out_addressless);
 
 /*!
  * \param io_options       an options object to modify.
@@ -607,7 +607,7 @@ kim_error kim_options_get_addressless (kim_options  in_options,
  * \sa kim_options_get_service_name()
  */
 kim_error kim_options_set_service_name (kim_options io_options,
-                                         kim_string  in_service_name);
+                                        kim_string  in_service_name);
 
 /*!
  * \param in_options        an options object.
@@ -620,7 +620,7 @@ kim_error kim_options_set_service_name (kim_options io_options,
  * \sa kim_options_set_service_name()
  */
 kim_error kim_options_get_service_name (kim_options  in_options,
-                                         kim_string  *out_service_name);
+                                        kim_string  *out_service_name);
 
 /*!
  * \param io_options the options object to be freed.  Set to NULL on exit.
index b3aac01196c6c9b690afb496470c49af3221b9fa..916d5b772449fdd6fb79cabbeafe89d7a147aae0 100644 (file)
@@ -52,14 +52,15 @@ kim_error kim_ccache_iterator_create (kim_ccache_iterator *out_ccache_iterator)
     }
     
     if (!err) {
-        err = krb5_error (krb5_init_context (&ccache_iterator->context));
+        err = krb5_error (NULL, krb5_init_context (&ccache_iterator->context));
     }
     
     if (!err) {
-        err = krb5_error (krb5_cccol_cursor_new (ccache_iterator->context,
+        err = krb5_error (ccache_iterator->context,
+                          krb5_cccol_cursor_new (ccache_iterator->context,
                                                  &ccache_iterator->cursor));
     }
-        
+    
     if (!err) {    
         *out_ccache_iterator = ccache_iterator;
         ccache_iterator = NULL;
@@ -73,7 +74,7 @@ kim_error kim_ccache_iterator_create (kim_ccache_iterator *out_ccache_iterator)
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_iterator_next (kim_ccache_iterator  in_ccache_iterator,
-                                      kim_ccache          *out_ccache)
+                                    kim_ccache          *out_ccache)
 {
     kim_error err = KIM_NO_ERROR;
     krb5_ccache ccache = NULL;
@@ -85,7 +86,7 @@ kim_error kim_ccache_iterator_next (kim_ccache_iterator  in_ccache_iterator,
         krb5_error_code terr = krb5_cccol_cursor_next (in_ccache_iterator->context, 
                                                        in_ccache_iterator->cursor,
                                                        &ccache);
-
+        
         if (!terr) {
             err = kim_ccache_create_from_krb5_ccache (out_ccache,
                                                       in_ccache_iterator->context, 
@@ -94,7 +95,7 @@ kim_error kim_ccache_iterator_next (kim_ccache_iterator  in_ccache_iterator,
             *out_ccache = NULL; /* no more ccaches */
             
         } else {
-            err = krb5_error (terr);
+            err = krb5_error (in_ccache_iterator->context, terr);
         }
     }
     
@@ -134,8 +135,8 @@ struct kim_ccache_opaque kim_ccache_initializer = { NULL, NULL };
 /* ------------------------------------------------------------------------ */
 
 static kim_error kim_ccache_create_resolve_name (kim_string *out_resolve_name,
-                                                   kim_string  in_name,
-                                                   kim_string  in_type)
+                                                 kim_string  in_name,
+                                                 kim_string  in_type)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -154,9 +155,9 @@ static kim_error kim_ccache_create_resolve_name (kim_string *out_resolve_name,
 /* ------------------------------------------------------------------------ */
 
 static kim_boolean kim_ccache_k5ccaches_are_equal (krb5_context in_context,
-                                                     krb5_ccache  in_ccache,
-                                                     krb5_context in_compare_to_context,
-                                                     krb5_ccache  io_compare_to_ccache)
+                                                   krb5_ccache  in_ccache,
+                                                   krb5_context in_compare_to_context,
+                                                   krb5_ccache  io_compare_to_ccache)
 {
     kim_boolean equal = FALSE;
     
@@ -205,8 +206,8 @@ static inline kim_error kim_ccache_allocate (kim_ccache *out_ccache)
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_create_new (kim_ccache          *out_ccache,
-                                   kim_identity         in_client_identity,
-                                   kim_options          in_options)
+                                 kim_identity         in_client_identity,
+                                 kim_options          in_options)
 {
     kim_error err = KIM_NO_ERROR;
     kim_credential credential = NULL;
@@ -221,7 +222,7 @@ kim_error kim_ccache_create_new (kim_ccache          *out_ccache,
     if (!err) {
         err = kim_credential_get_client_identity (credential, &client_identity);
     }
-        
+    
     if (!err) {
         err = kim_credential_store (credential, client_identity, out_ccache);
     }
@@ -235,8 +236,8 @@ kim_error kim_ccache_create_new (kim_ccache          *out_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_create_new_if_needed (kim_ccache   *out_ccache,
-                                             kim_identity  in_client_identity,
-                                             kim_options   in_options)
+                                           kim_identity  in_client_identity,
+                                           kim_options   in_options)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -258,7 +259,7 @@ kim_error kim_ccache_create_new_if_needed (kim_ccache   *out_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_create_from_client_identity (kim_ccache   *out_ccache,
-                                                    kim_identity  in_client_identity)
+                                                  kim_identity  in_client_identity)
 {
     kim_error err = KIM_NO_ERROR;
     kim_ccache_iterator iterator = NULL;
@@ -286,7 +287,7 @@ kim_error kim_ccache_create_from_client_identity (kim_ccache   *out_ccache,
                 err = kim_error_create_from_code (KIM_NO_SUCH_PRINCIPAL_ECODE, 
                                                   string);
             }
-        
+            
             kim_string_free (&string);
         }
         
@@ -302,7 +303,7 @@ kim_error kim_ccache_create_from_client_identity (kim_ccache   *out_ccache,
             *out_ccache = ccache;
             ccache = NULL;
         }
-
+        
         kim_identity_free (&identity);
         kim_ccache_free (&ccache);
     }
@@ -315,9 +316,9 @@ kim_error kim_ccache_create_from_client_identity (kim_ccache   *out_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_create_from_keytab (kim_ccache    *out_ccache,
-                                           kim_identity   in_identity,
-                                           kim_options    in_options,
-                                           kim_string     in_keytab)
+                                         kim_identity   in_identity,
+                                         kim_options    in_options,
+                                         kim_string     in_keytab)
 {
     kim_error err = KIM_NO_ERROR;
     kim_credential credential = NULL;
@@ -358,13 +359,14 @@ kim_error kim_ccache_create_from_default (kim_ccache *out_ccache)
     }
     
     if (!err) {
-        err = krb5_error (krb5_init_context (&ccache->context));
+        err = krb5_error (NULL, krb5_init_context (&ccache->context));
     }
-
+    
     if (!err) {
-        err = krb5_error (krb5_cc_default (ccache->context, &ccache->ccache));
+        err = krb5_error (ccache->context,
+                          krb5_cc_default (ccache->context, &ccache->ccache));
     }
-
+    
     if (!err) {
         *out_ccache = ccache;
         ccache = NULL;
@@ -378,7 +380,7 @@ kim_error kim_ccache_create_from_default (kim_ccache *out_ccache)
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_create_from_display_name (kim_ccache  *out_ccache,
-                                                 kim_string   in_display_name)
+                                               kim_string   in_display_name)
 {
     kim_error err = KIM_NO_ERROR;
     kim_ccache ccache = NULL;
@@ -391,11 +393,12 @@ kim_error kim_ccache_create_from_display_name (kim_ccache  *out_ccache,
     }
     
     if (!err) {
-        err = krb5_error (krb5_init_context (&ccache->context));
+        err = krb5_error (NULL, krb5_init_context (&ccache->context));
     }
     
     if (!err) {
-        err = krb5_error (krb5_cc_resolve (ccache->context, in_display_name, 
+        err = krb5_error (ccache->context,
+                          krb5_cc_resolve (ccache->context, in_display_name, 
                                            &ccache->ccache));
     }
     
@@ -412,8 +415,8 @@ kim_error kim_ccache_create_from_display_name (kim_ccache  *out_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_create_from_type_and_name (kim_ccache  *out_ccache,
-                                                  kim_string   in_type,
-                                                  kim_string   in_name)
+                                                kim_string   in_type,
+                                                kim_string   in_name)
 {
     kim_error err = KIM_NO_ERROR;
     kim_string resolve_name = NULL;
@@ -438,8 +441,8 @@ kim_error kim_ccache_create_from_type_and_name (kim_ccache  *out_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_create_from_krb5_ccache (kim_ccache  *out_ccache,
-                                                krb5_context   in_krb5_context,
-                                                krb5_ccache    in_krb5_ccache)
+                                              krb5_context   in_krb5_context,
+                                              krb5_ccache    in_krb5_ccache)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -460,7 +463,7 @@ kim_error kim_ccache_create_from_krb5_ccache (kim_ccache  *out_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_copy (kim_ccache  *out_ccache,
-                             kim_ccache   in_ccache)
+                           kim_ccache   in_ccache)
 {
     kim_error err = KIM_NO_ERROR;
     kim_string name = NULL;
@@ -472,7 +475,7 @@ kim_error kim_ccache_copy (kim_ccache  *out_ccache,
     if (!err) {
         err = kim_ccache_get_name (in_ccache, &name);
     }
-
+    
     if (!err) {
         err = kim_ccache_get_type (in_ccache, &type);
     }
@@ -483,7 +486,7 @@ kim_error kim_ccache_copy (kim_ccache  *out_ccache,
     
     kim_string_free (&name);
     kim_string_free (&type);
-
+    
     return check_error (err);
 }
 
@@ -492,8 +495,8 @@ kim_error kim_ccache_copy (kim_ccache  *out_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_compare (kim_ccache   in_ccache,
-                                kim_ccache   in_compare_to_ccache,
-                                kim_boolean *out_equal)
+                              kim_ccache   in_compare_to_ccache,
+                              kim_boolean *out_equal)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -514,8 +517,8 @@ kim_error kim_ccache_compare (kim_ccache   in_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_get_krb5_ccache (kim_ccache  in_ccache,
-                                        krb5_context  in_krb5_context,
-                                        krb5_ccache  *out_krb5_ccache)
+                                      krb5_context  in_krb5_context,
+                                      krb5_ccache  *out_krb5_ccache)
 {
     kim_error err = KIM_NO_ERROR;
     kim_string resolve_name = NULL;
@@ -529,7 +532,8 @@ kim_error kim_ccache_get_krb5_ccache (kim_ccache  in_ccache,
     }
     
     if (!err) {
-        err = krb5_error (krb5_cc_resolve (in_krb5_context, resolve_name, 
+        err = krb5_error (in_krb5_context,
+                          krb5_cc_resolve (in_krb5_context, resolve_name, 
                                            out_krb5_ccache));
     }
     
@@ -541,7 +545,7 @@ kim_error kim_ccache_get_krb5_ccache (kim_ccache  in_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_get_type (kim_ccache  in_ccache,
-                                 kim_string *out_type)
+                               kim_string *out_type)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -559,7 +563,7 @@ kim_error kim_ccache_get_type (kim_ccache  in_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_get_name (kim_ccache  in_ccache,
-                                 kim_string *out_name)
+                               kim_string *out_name)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -577,7 +581,7 @@ kim_error kim_ccache_get_name (kim_ccache  in_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_get_display_name (kim_ccache  in_ccache,
-                                         kim_string *out_display_name)
+                                       kim_string *out_display_name)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -586,10 +590,10 @@ kim_error kim_ccache_get_display_name (kim_ccache  in_ccache,
     
     if (!err) {
         kim_string type = krb5_cc_get_type (in_ccache->context, 
-                                              in_ccache->ccache);
+                                            in_ccache->ccache);
         kim_string name = krb5_cc_get_name (in_ccache->context, 
-                                              in_ccache->ccache);
-
+                                            in_ccache->ccache);
+        
         err = kim_ccache_create_resolve_name (out_display_name, type, name);
     }
     
@@ -599,7 +603,7 @@ kim_error kim_ccache_get_display_name (kim_ccache  in_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_get_client_identity (kim_ccache    in_ccache,
-                                            kim_identity *out_client_identity)
+                                          kim_identity *out_client_identity)
 {
     kim_error err = KIM_NO_ERROR;
     krb5_principal principal = NULL;
@@ -608,7 +612,8 @@ kim_error kim_ccache_get_client_identity (kim_ccache    in_ccache,
     if (!err && !out_client_identity) { err = param_error (2, "out_client_identity", "NULL"); }
     
     if (!err) {
-        err = krb5_error (krb5_cc_get_principal (in_ccache->context, 
+        err = krb5_error (in_ccache->context,
+                          krb5_cc_get_principal (in_ccache->context, 
                                                  in_ccache->ccache, 
                                                  &principal));
     }
@@ -627,7 +632,7 @@ kim_error kim_ccache_get_client_identity (kim_ccache    in_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_get_valid_credential (kim_ccache      in_ccache,
-                                             kim_credential *out_credential)
+                                           kim_credential *out_credential)
 {
     kim_error err = KIM_NO_ERROR;
     kim_credential_iterator iterator = NULL;
@@ -744,7 +749,7 @@ kim_error kim_ccache_get_valid_credential (kim_ccache      in_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_get_start_time (kim_ccache  in_ccache,
-                                       kim_time   *out_start_time)
+                                     kim_time   *out_start_time)
 {
     kim_error err = KIM_NO_ERROR;
     kim_credential credential = NULL;
@@ -768,7 +773,7 @@ kim_error kim_ccache_get_start_time (kim_ccache  in_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_get_expiration_time (kim_ccache  in_ccache,
-                                            kim_time   *out_expiration_time)
+                                          kim_time   *out_expiration_time)
 {
     kim_error err = KIM_NO_ERROR;
     kim_credential credential = NULL;
@@ -793,7 +798,7 @@ kim_error kim_ccache_get_expiration_time (kim_ccache  in_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_get_renewal_expiration_time (kim_ccache  in_ccache,
-                                                    kim_time   *out_renewal_expiration_time)
+                                                  kim_time   *out_renewal_expiration_time)
 {
     kim_error err = KIM_NO_ERROR;
     kim_credential credential = NULL;
@@ -832,7 +837,8 @@ kim_error kim_ccache_set_default (kim_ccache io_ccache)
             krb5_ccache environment_ccache = NULL;
             krb5_principal client_principal = NULL;
             
-            err = krb5_error (krb5_cc_resolve (io_ccache->context, 
+            err = krb5_error (io_ccache->context,
+                              krb5_cc_resolve (io_ccache->context, 
                                                environment_ccache_name, 
                                                &environment_ccache));
             
@@ -843,18 +849,21 @@ kim_error kim_ccache_set_default (kim_ccache io_ccache)
                 /* KRB5CCNAME is set and does not point to this ccache.  
                  * Move the creds and make this kim_ccache_t object refer to that ccache.  */
                 
-                err = krb5_error (krb5_cc_get_principal (io_ccache->context, 
+                err = krb5_error (io_ccache->context,
+                                  krb5_cc_get_principal (io_ccache->context, 
                                                          io_ccache->ccache, 
                                                          &client_principal));
-            
+                
                 if (!err) {
-                    err = krb5_error (krb5_cc_initialize (io_ccache->context, 
+                    err = krb5_error (io_ccache->context,
+                                      krb5_cc_initialize (io_ccache->context, 
                                                           environment_ccache, 
                                                           client_principal));
                 }
                 
                 if (!err) {
-                    err = krb5_error (krb5_cc_copy_creds (io_ccache->context, 
+                    err = krb5_error (io_ccache->context,
+                                      krb5_cc_copy_creds (io_ccache->context, 
                                                           io_ccache->ccache, 
                                                           environment_ccache));
                 }
@@ -887,7 +896,7 @@ kim_error kim_ccache_set_default (kim_ccache io_ccache)
                     err = kim_error_create_from_code (KIM_CANT_BECOME_DEFAULT_ECODE, 
                                                       display_name);
                 }
-                    
+                
                 kim_string_free (&display_name);
             }
             
@@ -923,13 +932,13 @@ kim_error kim_ccache_set_default (kim_ccache io_ccache)
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_verify (kim_ccache   in_ccache,
-                               kim_identity in_service_identity,
-                               kim_string   in_keytab,
-                               kim_boolean  in_fail_if_no_service_key)
+                             kim_identity in_service_identity,
+                             kim_string   in_keytab,
+                             kim_boolean  in_fail_if_no_service_key)
 {
     kim_error err = KIM_NO_ERROR;
     kim_credential credential = NULL;
-        
+    
     if (!err && !in_ccache) { err = param_error (1, "in_ccache", "NULL"); }
     
     if (!err) {
@@ -942,14 +951,14 @@ kim_error kim_ccache_verify (kim_ccache   in_ccache,
     }
     
     kim_credential_free (&credential);
-
+    
     return check_error (err);
 }
 
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_renew (kim_ccache  in_ccache,
-                              kim_options in_options)
+                            kim_options in_options)
 {
     kim_error err = KIM_NO_ERROR;
     kim_credential credential = NULL;
@@ -982,7 +991,7 @@ kim_error kim_ccache_renew (kim_ccache  in_ccache,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ccache_validate (kim_ccache  in_ccache,
-                                 kim_options in_options)
+                               kim_options in_options)
 {
     kim_error err = KIM_NO_ERROR;
     kim_credential credential = NULL;
@@ -1021,7 +1030,8 @@ kim_error kim_ccache_destroy (kim_ccache *io_ccache)
     kim_error err = KIM_NO_ERROR;
     
     if (io_ccache && *io_ccache) {
-        err = krb5_error (krb5_cc_destroy ((*io_ccache)->context, 
+        err = krb5_error ((*io_ccache)->context,
+                          krb5_cc_destroy ((*io_ccache)->context, 
                                            (*io_ccache)->ccache));
         
         if (!err) { 
index f769622a95a1c01af8ef6052f8149114a1c5c612..1abd00464ef8cc17d3a399e3f4ae8211d81290e2 100644 (file)
 #include <kim/kim.h>
 
 kim_error kim_ccache_create_from_display_name (kim_ccache  *out_ccache,
-                                                 kim_string   in_display_name);
+                                               kim_string   in_display_name);
 
 kim_error kim_ccache_compare (kim_ccache   in_ccache,
-                                kim_ccache   in_compare_to_ccache,
-                                kim_boolean *out_equal);
+                              kim_ccache   in_compare_to_ccache,
+                              kim_boolean *out_equal);
 
 #endif /* KIM_CCACHE_PRIVATE_H */
index c985eb2a815a3b44ffe8a370f6ede22e0c268bcc..882fd4c72fa4997ce4576d73933c60e27d6b6563 100644 (file)
@@ -56,7 +56,7 @@ kim_error kim_credential_iterator_create (kim_credential_iterator *out_credentia
     }
     
     if (!err) {
-        err = krb5_error (krb5_init_context (&credential_iterator->context));
+        err = krb5_error (NULL, krb5_init_context (&credential_iterator->context));
     }
     
     if (!err) {
@@ -66,7 +66,8 @@ kim_error kim_credential_iterator_create (kim_credential_iterator *out_credentia
     }
     
     if (!err) {
-        err = krb5_error (krb5_cc_start_seq_get (credential_iterator->context, 
+        err = krb5_error (credential_iterator->context,
+                          krb5_cc_start_seq_get (credential_iterator->context, 
                                                  credential_iterator->ccache,
                                                  &credential_iterator->cursor));
     }
@@ -110,7 +111,7 @@ kim_error kim_credential_iterator_next (kim_credential_iterator  in_credential_i
             *out_credential = NULL; /* no more ccaches */
             
         } else {
-            err = krb5_error (terr);
+            err = krb5_error (in_credential_iterator->context, terr);
         }
     }
     
@@ -191,7 +192,7 @@ kim_error kim_credential_create_new (kim_credential *out_credential,
     }
     
     if (!err) {
-        err = krb5_error (krb5_init_context (&credential->context));
+        err = krb5_error (NULL, krb5_init_context (&credential->context));
     }
     
     if (!err) {
@@ -230,7 +231,7 @@ kim_error kim_credential_create_from_keytab (kim_credential *out_credential,
     }
     
     if (!err) {
-        err = krb5_error (krb5_init_context (&credential->context));
+        err = krb5_error (NULL, krb5_init_context (&credential->context));
     }
     
     if (!err) {
@@ -249,7 +250,8 @@ kim_error kim_credential_create_from_keytab (kim_credential *out_credential,
        }
        
         if (!err) {
-            err = kim_options_get_init_cred_options (options, credential->context,
+            err = kim_options_get_init_cred_options (options, 
+                                                     credential->context,
                                                      &init_cred_options);
         }
         
@@ -258,29 +260,44 @@ kim_error kim_credential_create_from_keytab (kim_credential *out_credential,
     
     if (!err) {
         if (in_keytab) {
-            err = krb5_error (krb5_kt_resolve (credential->context, in_keytab, &keytab));
+            err = krb5_error (credential->context,
+                              krb5_kt_resolve (credential->context, 
+                                               in_keytab, &keytab));
         } else {
-            err = krb5_error (krb5_kt_default (credential->context, &keytab));
+            err = krb5_error (credential->context,
+                              krb5_kt_default (credential->context, &keytab));
         }
     }
     
     if (!err) {
         if (in_identity) {
-            err = kim_identity_get_krb5_principal (in_identity, credential->context, &principal);
+            err = kim_identity_get_krb5_principal (in_identity, 
+                                                   credential->context, 
+                                                   &principal);
         } else {
             krb5_kt_cursor cursor = NULL;
             krb5_keytab_entry entry;
             kim_boolean entry_allocated = FALSE;
             
-            err = krb5_error (krb5_kt_start_seq_get (credential->context, keytab, &cursor));
+            err = krb5_error (credential->context,
+                              krb5_kt_start_seq_get (credential->context, 
+                                                     keytab, 
+                                                     &cursor));
             
             if (!err) {
-                err = krb5_error (krb5_kt_next_entry (credential->context, keytab, &entry, &cursor));
+                err = krb5_error (credential->context,
+                                  krb5_kt_next_entry (credential->context, 
+                                                      keytab, 
+                                                      &entry, 
+                                                      &cursor));
                 entry_allocated = (err == KIM_NO_ERROR); /* remember to free later */
             }
             
             if (!err) {
-                err = krb5_error (krb5_copy_principal (credential->context, entry.principal, &principal));
+                err = krb5_error (credential->context,
+                                  krb5_copy_principal (credential->context, 
+                                                       entry.principal, 
+                                                       &principal));
             }
             
             if (entry_allocated) { krb5_free_keytab_entry_contents (credential->context, &entry); }
@@ -289,13 +306,22 @@ kim_error kim_credential_create_from_keytab (kim_credential *out_credential,
     }
     
     if (!err) {
-        err = krb5_error (krb5_get_init_creds_keytab (credential->context, &creds, principal, keytab, 
-                                                      start_time, (char *) service_name, init_cred_options));
+        err = krb5_error (credential->context,
+                          krb5_get_init_creds_keytab (credential->context, 
+                                                      &creds, 
+                                                      principal, 
+                                                      keytab, 
+                                                      start_time, 
+                                                      (char *) service_name, 
+                                                      init_cred_options));
         if (!err) { free_creds = TRUE; }
     }
     
     if (!err) {
-        err = krb5_error (krb5_copy_creds (credential->context, &creds, &credential->creds));
+        err = krb5_error (credential->context,
+                          krb5_copy_creds (credential->context,
+                                           &creds, 
+                                           &credential->creds));
     }
     
     if (!err) {
@@ -315,8 +341,8 @@ kim_error kim_credential_create_from_keytab (kim_credential *out_credential,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_credential_create_from_krb5_creds (kim_credential *out_credential,
-                                                 krb5_context      in_krb5_context,
-                                                 krb5_creds       *in_krb5_creds)
+                                                 krb5_context    in_krb5_context,
+                                                 krb5_creds     *in_krb5_creds)
 {
     kim_error err = KIM_NO_ERROR;
     kim_credential credential = NULL;
@@ -330,11 +356,14 @@ kim_error kim_credential_create_from_krb5_creds (kim_credential *out_credential,
     }
     
     if (!err) {
-        err = krb5_error (krb5_init_context (&credential->context));
+        err = krb5_error (NULL, krb5_init_context (&credential->context));
     }
     
     if (!err) {
-        err = krb5_error (krb5_copy_creds (credential->context, in_krb5_creds, &credential->creds));
+        err = krb5_error (credential->context,
+                          krb5_copy_creds (credential->context, 
+                                           in_krb5_creds, 
+                                           &credential->creds));
     }
     
     if (!err) {
@@ -361,11 +390,14 @@ kim_error kim_credential_copy (kim_credential *out_credential,
     }
     
     if (!err) {
-        err = krb5_error (krb5_init_context (&credential->context));
+        err = krb5_error (NULL, krb5_init_context (&credential->context));
     }
     
     if (!err) {
-        err = krb5_error (krb5_copy_creds (credential->context, in_credential->creds, &credential->creds));
+        err = krb5_error (credential->context,
+                          krb5_copy_creds (credential->context, 
+                                           in_credential->creds, 
+                                           &credential->creds));
     }
     
     if (!err) {
@@ -379,8 +411,8 @@ kim_error kim_credential_copy (kim_credential *out_credential,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_credential_get_krb5_creds (kim_credential   in_credential,
-                                         krb5_context       in_krb5_context,
-                                         krb5_creds       **out_krb5_creds)
+                                         krb5_context     in_krb5_context,
+                                         krb5_creds     **out_krb5_creds)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -389,7 +421,10 @@ kim_error kim_credential_get_krb5_creds (kim_credential   in_credential,
     if (!err && !out_krb5_creds ) { err = param_error (3, "out_krb5_creds", "NULL"); }
     
     if (!err) {
-        err = krb5_error (krb5_copy_creds (in_krb5_context, in_credential->creds, out_krb5_creds));
+        err = krb5_error (in_krb5_context,
+                          krb5_copy_creds (in_krb5_context, 
+                                           in_credential->creds, 
+                                           out_krb5_creds));
     }
     
     return check_error (err);
@@ -481,7 +516,9 @@ kim_error kim_credential_get_state (kim_credential           in_credential,
     if (!err) {
         krb5_int32 usec;
         
-        err = krb5_error (krb5_us_timeofday (in_credential->context, &now, &usec));
+        err = krb5_error (in_credential->context,
+                          krb5_us_timeofday (in_credential->context, 
+                                             &now, &usec));
     }
     
     if (!err) {
@@ -501,16 +538,18 @@ kim_error kim_credential_get_state (kim_credential           in_credential,
         } else if (in_credential->creds->addresses) { /* ticket contains addresses */
             krb5_address **laddresses = NULL;
             
-            krb5_error_code code = krb5_os_localaddr (in_credential->context, &laddresses);
+            krb5_error_code code = krb5_os_localaddr (in_credential->context, 
+                                                      &laddresses);
             if (!code) { laddresses = NULL; }
             
             if (laddresses) { /* assume valid if the local host has no addresses */
                 kim_boolean found_match = FALSE;
                 kim_count i = 0;
                 
-                for (i = 0; in_credential->creds->addresses[0]; i++) {
-                    if (krb5_address_search (in_credential->context, 
-                                             in_credential->creds->addresses[i], laddresses)) {
+                for (i = 0; in_credential->creds->addresses[i]; i++) {
+                    if (!krb5_address_search (in_credential->context, 
+                                              in_credential->creds->addresses[i], 
+                                              laddresses)) {
                         found_match = TRUE;
                         break;
                     }
@@ -521,7 +560,8 @@ kim_error kim_credential_get_state (kim_credential           in_credential,
                 }
             }
             
-            if (laddresses) { krb5_free_addresses (in_credential->context, laddresses); }
+            if (laddresses) { krb5_free_addresses (in_credential->context, 
+                                                   laddresses); }
         }
     }
     
@@ -595,7 +635,7 @@ kim_error kim_credential_store (kim_credential  in_credential,
     if (!err && !in_client_identity) { err = param_error (2, "in_client_identity", "NULL"); }
     
     if (!err) {
-        err = krb5_error (krb5_init_context (&context));
+        err = krb5_error (NULL, krb5_init_context (&context));
     }
     
     if (!err) {
@@ -607,12 +647,15 @@ kim_error kim_credential_store (kim_credential  in_credential,
         char *environment_ccache = getenv ("KRB5CCNAME");
         
         if (environment_ccache) {
-            err = krb5_error (krb5_cc_resolve (context, environment_ccache, &k5ccache));
+            err = krb5_error (context,
+                              krb5_cc_resolve (context, environment_ccache, 
+                                               &k5ccache));
             
         } else {
             kim_ccache ccache = NULL;
             
-            err = kim_ccache_create_from_client_identity (&ccache, in_client_identity);
+            err = kim_ccache_create_from_client_identity (&ccache, 
+                                                          in_client_identity);
             
             if (!err) {
                 err = kim_ccache_get_krb5_ccache (ccache, context, &k5ccache);
@@ -620,7 +663,9 @@ kim_error kim_credential_store (kim_credential  in_credential,
             } else if (kim_error_get_code (err) == KIM_NO_SUCH_PRINCIPAL_ECODE) {
                 /* Nothing to replace, toss error and create a new ccache */
                 kim_error_free (&err); 
-                err = krb5_error (krb5_cc_new_unique (context, "API", NULL, &k5ccache));
+                err = krb5_error (context,
+                                  krb5_cc_new_unique (context, "API", NULL, 
+                                                      &k5ccache));
                 if (!err) { destroy_ccache_on_error = TRUE; }
             }
             
@@ -629,12 +674,14 @@ kim_error kim_credential_store (kim_credential  in_credential,
     }
     
     if (!err) {
-       err = krb5_error (krb5_cc_initialize (in_credential->context, 
+       err = krb5_error (in_credential->context,
+                          krb5_cc_initialize (in_credential->context, 
                                               k5ccache, client_principal));
     }
     
     if (!err) {
-       err = krb5_error (krb5_cc_store_cred (in_credential->context, 
+       err = krb5_error (in_credential->context,
+                          krb5_cc_store_cred (in_credential->context, 
                                               k5ccache, in_credential->creds));
     }
     
@@ -673,7 +720,7 @@ kim_error kim_credential_verify (kim_credential in_credential,
     if (!err && !in_credential) { err = param_error (1, "in_credential", "NULL"); }
     
     if (!err) {
-       err = krb5_error (krb5_init_secure_context (&scontext));
+       err = krb5_error (NULL, krb5_init_secure_context (&scontext));
     }
     
     if (!err && in_service_identity) {
@@ -681,7 +728,8 @@ kim_error kim_credential_verify (kim_credential in_credential,
     }
     
     if (in_keytab) {
-       err = krb5_error (krb5_kt_resolve (scontext, in_keytab, &keytab));
+       err = krb5_error (scontext, 
+                          krb5_kt_resolve (scontext, in_keytab, &keytab));
     }
     
     if (!err) {
@@ -691,7 +739,8 @@ kim_error kim_credential_verify (kim_credential in_credential,
         krb5_verify_init_creds_opt_init (&options);
         krb5_verify_init_creds_opt_set_ap_req_nofail (&options, in_fail_if_no_service_key);
         
-       err = krb5_error (krb5_verify_init_creds (scontext, in_credential->creds, 
+       err = krb5_error (scontext,
+                          krb5_verify_init_creds (scontext, in_credential->creds, 
                                                  service_principal,
                                                  keytab,
                                                  NULL /* don't store creds in ccache */,
@@ -777,18 +826,21 @@ kim_error kim_credential_renew (kim_credential *io_credential,
     }
     
     if (!err) {
-       err = krb5_error (krb5_cc_new_unique ((*io_credential)->context, 
+       err = krb5_error ((*io_credential)->context,
+                          krb5_cc_new_unique ((*io_credential)->context, 
                                              "MEMORY", NULL, 
                                              &ccache));
     }
     
     if (!err) {
-       err = krb5_error (krb5_cc_initialize ((*io_credential)->context, ccache, 
+       err = krb5_error ((*io_credential)->context,
+                          krb5_cc_initialize ((*io_credential)->context, ccache, 
                                              (*io_credential)->creds->client));
     }
     
     if (!err) {
-       err = krb5_error (krb5_cc_store_cred ((*io_credential)->context, ccache, 
+       err = krb5_error ((*io_credential)->context,
+                          krb5_cc_store_cred ((*io_credential)->context, ccache, 
                                              (*io_credential)->creds));
     }
     
@@ -797,13 +849,16 @@ kim_error kim_credential_renew (kim_credential *io_credential,
        krb5_creds *renewed_creds = NULL;
        kim_boolean free_creds = 0;
        
-       err = krb5_error (krb5_get_renewed_creds ((*io_credential)->context, 
+       err = krb5_error ((*io_credential)->context,
+                          krb5_get_renewed_creds ((*io_credential)->context, 
                                                  &creds, (*io_credential)->creds->client,
                                                  ccache, (char *) service_name));
        if (!err) { free_creds = 1; }
         
        if (!err) {
-           err = krb5_error (krb5_copy_creds ((*io_credential)->context, &creds, &renewed_creds));
+           err = krb5_error ((*io_credential)->context,
+                              krb5_copy_creds ((*io_credential)->context, 
+                                               &creds, &renewed_creds));
        }
        
        if (!err) {
@@ -847,18 +902,21 @@ kim_error kim_credential_validate (kim_credential *io_credential,
     }
     
     if (!err) {
-       err = krb5_error (krb5_cc_new_unique ((*io_credential)->context, 
+       err = krb5_error ((*io_credential)->context,
+                          krb5_cc_new_unique ((*io_credential)->context, 
                                              "MEMORY", NULL, 
                                              &ccache));
     }
     
     if (!err) {
-       err = krb5_error (krb5_cc_initialize ((*io_credential)->context, ccache, 
+       err = krb5_error ((*io_credential)->context,
+                          krb5_cc_initialize ((*io_credential)->context, ccache, 
                                              (*io_credential)->creds->client));
     }
     
     if (!err) {
-       err = krb5_error (krb5_cc_store_cred ((*io_credential)->context, ccache, 
+       err = krb5_error ((*io_credential)->context,
+                          krb5_cc_store_cred ((*io_credential)->context, ccache, 
                                              (*io_credential)->creds));
     }
     
@@ -867,13 +925,18 @@ kim_error kim_credential_validate (kim_credential *io_credential,
        krb5_creds *validated_creds = NULL;
        kim_boolean free_creds = 0;
        
-        err = krb5_error (krb5_get_validated_creds ((*io_credential)->context, 
-                                                   &creds, (*io_credential)->creds->client, 
-                                                   ccache, (char *) service_name));
+        err = krb5_error ((*io_credential)->context,
+                          krb5_get_validated_creds ((*io_credential)->context, 
+                                                   &creds, 
+                                                    (*io_credential)->creds->client, 
+                                                   ccache, 
+                                                    (char *) service_name));
        if (!err) { free_creds = 1; }
        
        if (!err) {
-           err = krb5_error (krb5_copy_creds ((*io_credential)->context, &creds, &validated_creds));
+           err = krb5_error ((*io_credential)->context,
+                              krb5_copy_creds ((*io_credential)->context, 
+                                               &creds, &validated_creds));
        }
        
        if (!err) {
index 6698139d2f9267a1b7f3e866b86286ec1706ead3..890f044c1b0054ba78717feff6cd459daafe32b6 100644 (file)
@@ -40,11 +40,26 @@ struct kim_error_opaque kim_error_initializer = { KIM_NO_ERROR_ECODE, NULL };
 
 /* ------------------------------------------------------------------------ */
 
-static inline kim_error kim_error_allocate (kim_error *out_error)
+static inline kim_error kim_error_allocate (kim_error      *out_error,
+                                            kim_error_code  in_code)
 {
     kim_error err = KIM_NO_ERROR;
     kim_error error = NULL;
     
+    /* short circuit out of memory errors so we don't loop */
+    switch (in_code) {
+        case 0:
+            return KIM_NO_ERROR;
+            
+        case KIM_OUT_OF_MEMORY_ECODE:
+        case ENOMEM:
+        case KRB5_CC_NOMEM:
+        case ccErrNoMem:
+            //        case klMemFullErr:
+            //        case memFullErr:
+            return kim_no_memory_error;
+    }
+    
     if (!err) {
         error = malloc (sizeof (*error));
         if (!error) {
@@ -55,6 +70,8 @@ static inline kim_error kim_error_allocate (kim_error *out_error)
     }
     
     if (!err) {
+        error->code = in_code;
+        
         *out_error = error;
         error = NULL;
     }
@@ -64,16 +81,24 @@ static inline kim_error kim_error_allocate (kim_error *out_error)
     return check_error (err);    
 }
 
+/* ------------------------------------------------------------------------ */
+
+static kim_boolean kim_error_is_builtin (kim_error in_error)
+{
+    return (in_error == KIM_NO_ERROR ||
+            in_error == kim_no_memory_error);
+}
+
 #pragma mark -- Helper Functions --
 
-/* These helper functions exist so we get type checking on the most common errors */
+/* These helper functions exist so we get type checking on common errors */
 
 /* ------------------------------------------------------------------------ */
 
 kim_error _kim_error_create_for_param (kim_string in_function, 
-                                         unsigned int in_argument_position,
-                                         kim_string in_argument_name,
-                                         kim_string in_invalid_value)
+                                       unsigned int in_argument_position,
+                                       kim_string in_argument_name,
+                                       kim_string in_invalid_value)
 {
     return kim_error_create_from_code (KIM_PARAMETER_ECODE, 
                                        in_function, 
@@ -87,7 +112,7 @@ kim_error _kim_error_create_for_param (kim_string in_function,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_error_create_from_code (kim_error_code in_code, 
-                                        ...)
+                                      ...)
 {
     kim_error err = KIM_NO_ERROR;
     va_list args;
@@ -102,54 +127,66 @@ kim_error kim_error_create_from_code (kim_error_code in_code,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_error_create_from_code_va (kim_error_code in_code, 
-                                           va_list          in_args)
+                                         va_list        in_args)
 {
     kim_error err = KIM_NO_ERROR;
     kim_error error = KIM_NO_ERROR;
-    kim_string message = NULL;
     
-    /* short circuit out of memory errors so we don't loop */
-    switch (in_code) {
-        case 0:
-            return KIM_NO_ERROR;
-            
-        case KIM_OUT_OF_MEMORY_ECODE:
-        case ENOMEM:
-        case KRB5_CC_NOMEM:
-        case ccErrNoMem:
-//        case klMemFullErr:
-//        case memFullErr:
-            err = kim_no_memory_error;
-            break;
+    if (!err) {
+        err = kim_error_allocate (&error, in_code);
+    }
+    
+    if (!err && !kim_error_is_builtin (error)) {
+        err = kim_string_create_from_format_va_retcode (&error->message, 
+                                                        error_message (in_code), 
+                                                        in_args);
     }
     
     if (!err) {
-        err = kim_string_create_from_format_va_retcode (&message, error_message (in_code), in_args);
+        err = error;
+        error = NULL;  /* take ownership */
     }
     
+    kim_error_free (&error);
+    
+    return err;
+}
+
+
+/* ------------------------------------------------------------------------ */
+
+kim_error kim_error_create_from_krb5_error (krb5_context    in_context, 
+                                            krb5_error_code in_code)
+{
+    kim_error err = KIM_NO_ERROR;
+    kim_error error = KIM_NO_ERROR;
+    
     if (!err) {
-        err = kim_error_allocate (&error);
+        err = kim_error_allocate (&error, in_code);
+    }
+    
+    if (!err && !kim_error_is_builtin (error)) {
+        const char *message = krb5_get_error_message (in_context, in_code);
+        
+        err = kim_string_copy (&error->message, message);
+        
+        if (message) { krb5_free_error_message (in_context, message); }
     }
     
     if (!err) {
-        error->code = in_code;
-        error->message = message;
-        message = NULL; /* take ownership */
-
         err = error;
         error = NULL;  /* take ownership */
     }
     
     kim_error_free (&error);
-    kim_string_free (&message);
     
     return err;
 }
-
+        
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_error_copy (kim_error *out_error,
-                            kim_error  in_error)
+                          kim_error  in_error)
 {
     kim_error err = KIM_NO_ERROR;
     kim_error error = KIM_NO_ERROR;
@@ -158,18 +195,15 @@ kim_error kim_error_copy (kim_error *out_error,
     if (!err && !in_error ) { err = param_error (2, "in_error", "NULL"); }
     
     if (!err) { 
-        if (in_error == kim_no_memory_error) {
-            error = kim_no_memory_error;
+        if (kim_error_is_builtin (in_error)) {
+            error = in_error;
             
         } else {
-            err = kim_error_allocate (&error);
+            err = kim_error_allocate (&error, in_error->code);
             
-            if (!err) {
-                error->code = in_error->code;
-                if (in_error->message) {
-                    err = kim_string_copy (&error->message, in_error->message);
-                }
-             }
+            if (!err && in_error->message) {
+                err = kim_string_copy (&error->message, in_error->message);
+            }
         }
     }
     
@@ -205,7 +239,7 @@ kim_string kim_error_get_display_string (kim_error in_error)
         return in_error->message;
         
     } else {
-        /* Note that kim_no_memory_error will get here because its string is NULL */
+        /* Note: kim_no_memory_error will get here because its string is NULL */
         return error_message (in_error->code);
     }
 }
@@ -215,9 +249,9 @@ kim_string kim_error_get_display_string (kim_error in_error)
 void kim_error_free (kim_error *io_error)
 {
     if (io_error && *io_error) {
-        if (*io_error != kim_no_memory_error) {
+        if (kim_error_is_builtin (*io_error)) {
             kim_string_free (&(*io_error)->message);
-             free (*io_error);
+            free (*io_error);
             *io_error = KIM_NO_ERROR;
         }
     }
@@ -228,9 +262,9 @@ void kim_error_free (kim_error *io_error)
 /* ------------------------------------------------------------------------ */
 
 kim_error _check_error (kim_error  in_err, 
-                          kim_string in_function, 
-                          kim_string in_file, 
-                          int          in_line)
+                        kim_string in_function, 
+                        kim_string in_file, 
+                        int        in_line)
 {
     if (in_err) {
         kim_error_code code = kim_error_get_code (in_err);
index 0f574759dd6420ecc969712cafc7bd5d7fd5fd3e..536b2d0ded83ae75bddcb1fa74e46556e2fe77f8 100644 (file)
 #include <kim/kim.h>
 
 kim_error _kim_error_create_for_param (kim_string in_function, 
-                                         unsigned int in_argument_position,
-                                         kim_string in_argument_name,
-                                         kim_string in_invalid_value);
-#define param_error(pos, name, value) _kim_error_create_for_param(__FUNCTION__, \
-                                                                  pos, name, value)
+                                       unsigned int in_argument_position,
+                                       kim_string in_argument_name,
+                                       kim_string in_invalid_value);
+#define param_error(pos, name, value) _kim_error_create_for_param(__FUNCTION__,\
+                                                                  pos, name, \
+                                                                  value)
 
 kim_error kim_error_create_from_code (kim_error_code in_code, 
                                         ...);
 kim_error kim_error_create_from_code_va (kim_error_code in_code, 
                                            va_list args);
+kim_error kim_error_create_from_krb5_error (krb5_context    in_context, 
+                                            krb5_error_code in_code);
 
-#define ccapi_error(code) kim_error_create_from_code(code)
-#define krb5_error(code)  kim_error_create_from_code(code)
-#define gss_error(code)   kim_error_create_from_code(code)
-#define os_error(code)    kim_error_create_from_code(code)
+#define krb5_error(context,code) kim_error_create_from_krb5_error(context, code)
+#define ccapi_error(code)        kim_error_create_from_code(code)
+#define os_error(code)           kim_error_create_from_code(code)
 
 kim_error _check_error (kim_error  in_err, 
-                          kim_string in_function, 
-                          kim_string in_file, 
-                          int          in_line);
+                        kim_string in_function, 
+                        kim_string in_file, 
+                        int          in_line);
 #define check_error(err) _check_error(err, __FUNCTION__, __FILE__, __LINE__)
 
 #endif /* KIM_ERROR_PRIVATE_H */
index 2181191e64890f15d44aac71e21a9de8896f7d64..42a839a538301412490958575c3d94ca49e86990 100644 (file)
@@ -65,20 +65,20 @@ static inline kim_error kim_identity_allocate (kim_identity *out_identity)
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_identity_create_from_string (kim_identity *out_identity,
-                                             kim_string    in_string)
+                                           kim_string    in_string)
 {
     kim_error err = KIM_NO_ERROR;
     kim_identity identity = NULL;
     
     if (!err && !out_identity) { err = param_error (1, "out_identity", "NULL"); }
     if (!err && !in_string   ) { err = param_error (2, "in_string", "NULL"); }
-        
+    
     if (!err) {
         err = kim_identity_allocate (&identity);
     }
     
     if (!err) {
-        err = krb5_error (krb5_init_context (&identity->context));
+        err = krb5_error (NULL, krb5_init_context (&identity->context));
     }
     
     if (!err) {
@@ -86,7 +86,7 @@ kim_error kim_identity_create_from_string (kim_identity *out_identity,
         if (code == KRB5_PARSE_MALFORMED) {
             err = kim_error_create_from_code (KIM_BAD_PRINCIPAL_STRING_ECODE, in_string);
         } else if (code) {
-            err = krb5_error (code);
+            err = krb5_error (identity->context, code);
         }
     }
     
@@ -107,9 +107,9 @@ kim_error kim_identity_create_from_string (kim_identity *out_identity,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_identity_create_from_components (kim_identity *out_identity,
-                                                 kim_string    in_realm, 
-                                                 kim_string    in_1st_component,
-                                                 ...)
+                                               kim_string    in_realm, 
+                                               kim_string    in_1st_component,
+                                               ...)
 {
     kim_error err = KIM_NO_ERROR;
     kim_identity identity = NULL;
@@ -124,13 +124,13 @@ kim_error kim_identity_create_from_components (kim_identity *out_identity,
     }
     
     if (!err) {
-        err = krb5_error (krb5_init_context (&identity->context));
+        err = krb5_error (NULL, krb5_init_context (&identity->context));
     }
-        
+    
     if (!err) {
         va_list args;
         kim_count component_count = 1;
-
+        
         va_start (args, in_1st_component);
         while (va_arg (args, kim_string)) { component_count++; }
         va_end (args);
@@ -143,7 +143,7 @@ kim_error kim_identity_create_from_components (kim_identity *out_identity,
     if (!err) {
         va_list args;
         krb5_int32 i;
-            
+        
         krb5_princ_set_realm_length (context, &principal_data, strlen (in_realm));
         krb5_princ_set_realm_data (context, &principal_data, (char *) in_realm);
         
@@ -163,11 +163,14 @@ kim_error kim_identity_create_from_components (kim_identity *out_identity,
         }            
         va_end (args);
     }
-        
+    
     if (!err) {
         /* make a copy that has actually been allocated by the krb5 
          * library so krb5_free_principal can be called on it */
-        err = krb5_error (krb5_copy_principal (identity->context, &principal_data, &identity->principal));
+        err = krb5_error (identity->context,
+                          krb5_copy_principal (identity->context, 
+                                               &principal_data, 
+                                               &identity->principal));
     }    
     
     if (!err) {
@@ -195,9 +198,9 @@ kim_error kim_identity_create_from_components (kim_identity *out_identity,
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_identity_create_from_krb5_principal (kim_identity *out_identity,
-                                                     krb5_context    in_krb5_context,
-                                                     krb5_principal  in_krb5_principal)
+kim_error kim_identity_create_from_krb5_principal (kim_identity  *out_identity,
+                                                   krb5_context   in_krb5_context,
+                                                   krb5_principal in_krb5_principal)
 {
     kim_error err = KIM_NO_ERROR;
     kim_identity identity = NULL;
@@ -211,11 +214,13 @@ kim_error kim_identity_create_from_krb5_principal (kim_identity *out_identity,
     }
     
     if (!err) {
-        err = krb5_error (krb5_init_context (&identity->context));
+        err = krb5_error (NULL, krb5_init_context (&identity->context));
     }
-
+    
     if (!err) {
-        err = krb5_error (krb5_copy_principal (identity->context, in_krb5_principal, 
+        err = krb5_error (identity->context,
+                          krb5_copy_principal (identity->context, 
+                                               in_krb5_principal, 
                                                &identity->principal));
     }
     
@@ -236,31 +241,33 @@ kim_error kim_identity_create_from_krb5_principal (kim_identity *out_identity,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_identity_copy (kim_identity *out_identity,
-                               kim_identity  in_identity)
+                             kim_identity  in_identity)
 {
     kim_error err = KIM_NO_ERROR;
     kim_identity identity = KIM_IDENTITY_ANY;
     
     if (!err && !out_identity) { err = param_error (1, "out_identity", "NULL"); }
-
+    
     if (!err && in_identity != KIM_IDENTITY_ANY) {
         err = kim_identity_allocate (&identity);
         
         if (!err) {
-            err = krb5_error (krb5_init_context (&identity->context));
+            err = krb5_error (NULL, krb5_init_context (&identity->context));
         }
         
         if (!err) {
-            err = krb5_error (krb5_copy_principal (identity->context, in_identity->principal, 
+            err = krb5_error (identity->context,
+                              krb5_copy_principal (identity->context, 
+                                                   in_identity->principal, 
                                                    &identity->principal));
         }
     }
-
+    
     if (!err) {
         *out_identity = identity;
         identity = NULL;
     }
-        
+    
     kim_identity_free (&identity);
     
     return check_error (err);
@@ -269,8 +276,8 @@ kim_error kim_identity_copy (kim_identity *out_identity,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_identity_compare (kim_identity    in_identity,
-                                  kim_identity    in_compare_to_identity,
-                                  kim_comparison *out_comparison)
+                                kim_identity    in_compare_to_identity,
+                                kim_comparison *out_comparison)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -308,7 +315,7 @@ kim_error kim_identity_compare (kim_identity    in_identity,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_identity_get_string (kim_identity   in_identity,
-                                     kim_string    *out_string)
+                                   kim_string    *out_string)
 {
     kim_error err = KIM_NO_ERROR;
     char *unparsed_name = NULL;
@@ -317,7 +324,8 @@ kim_error kim_identity_get_string (kim_identity   in_identity,
     if (!err && !out_string ) { err = param_error (2, "out_string", "NULL"); }
     
     if (!err) {
-        err = krb5_error (krb5_unparse_name (in_identity->context, 
+        err = krb5_error (in_identity->context,
+                          krb5_unparse_name (in_identity->context, 
                                              in_identity->principal, 
                                              &unparsed_name));
     }
@@ -334,7 +342,7 @@ kim_error kim_identity_get_string (kim_identity   in_identity,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_identity_get_display_string (kim_identity   in_identity,
-                                             kim_string    *out_display_string)
+                                           kim_string    *out_display_string)
 {
     kim_error err = KIM_NO_ERROR;
     kim_string string = NULL;
@@ -379,7 +387,7 @@ kim_error kim_identity_get_display_string (kim_identity   in_identity,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_identity_get_realm (kim_identity  in_identity,
-                                    kim_string   *out_realm_string)
+                                  kim_string   *out_realm_string)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -398,7 +406,7 @@ kim_error kim_identity_get_realm (kim_identity  in_identity,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_identity_get_number_of_components (kim_identity  in_identity,
-                                                   kim_count    *out_number_of_components)
+                                                 kim_count    *out_number_of_components)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -415,8 +423,8 @@ kim_error kim_identity_get_number_of_components (kim_identity  in_identity,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_identity_get_component_at_index (kim_identity  in_identity,
-                                                 kim_count     in_index,
-                                                 kim_string   *out_component_string)
+                                               kim_count     in_index,
+                                               kim_string   *out_component_string)
 {
     kim_error err = KIM_NO_ERROR;
     krb5_data *component = NULL;
@@ -439,9 +447,9 @@ kim_error kim_identity_get_component_at_index (kim_identity  in_identity,
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_identity_get_krb5_principal (kim_identity  in_identity,
-                                             krb5_context    in_krb5_context,
-                                             krb5_principal *out_krb5_principal)
+kim_error kim_identity_get_krb5_principal (kim_identity    in_identity,
+                                           krb5_context    in_krb5_context,
+                                           krb5_principal *out_krb5_principal)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -450,7 +458,8 @@ kim_error kim_identity_get_krb5_principal (kim_identity  in_identity,
     if (!err && !out_krb5_principal) { err = param_error (3, "out_krb5_principal", "NULL"); }
     
     if (!err) {
-        err = krb5_error (krb5_copy_principal (in_identity->context, 
+        err = krb5_error (in_identity->context,
+                          krb5_copy_principal (in_identity->context, 
                                                in_identity->principal, 
                                                out_krb5_principal));
     }    
@@ -461,7 +470,7 @@ kim_error kim_identity_get_krb5_principal (kim_identity  in_identity,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_identity_get_gss_name (kim_identity  in_identity,
-                                       gss_name_t     *out_gss_name)
+                                     gss_name_t   *out_gss_name)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -478,7 +487,7 @@ kim_error kim_identity_get_gss_name (kim_identity  in_identity,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_identity_is_tgt_service (kim_identity  in_identity,
-                                         kim_boolean  *out_is_tgt_service)
+                                       kim_boolean  *out_is_tgt_service)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -501,7 +510,7 @@ kim_error kim_identity_is_tgt_service (kim_identity  in_identity,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_identity_change_password (kim_identity in_identity,
-                                          kim_options  in_options)
+                                        kim_options  in_options)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -513,8 +522,8 @@ kim_error kim_identity_change_password (kim_identity in_identity,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_identity_change_password_to_password (kim_identity in_identity,
-                                                      kim_options  in_options,
-                                                      kim_string   in_new_password)
+                                                    kim_options  in_options,
+                                                    kim_string   in_new_password)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -530,7 +539,7 @@ void kim_identity_free (kim_identity *io_identity)
 {
     if (io_identity && *io_identity) { 
         kim_identity identity = *io_identity;
-
+        
         if (identity->context) { 
             if (identity->principal) { 
                 krb5_free_principal (identity->context, identity->principal); 
index 2de9b8d1393169a1bed07def7be0f46714ab4227..7bbbb7ce2bbe154a40f3e660baadde518a87ef5c 100644 (file)
@@ -33,6 +33,6 @@
 kim_error kim_os_identity_create_for_username (kim_identity *out_identity);
 
 kim_error kim_identity_is_tgt_service (kim_identity  in_identity,
-                                         kim_boolean  *out_is_tgt_service);
+                                       kim_boolean  *out_is_tgt_service);
 
 #endif /* KIM_IDENTITY_PRIVATE_H */
index 96e49ca57379f75b28bb389202accfe35a582214..3eb09e44bdfae63e191d3de8c4458d5f8afa3234 100644 (file)
@@ -29,7 +29,7 @@
 /* ------------------------------------------------------------------------ */
 
 struct kim_options_opaque {
-    kim_prompt_callback_t prompt_callback;
+    kim_prompt_callback prompt_callback;
     const void *prompt_callback_data;
 #warning add prompt responses here
     kim_time start_time;
@@ -43,15 +43,15 @@ struct kim_options_opaque {
 };
 
 struct kim_options_opaque kim_options_initializer = { 
-    NULL, NULL, 
-    0, 
-    kim_default_lifetime, 
-    kim_default_renewable, 
-    kim_default_renewal_lifetime,
-    kim_default_forwardable,
-    kim_default_proxiable,
-    kim_default_addressless,
-    NULL };
+NULL, NULL, 
+0, 
+kim_default_lifetime, 
+kim_default_renewable, 
+kim_default_renewal_lifetime,
+kim_default_forwardable,
+kim_default_proxiable,
+kim_default_addressless,
+NULL };
 
 /* ------------------------------------------------------------------------ */
 
@@ -90,7 +90,7 @@ kim_error kim_options_create_from_defaults (kim_options *out_options)
     if (!err) {
         err = kim_options_allocate (&options);
     }
-        
+    
     if (!err) {
         *out_options = options;
         options = NULL;
@@ -126,14 +126,14 @@ kim_error kim_options_create (kim_options *out_options)
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_copy (kim_options *out_options,
-                              kim_options  in_options)
+                            kim_options  in_options)
 {
     kim_error err = KIM_NO_ERROR;
     kim_options options = NULL;
     
     if (!err && !out_options) { err = param_error (1, "out_options", "NULL"); }
     if (!err && !in_options ) { err = param_error (2, "in_options", "NULL"); }
-
+    
     if (!err) {
         err = kim_options_allocate (&options);
     }
@@ -164,14 +164,14 @@ kim_error kim_options_copy (kim_options *out_options,
     }
     
     kim_options_free (&options);
-
+    
     return check_error (err);
 }
 
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_set_prompt_callback (kim_options         io_options,
-                                             kim_prompt_callback_t in_prompt_callback)
+                                           kim_prompt_callback in_prompt_callback)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -187,7 +187,7 @@ kim_error kim_options_set_prompt_callback (kim_options         io_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_get_prompt_callback (kim_options          in_options,
-                                             kim_prompt_callback_t *out_prompt_callback)
+                                           kim_prompt_callback *out_prompt_callback)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -204,7 +204,7 @@ kim_error kim_options_get_prompt_callback (kim_options          in_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_set_data (kim_options  io_options,
-                                  const void    *in_data)
+                                const void  *in_data)
 
 {
     kim_error err = KIM_NO_ERROR;
@@ -221,7 +221,7 @@ kim_error kim_options_set_data (kim_options  io_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_get_data (kim_options   in_options,
-                                  const void    **out_data)
+                                const void  **out_data)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -237,9 +237,9 @@ kim_error kim_options_get_data (kim_options   in_options,
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_options_set_prompt_response (kim_options     io_options,
-                                             kim_prompt_type_t in_prompt_type,
-                                             void             *in_response)
+kim_error kim_options_set_prompt_response (kim_options      io_options,
+                                           kim_prompt_type  in_prompt_type,
+                                           void            *in_response)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -256,8 +256,8 @@ kim_error kim_options_set_prompt_response (kim_options     io_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_get_prompt_response (kim_options       in_options,
-                                             kim_prompt_type_t   in_prompt_type,
-                                             void              **out_response)
+                                           kim_prompt_type   in_prompt_type,
+                                           void            **out_response)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -274,7 +274,7 @@ kim_error kim_options_get_prompt_response (kim_options       in_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_set_start_time (kim_options io_options,
-                                        kim_time    in_start_time)
+                                      kim_time    in_start_time)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -290,7 +290,7 @@ kim_error kim_options_set_start_time (kim_options io_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_get_start_time (kim_options  in_options,
-                                        kim_time    *out_start_time)
+                                      kim_time    *out_start_time)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -307,7 +307,7 @@ kim_error kim_options_get_start_time (kim_options  in_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_set_lifetime (kim_options  io_options,
-                                      kim_lifetime in_lifetime)
+                                    kim_lifetime in_lifetime)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -323,7 +323,7 @@ kim_error kim_options_set_lifetime (kim_options  io_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_get_lifetime (kim_options   in_options,
-                                      kim_lifetime *out_lifetime)
+                                    kim_lifetime *out_lifetime)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -340,7 +340,7 @@ kim_error kim_options_get_lifetime (kim_options   in_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_set_renewable (kim_options io_options,
-                                       kim_boolean in_renewable)
+                                     kim_boolean in_renewable)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -356,7 +356,7 @@ kim_error kim_options_set_renewable (kim_options io_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_get_renewable (kim_options  in_options,
-                                       kim_boolean *out_renewable)
+                                     kim_boolean *out_renewable)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -373,7 +373,7 @@ kim_error kim_options_get_renewable (kim_options  in_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_set_renewal_lifetime (kim_options  io_options,
-                                              kim_lifetime in_renewal_lifetime)
+                                            kim_lifetime in_renewal_lifetime)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -389,7 +389,7 @@ kim_error kim_options_set_renewal_lifetime (kim_options  io_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_get_renewal_lifetime (kim_options   in_options,
-                                              kim_lifetime *out_renewal_lifetime)
+                                            kim_lifetime *out_renewal_lifetime)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -406,7 +406,7 @@ kim_error kim_options_get_renewal_lifetime (kim_options   in_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_set_forwardable (kim_options io_options,
-                                         kim_boolean in_forwardable)
+                                       kim_boolean in_forwardable)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -422,7 +422,7 @@ kim_error kim_options_set_forwardable (kim_options io_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_get_forwardable (kim_options  in_options,
-                                         kim_boolean *out_forwardable)
+                                       kim_boolean *out_forwardable)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -439,7 +439,7 @@ kim_error kim_options_get_forwardable (kim_options  in_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_set_proxiable (kim_options io_options,
-                                       kim_boolean in_proxiable)
+                                     kim_boolean in_proxiable)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -455,7 +455,7 @@ kim_error kim_options_set_proxiable (kim_options io_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_get_proxiable (kim_options  in_options,
-                                       kim_boolean *out_proxiable)
+                                     kim_boolean *out_proxiable)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -472,7 +472,7 @@ kim_error kim_options_get_proxiable (kim_options  in_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_set_addressless (kim_options io_options,
-                                         kim_boolean in_addressless)
+                                       kim_boolean in_addressless)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -488,7 +488,7 @@ kim_error kim_options_set_addressless (kim_options io_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_get_addressless (kim_options  in_options,
-                                         kim_boolean *out_addressless)
+                                       kim_boolean *out_addressless)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -505,7 +505,7 @@ kim_error kim_options_get_addressless (kim_options  in_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_set_service_name (kim_options  io_options,
-                                         kim_string   in_service_name)
+                                        kim_string   in_service_name)
 {
     kim_error err = KIM_NO_ERROR;
     kim_string service_name = NULL;
@@ -528,7 +528,7 @@ kim_error kim_options_set_service_name (kim_options  io_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_options_get_service_name (kim_options  in_options,
-                                         kim_string  *out_service_name)
+                                        kim_string  *out_service_name)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -544,9 +544,9 @@ kim_error kim_options_get_service_name (kim_options  in_options,
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_options_get_init_cred_options (kim_options              in_options, 
-                                               krb5_context               in_context,
-                                              krb5_get_init_creds_opt  **out_init_cred_options)
+kim_error kim_options_get_init_cred_options (kim_options               in_options, 
+                                             krb5_context              in_context,
+                                             krb5_get_init_creds_opt **out_init_cred_options)
 {
     kim_error err = KIM_NO_ERROR;
     krb5_get_init_creds_opt *init_cred_options;
@@ -557,9 +557,10 @@ kim_error kim_options_get_init_cred_options (kim_options              in_options
     if (!err && !out_init_cred_options) { err = param_error (3, "out_init_cred_options", "NULL"); }
     
     if (!err && !in_options->addressless) {
-        err = krb5_error (krb5_os_localaddr (in_context, &addresses));
+        err = krb5_error (in_context, 
+                          krb5_os_localaddr (in_context, &addresses));
     }
-
+    
     if (!err) {
         krb5_get_init_creds_opt_alloc (in_context, &init_cred_options);
         krb5_get_init_creds_opt_set_tkt_life (init_cred_options, in_options->lifetime);
@@ -567,7 +568,7 @@ kim_error kim_options_get_init_cred_options (kim_options              in_options
         krb5_get_init_creds_opt_set_forwardable (init_cred_options, in_options->forwardable);
         krb5_get_init_creds_opt_set_proxiable (init_cred_options, in_options->proxiable);
         krb5_get_init_creds_opt_set_address_list (init_cred_options, addresses);
-
+        
        *out_init_cred_options = init_cred_options;
        init_cred_options = NULL;
        addresses = NULL;
@@ -581,8 +582,8 @@ kim_error kim_options_get_init_cred_options (kim_options              in_options
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_options_free_init_cred_options (krb5_context               in_context,
-                                                krb5_get_init_creds_opt  **io_init_cred_options)
+kim_error kim_options_free_init_cred_options (krb5_context              in_context,
+                                              krb5_get_init_creds_opt **io_init_cred_options)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -615,11 +616,11 @@ void kim_options_free (kim_options *io_options)
 /* ------------------------------------------------------------------------ */
 
 kim_error_code kim_prompt_callback_default (kim_options       *io_options, 
-                                              kim_prompt_type_t    in_type,
-                                              kim_string         in_title,
-                                              kim_string         in_message,
-                                              kim_string         in_description,
-                                              void               **out_reply)
+                                            kim_prompt_type    in_type,
+                                            kim_string         in_title,
+                                            kim_string         in_message,
+                                            kim_string         in_description,
+                                            void               **out_reply)
 {
     kim_error err = KIM_NO_ERROR;
     kim_error_code code = KIM_NO_ERROR_ECODE;
@@ -638,11 +639,11 @@ kim_error_code kim_prompt_callback_default (kim_options       *io_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error_code kim_prompt_callback_gui (kim_options       *io_options, 
-                                          kim_prompt_type_t    in_type,
-                                          kim_string         in_title,
-                                          kim_string         in_message,
-                                          kim_string         in_description,
-                                          void               **out_reply)
+                                        kim_prompt_type    in_type,
+                                        kim_string         in_title,
+                                        kim_string         in_message,
+                                        kim_string         in_description,
+                                        void               **out_reply)
 {
     kim_error err = KIM_NO_ERROR;
     kim_error_code code = KIM_NO_ERROR_ECODE;
@@ -661,11 +662,11 @@ kim_error_code kim_prompt_callback_gui (kim_options       *io_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error_code kim_prompt_callback_cli (kim_options       *io_options, 
-                                          kim_prompt_type_t    in_type,
-                                          kim_string         in_title,
-                                          kim_string         in_message,
-                                          kim_string         in_description,
-                                          void               **out_reply)
+                                        kim_prompt_type    in_type,
+                                        kim_string         in_title,
+                                        kim_string         in_message,
+                                        kim_string         in_description,
+                                        void               **out_reply)
 {
     kim_error err = KIM_NO_ERROR;
     kim_error_code code = KIM_NO_ERROR_ECODE;
@@ -684,11 +685,11 @@ kim_error_code kim_prompt_callback_cli (kim_options       *io_options,
 /* ------------------------------------------------------------------------ */
 
 kim_error_code kim_prompt_callback_none (kim_options       *io_options, 
-                                           kim_prompt_type_t    in_type,
-                                           kim_string         in_title,
-                                           kim_string         in_message,
-                                           kim_string         in_description,
-                                           void               **out_reply)
+                                         kim_prompt_type    in_type,
+                                         kim_string         in_title,
+                                         kim_string         in_message,
+                                         kim_string         in_description,
+                                         void               **out_reply)
 {
     return KIM_USER_CANCELED_ECODE;
 }
index 04d65c724c3c869949e1b2fa3e4d13f8e506fcc6..8dbe0a30e849c3ceb8b51f0c73f99f77c8bc869a 100644 (file)
 
 kim_error kim_options_create_from_defaults (kim_options *out_options);
 
-kim_error kim_options_get_init_cred_options (kim_options              in_options, 
-                                               krb5_context               in_context,
-                                              krb5_get_init_creds_opt  **out_init_cred_options);
+kim_error kim_options_get_init_cred_options (kim_options               in_options, 
+                                             krb5_context              in_context,
+                                             krb5_get_init_creds_opt **out_init_cred_options);
 
-kim_error kim_options_free_init_cred_options (krb5_context               in_context,
-                                                krb5_get_init_creds_opt  **io_init_cred_options);
+kim_error kim_options_free_init_cred_options (krb5_context              in_context,
+                                              krb5_get_init_creds_opt **io_init_cred_options);
 
 #endif /* KIM_OPTIONS_PRIVATE_H */
index af8acb561a3fbe9df20997d2b962ce8002534f81..c017fa866a09e2824b30da89705f6e85302c6b1f 100644 (file)
@@ -27,7 +27,7 @@
 #include "kim_private.h"
 
 #pragma mark -- KIM Favorite Realms --
-    
+
 struct kim_favorite_identities_opaque {
     kim_count count;
     kim_identity *identities;
@@ -66,7 +66,7 @@ static inline kim_error kim_favorite_identities_allocate (kim_favorite_identitie
 /* ------------------------------------------------------------------------ */
 
 static inline kim_error kim_favorite_identities_resize (kim_favorite_identities io_favorite_identities,
-                                                          kim_count               in_new_count)
+                                                        kim_count               in_new_count)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -74,7 +74,7 @@ static inline kim_error kim_favorite_identities_resize (kim_favorite_identities
     
     if (!err && io_favorite_identities->count != in_new_count) {
         kim_identity *identities = NULL;
-
+        
         if (in_new_count == 0) {
             if (io_favorite_identities->identities) {
                 free (io_favorite_identities->identities);
@@ -120,14 +120,14 @@ kim_error kim_favorite_identities_create (kim_favorite_identities *out_favorite_
     }
     
     kim_favorite_identities_free (&favorite_identities);
-
+    
     return check_error (err);
 }
 
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_favorite_identities_copy (kim_favorite_identities *out_favorite_identities,
-                                          kim_favorite_identities  in_favorite_identities)
+                                        kim_favorite_identities  in_favorite_identities)
 {
     kim_error err = KIM_NO_ERROR;
     kim_favorite_identities favorite_identities = NULL;
@@ -165,7 +165,7 @@ kim_error kim_favorite_identities_copy (kim_favorite_identities *out_favorite_id
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_favorite_identities_get_number_of_identities (kim_favorite_identities  in_favorite_identities,
-                                                              kim_count               *out_number_of_identities)
+                                                            kim_count               *out_number_of_identities)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -182,8 +182,8 @@ kim_error kim_favorite_identities_get_number_of_identities (kim_favorite_identit
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_favorite_identities_get_identity_at_index (kim_favorite_identities  in_favorite_identities,
-                                                           kim_count                in_index,
-                                                           kim_identity            *out_identity)
+                                                         kim_count                in_index,
+                                                         kim_identity            *out_identity)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -199,14 +199,14 @@ kim_error kim_favorite_identities_get_identity_at_index (kim_favorite_identities
     if (!err) {
         err = kim_identity_copy (out_identity, in_favorite_identities->identities[in_index]);
     }
-
+    
     return check_error (err);
 }
 
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_favorite_identities_add_identity (kim_favorite_identities io_favorite_identities,
-                                                  kim_identity            in_identity)
+                                                kim_identity            in_identity)
 {
     kim_error err = KIM_NO_ERROR;
     kim_identity identity = NULL;
@@ -272,7 +272,7 @@ kim_error kim_favorite_identities_add_identity (kim_favorite_identities io_favor
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_favorite_identities_remove_identity (kim_favorite_identities io_favorite_identities,
-                                                     kim_identity            in_identity)
+                                                   kim_identity            in_identity)
 {
     kim_error err = KIM_NO_ERROR;
     kim_boolean found = FALSE;
@@ -337,7 +337,7 @@ kim_error kim_favorite_identities_remove_all_identities (kim_favorite_identities
         io_favorite_identities->count = 0;
         io_favorite_identities->identities = NULL;
     }
+    
     return check_error (err);
 }
 
@@ -380,22 +380,22 @@ struct kim_preferences_opaque {
 };
 
 struct kim_preferences_opaque kim_preferences_initializer = { 
-    NULL, 
-    FALSE,
-    kim_default_remember_options, 
-    FALSE,
-    kim_default_client_identity, 
-    FALSE,
-    kim_default_remember_client_identity, 
-    FALSE,
-    kim_default_minimum_lifetime,
-    kim_default_maximum_lifetime,
-    FALSE,
-    kim_default_minimum_renewal_lifetime,
-    kim_default_maximum_renewal_lifetime,
-    FALSE,
-    NULL,
-    FALSE
+NULL, 
+FALSE,
+kim_default_remember_options, 
+FALSE,
+kim_default_client_identity, 
+FALSE,
+kim_default_remember_client_identity, 
+FALSE,
+kim_default_minimum_lifetime,
+kim_default_maximum_lifetime,
+FALSE,
+kim_default_minimum_renewal_lifetime,
+kim_default_maximum_renewal_lifetime,
+FALSE,
+NULL,
+FALSE
 };
 
 /* ------------------------------------------------------------------------ */
@@ -722,7 +722,7 @@ kim_error kim_preferences_create (kim_preferences *out_preferences)
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_copy (kim_preferences *out_preferences,
-                                  kim_preferences  in_preferences)
+                                kim_preferences  in_preferences)
 {
     kim_error err = KIM_NO_ERROR;
     kim_preferences preferences = NULL;
@@ -762,7 +762,7 @@ kim_error kim_preferences_copy (kim_preferences *out_preferences,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_set_options (kim_preferences io_preferences,
-                                         kim_options     in_options)
+                                       kim_options     in_options)
 {
     kim_error err = KIM_NO_ERROR;
     kim_options options = NULL;
@@ -786,7 +786,7 @@ kim_error kim_preferences_set_options (kim_preferences io_preferences,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_get_options (kim_preferences  in_preferences,
-                                         kim_options     *out_options)
+                                       kim_options     *out_options)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -803,7 +803,7 @@ kim_error kim_preferences_get_options (kim_preferences  in_preferences,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_set_remember_options (kim_preferences io_preferences,
-                                                  kim_boolean     in_remember_options)
+                                                kim_boolean     in_remember_options)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -820,7 +820,7 @@ kim_error kim_preferences_set_remember_options (kim_preferences io_preferences,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_get_remember_options (kim_preferences  in_preferences,
-                                                  kim_boolean     *out_remember_options)
+                                                kim_boolean     *out_remember_options)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -837,14 +837,14 @@ kim_error kim_preferences_get_remember_options (kim_preferences  in_preferences,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_set_client_identity (kim_preferences io_preferences,
-                                                 kim_identity    in_client_identity)
+                                               kim_identity    in_client_identity)
 {
     kim_error err = KIM_NO_ERROR;
     kim_identity identity = KIM_IDENTITY_ANY;
     
     if (!err && !io_preferences    ) { err = param_error (1, "io_preferences", "NULL"); }
     /* in_client_identity may be KIM_IDENTITY_ANY */
-     
+    
     if (!err && in_client_identity) {
         err = kim_identity_copy (&identity, in_client_identity);
     }
@@ -861,7 +861,7 @@ kim_error kim_preferences_set_client_identity (kim_preferences io_preferences,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_get_client_identity (kim_preferences  in_preferences,
-                                                 kim_identity    *out_client_identity)
+                                               kim_identity    *out_client_identity)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -878,7 +878,7 @@ kim_error kim_preferences_get_client_identity (kim_preferences  in_preferences,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_set_remember_client_identity (kim_preferences io_preferences,
-                                                          kim_boolean     in_remember_client_identity)
+                                                        kim_boolean     in_remember_client_identity)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -895,7 +895,7 @@ kim_error kim_preferences_set_remember_client_identity (kim_preferences io_prefe
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_get_remember_client_identity (kim_preferences  in_preferences,
-                                                          kim_boolean     *out_remember_client_identity)
+                                                        kim_boolean     *out_remember_client_identity)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -912,7 +912,7 @@ kim_error kim_preferences_get_remember_client_identity (kim_preferences  in_pref
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_set_minimum_lifetime (kim_preferences io_preferences,
-                                                  kim_lifetime    in_minimum_lifetime)
+                                                kim_lifetime    in_minimum_lifetime)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -929,7 +929,7 @@ kim_error kim_preferences_set_minimum_lifetime (kim_preferences io_preferences,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_get_minimum_lifetime (kim_preferences  in_preferences,
-                                                  kim_lifetime    *out_minimum_lifetime)
+                                                kim_lifetime    *out_minimum_lifetime)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -946,7 +946,7 @@ kim_error kim_preferences_get_minimum_lifetime (kim_preferences  in_preferences,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_set_maximum_lifetime (kim_preferences io_preferences,
-                                                  kim_lifetime    in_maximum_lifetime)
+                                                kim_lifetime    in_maximum_lifetime)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -963,7 +963,7 @@ kim_error kim_preferences_set_maximum_lifetime (kim_preferences io_preferences,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_get_maximum_lifetime (kim_preferences  in_preferences,
-                                                  kim_lifetime    *out_maximum_lifetime)
+                                                kim_lifetime    *out_maximum_lifetime)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -980,7 +980,7 @@ kim_error kim_preferences_get_maximum_lifetime (kim_preferences  in_preferences,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_set_minimum_renewal_lifetime (kim_preferences io_preferences,
-                                                          kim_lifetime    in_minimum_renewal_lifetime)
+                                                        kim_lifetime    in_minimum_renewal_lifetime)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -997,7 +997,7 @@ kim_error kim_preferences_set_minimum_renewal_lifetime (kim_preferences io_prefe
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_get_minimum_renewal_lifetime (kim_preferences  in_preferences,
-                                                          kim_lifetime    *out_minimum_renewal_lifetime)
+                                                        kim_lifetime    *out_minimum_renewal_lifetime)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -1014,7 +1014,7 @@ kim_error kim_preferences_get_minimum_renewal_lifetime (kim_preferences  in_pref
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_set_maximum_renewal_lifetime (kim_preferences io_preferences,
-                                                          kim_lifetime    in_maximum_renewal_lifetime)
+                                                        kim_lifetime    in_maximum_renewal_lifetime)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -1031,7 +1031,7 @@ kim_error kim_preferences_set_maximum_renewal_lifetime (kim_preferences io_prefe
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_preferences_get_maximum_renewal_lifetime (kim_preferences  in_preferences,
-                                                          kim_lifetime    *out_maximum_renewal_lifetime)
+                                                        kim_lifetime    *out_maximum_renewal_lifetime)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -1047,8 +1047,8 @@ kim_error kim_preferences_get_maximum_renewal_lifetime (kim_preferences  in_pref
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_preferences_set_favorite_identities (kim_preferences     io_preferences,
-                                                 kim_favorite_identities in_favorite_identities)
+kim_error kim_preferences_set_favorite_identities (kim_preferences         io_preferences,
+                                                   kim_favorite_identities in_favorite_identities)
 {
     kim_error err = KIM_NO_ERROR;
     kim_favorite_identities favorite_identities = NULL;
@@ -1071,8 +1071,8 @@ kim_error kim_preferences_set_favorite_identities (kim_preferences     io_prefer
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_preferences_get_favorite_identities (kim_preferences      in_preferences,
-                                                 kim_favorite_identities *out_favorite_identities)
+kim_error kim_preferences_get_favorite_identities (kim_preferences          in_preferences,
+                                                   kim_favorite_identities *out_favorite_identities)
 {
     kim_error err = KIM_NO_ERROR;
     
index 5e8399f1e644007664b83bf3f4c3a1783d5ece6e..c52ea670bde2a9a327b0553401d3ba471f79d7b9 100644 (file)
@@ -46,7 +46,7 @@ typedef enum kim_preference_key_enum {
     kim_preference_key_maximum_lifetime,
     kim_preference_key_minimum_renewal_lifetime,
     kim_preference_key_maximum_renewal_lifetime
-} kim_preference_key_t;
+} kim_preference_key;
 
 #define kim_default_lifetime                   10*60*60
 #define kim_default_renewable                  TRUE
@@ -64,39 +64,39 @@ typedef enum kim_preference_key_enum {
 #define kim_default_maximum_renewal_lifetime   7*24*60*60
 
 
-kim_error kim_os_preferences_get_identity_for_key (kim_preference_key_t  in_key, 
-                                                     kim_identity        in_hardcoded_default,
-                                                     kim_identity       *out_identity);
+kim_error kim_os_preferences_get_identity_for_key (kim_preference_key  in_key, 
+                                                   kim_identity        in_hardcoded_default,
+                                                   kim_identity       *out_identity);
 
-kim_error kim_os_preferences_set_identity_for_key (kim_preference_key_t in_key, 
-                                                     kim_identity       in_identity);
+kim_error kim_os_preferences_set_identity_for_key (kim_preference_key in_key, 
+                                                   kim_identity       in_identity);
 
-kim_error kim_os_preferences_get_favorite_identities_for_key (kim_preference_key_t       in_key, 
-                                                                kim_favorite_identities  in_hardcoded_default,
-                                                                kim_favorite_identities *out_favorite_identities);
+kim_error kim_os_preferences_get_favorite_identities_for_key (kim_preference_key       in_key, 
+                                                              kim_favorite_identities  in_hardcoded_default,
+                                                              kim_favorite_identities *out_favorite_identities);
 
-kim_error kim_os_preferences_set_favorite_identities_for_key (kim_preference_key_t      in_key, 
-                                                                kim_favorite_identities in_favorite_identities);
+kim_error kim_os_preferences_set_favorite_identities_for_key (kim_preference_key      in_key, 
+                                                              kim_favorite_identities in_favorite_identities);
 
-kim_error kim_os_preferences_get_time_for_key (kim_preference_key_t  in_key, 
-                                                 kim_time            in_hardcoded_default,
-                                                 kim_time           *out_time);
+kim_error kim_os_preferences_get_time_for_key (kim_preference_key  in_key, 
+                                               kim_time            in_hardcoded_default,
+                                               kim_time           *out_time);
 
-kim_error kim_os_preferences_set_time_for_key (kim_preference_key_t in_key, 
-                                                 kim_time           in_time);
+kim_error kim_os_preferences_set_time_for_key (kim_preference_key in_key, 
+                                               kim_time           in_time);
 
-kim_error kim_os_preferences_get_lifetime_for_key (kim_preference_key_t  in_key, 
-                                                     kim_lifetime        in_hardcoded_default,
-                                                     kim_lifetime       *out_lifetime);
+kim_error kim_os_preferences_get_lifetime_for_key (kim_preference_key  in_key, 
+                                                   kim_lifetime        in_hardcoded_default,
+                                                   kim_lifetime       *out_lifetime);
 
-kim_error kim_os_preferences_set_lifetime_for_key (kim_preference_key_t in_key, 
-                                                     kim_lifetime       in_lifetime);
+kim_error kim_os_preferences_set_lifetime_for_key (kim_preference_key in_key, 
+                                                   kim_lifetime       in_lifetime);
 
-kim_error kim_os_preferences_get_boolean_for_key (kim_preference_key_t  in_key, 
-                                                    kim_boolean         in_hardcoded_default,
-                                                    kim_boolean        *out_boolean);
+kim_error kim_os_preferences_get_boolean_for_key (kim_preference_key  in_key, 
+                                                  kim_boolean         in_hardcoded_default,
+                                                  kim_boolean        *out_boolean);
 
-kim_error kim_os_preferences_set_boolean_for_key (kim_preference_key_t in_key, 
-                                                    kim_boolean        in_boolean);
+kim_error kim_os_preferences_set_boolean_for_key (kim_preference_key in_key, 
+                                                  kim_boolean        in_boolean);
 
 #endif /* KIM_PREFERENCES_PRIVATE_H */
index fd056bf76fc26b3414db172aa4f17b2a45599c5e..9a59ba4f152577818ea645ed8dae9d4d48840bb2 100644 (file)
@@ -40,14 +40,14 @@ typedef struct kim_selection_hints_preference_strings {
 } kim_selection_hints_preference_strings;
 
 
-kim_error kim_selection_hints_get_preference_strings (kim_selection_hints                   in_selection_hints,
-                                                        kim_selection_hints_preference_strings *io_preference_strings);
+kim_error kim_selection_hints_get_preference_strings (kim_selection_hints                     in_selection_hints,
+                                                      kim_selection_hints_preference_strings *io_preference_strings);
 
 kim_error kim_os_selection_hints_lookup_identity (kim_selection_hints  in_selection_hints,
-                                                    kim_identity        *out_identity);
+                                                  kim_identity        *out_identity);
 
 kim_error kim_os_selection_hints_remember_identity (kim_selection_hints in_selection_hints,
-                                                      kim_identity        in_identity);
+                                                    kim_identity        in_identity);
 
 kim_error kim_os_selection_hints_forget_identity (kim_selection_hints in_selection_hints);
 
index eb9d9ac016ca009b40e1df79f7c4fa5a5eb5ccc9..76e70000111f62852bf4ad48d9d7faad2acca0fc 100644 (file)
 #include "kim_private.h"
 
 
-/* ------------------------------------------------------------------------ */
-
-static inline kim_error kim_string_allocate (kim_string *out_string,
-                                             kim_count   in_length)
-{
-    kim_error err = KIM_NO_ERROR;
-    kim_string string = NULL;
-    
-    if (!err && !out_string) { err = param_error (1, "out_string", "NULL"); }
-    
-    if (!err) {
-        string = calloc (in_length, sizeof (char *));
-        if (!string) { err = os_error (errno); }
-    }
-    
-    if (!err) {
-        *out_string = string;
-        string = NULL;
-    }
-    
-    kim_string_free (&string);
-    
-    return check_error (err);    
-}
-
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_string_create_from_format (kim_string *out_string, 
@@ -72,7 +47,7 @@ kim_error kim_string_create_from_format (kim_string *out_string,
 
 kim_error kim_string_create_from_format_va_retcode (kim_string *out_string, 
                                                     kim_string  in_format,
-                                                    va_list       in_args)
+                                                    va_list     in_args)
 {
     kim_error err = KIM_NO_ERROR;
     
@@ -86,7 +61,7 @@ kim_error kim_string_create_from_format_va_retcode (kim_string *out_string,
 
 kim_error kim_string_create_from_format_va (kim_string *out_string, 
                                             kim_string  in_format,
-                                            va_list       in_args)
+                                            va_list     in_args)
 {
     kim_error err = KIM_NO_ERROR;
     kim_string string = NULL;
@@ -95,7 +70,9 @@ kim_error kim_string_create_from_format_va (kim_string *out_string,
     if (!err && !in_format ) { err = param_error (2, "in_format", "NULL"); }
     
     if (!err) {
-        err = kim_string_create_from_format_va_retcode (&string, in_format, in_args);
+        err = kim_string_create_from_format_va_retcode (&string, 
+                                                        in_format, 
+                                                        in_args);
     }
     
     if (!err) {
@@ -111,7 +88,7 @@ kim_error kim_string_create_from_format_va (kim_string *out_string,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_string_create_from_buffer (kim_string *out_string, 
-                                         const char   *in_buffer, 
+                                         const char *in_buffer, 
                                          kim_count   in_length)
 {
     kim_error err = KIM_NO_ERROR;
@@ -121,7 +98,8 @@ kim_error kim_string_create_from_buffer (kim_string *out_string,
     if (!err && !in_buffer ) { err = param_error (2, "in_buffer", "NULL"); }
     
     if (!err) {
-        err = kim_string_allocate (&string, in_length + 1);
+        string = calloc (in_length + 1, sizeof (char *));
+        if (!string) { err = os_error (ENOMEM); }
     }
     
     if (!err) {
@@ -147,7 +125,8 @@ kim_error kim_string_copy (kim_string *out_string,
     if (!err && !in_string ) { err = param_error (2, "in_string", "NULL"); }
     
     if (!err) {
-        err = kim_string_allocate (&string, strlen (in_string) + 1);
+        string = calloc (strlen (in_string) + 1, sizeof (char *));
+        if (!string) { err = os_error (ENOMEM); }
     }
     
     if (!err) {
@@ -167,7 +146,9 @@ kim_error kim_string_compare (kim_string      in_string,
                               kim_string      in_compare_to_string,
                               kim_comparison *out_comparison)
 {
-    return kim_os_string_compare (in_string, in_compare_to_string, out_comparison);
+    return kim_os_string_compare (in_string, 
+                                  in_compare_to_string, 
+                                  out_comparison);
 }
 
 /* ------------------------------------------------------------------------ */
index 7f4913bc22ef3b548844502261c221822b19ee12..8998ac7f35d726b2686b56034121810e1d5cd0c9 100644 (file)
 
 
 kim_error kim_string_create_from_format (kim_string *out_string, 
-                                           kim_string  in_format,
-                                           ...);
+                                         kim_string  in_format,
+                                         ...);
 
 kim_error kim_string_create_from_format_va_retcode (kim_string *out_string, 
-                                                      kim_string  in_format,
-                                                      va_list       in_args);
+                                                    kim_string  in_format,
+                                                    va_list     in_args);
 
 kim_error kim_string_create_from_format_va (kim_string *out_string, 
-                                              kim_string  in_format,
-                                              va_list       in_args);
+                                            kim_string  in_format,
+                                            va_list       in_args);
 
 kim_error kim_string_create_from_buffer (kim_string *out_string, 
-                                           const char   *in_buffer, 
-                                           kim_count   in_length);
+                                         const char *in_buffer, 
+                                         kim_count   in_length);
 
 kim_error kim_string_prepend (kim_string *io_string,
-                                kim_string  in_prefix);
+                              kim_string  in_prefix);
 
 kim_error kim_string_append (kim_string *io_string, 
-                               kim_string  in_suffix);
+                             kim_string  in_suffix);
 
 /* OS-specific because it should use UTF8-safe sorting where possible */
 kim_error kim_os_string_compare (kim_string      in_string,
-                                   kim_string      in_compare_to_string,
-                                   kim_comparison *out_comparison);
+                                 kim_string      in_compare_to_string,
+                                 kim_comparison *out_comparison);
 
 #endif /* KIM_STRING_PRIVATE_H */
index 9bc5c8575652137f294095804b0d7ea5f8c261cc..9b3f44d4ac8c1aeed9ddea2f6b04a72ee2a92f21 100644 (file)
 
 /* ------------------------------------------------------------------------ */
 
-static kim_error kim_os_preferences_cfstring_for_key (kim_preference_key_t in_key,
-                                                        CFStringRef          *out_kim_string_key,
-                                                        CFStringRef          *out_kll_string_key)
+static kim_error kim_os_preferences_cfstring_for_key (kim_preference_key in_key,
+                                                      CFStringRef          *out_kim_string_key,
+                                                      CFStringRef          *out_kll_string_key)
 {
     kim_error err = KIM_NO_ERROR;
-
+    
     if (!err && !out_kim_string_key) { err = param_error (2, "out_kim_string_key", "NULL"); }
     if (!err && !out_kll_string_key) { err = param_error (3, "out_kll_string_key", "NULL"); }
-
+    
     if (!err) {
         if (in_key == kim_preference_key_lifetime) {
             *out_kim_string_key = CFSTR ("CredentialLifetime");
@@ -111,9 +111,9 @@ static kim_error kim_os_preferences_cfstring_for_key (kim_preference_key_t in_ke
 
 /* ------------------------------------------------------------------------ */
 
-static kim_error kim_os_preferences_get_value (kim_preference_key_t  in_key, 
-                                                 CFTypeID              in_type, 
-                                                 CFPropertyListRef    *out_value)
+static kim_error kim_os_preferences_get_value (kim_preference_key  in_key, 
+                                               CFTypeID              in_type, 
+                                               CFPropertyListRef    *out_value)
 {
     
     kim_error err = KIM_NO_ERROR;
@@ -132,7 +132,7 @@ static kim_error kim_os_preferences_get_value (kim_preference_key_t  in_key,
     
     if (!err) {
         kim_count u, f, h;
-
+        
         if (!kim_library_allow_home_directory_access()) {
             users[0] = kCFPreferencesAnyUser;
             users[1] = NULL;
@@ -158,19 +158,19 @@ static kim_error kim_os_preferences_get_value (kim_preference_key_t  in_key,
     }
     
     if (value) { CFRelease (value); }
-
+    
     return check_error (err);
 }
 
 /* ------------------------------------------------------------------------ */
 
-static kim_error kim_os_preferences_set_value (kim_preference_key_t in_key, 
-                                                 CFPropertyListRef    in_value)
+static kim_error kim_os_preferences_set_value (kim_preference_key in_key, 
+                                               CFPropertyListRef    in_value)
 {
     kim_error err = KIM_NO_ERROR;
     CFStringRef kim_key = NULL;
     CFStringRef kll_key = NULL;
-   
+    
     if (!err && !in_value) { err = param_error (2, "in_value", "NULL"); }
     
     if (!err) {
@@ -181,13 +181,13 @@ static kim_error kim_os_preferences_set_value (kim_preference_key_t in_key,
         kim_boolean homedir_ok = kim_library_allow_home_directory_access();
         CFStringRef user = homedir_ok ? kCFPreferencesCurrentUser : kCFPreferencesAnyUser;
         CFStringRef host = homedir_ok ? kCFPreferencesAnyHost : kCFPreferencesCurrentHost;
-
+        
         CFPreferencesSetValue (kim_key, in_value, KIM_PREFERENCES_FILE, user, host);
         if (!CFPreferencesSynchronize (KIM_PREFERENCES_FILE, user, host)) {
             err = kim_error_create_from_code (KIM_PREFERENCES_WRITE_ECODE);
         }
     }
-
+    
     return check_error (err);
 }
 
@@ -195,9 +195,9 @@ static kim_error kim_os_preferences_set_value (kim_preference_key_t in_key,
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_os_preferences_get_identity_for_key (kim_preference_key_t  in_key, 
-                                                     kim_identity        in_hardcoded_default,
-                                                     kim_identity       *out_identity)
+kim_error kim_os_preferences_get_identity_for_key (kim_preference_key  in_key, 
+                                                   kim_identity        in_hardcoded_default,
+                                                   kim_identity       *out_identity)
 {
     kim_error err = KIM_NO_ERROR;
     kim_string string = NULL;
@@ -235,8 +235,8 @@ kim_error kim_os_preferences_get_identity_for_key (kim_preference_key_t  in_key,
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_os_preferences_set_identity_for_key (kim_preference_key_t in_key, 
-                                                     kim_identity       in_identity)
+kim_error kim_os_preferences_set_identity_for_key (kim_preference_key in_key, 
+                                                   kim_identity       in_identity)
 {
     kim_error err = KIM_NO_ERROR;
     CFStringRef value = NULL;
@@ -260,7 +260,7 @@ kim_error kim_os_preferences_set_identity_for_key (kim_preference_key_t in_key,
     if (!err) {
         err = kim_os_preferences_set_value (in_key, value);
     }
-
+    
     if (value) { CFRelease (value); }
     kim_string_free (&string);
     
@@ -269,9 +269,9 @@ kim_error kim_os_preferences_set_identity_for_key (kim_preference_key_t in_key,
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_os_preferences_get_favorite_identities_for_key (kim_preference_key_t       in_key, 
-                                                                kim_favorite_identities  in_hardcoded_default,
-                                                                kim_favorite_identities *out_favorite_identities)
+kim_error kim_os_preferences_get_favorite_identities_for_key (kim_preference_key       in_key, 
+                                                              kim_favorite_identities  in_hardcoded_default,
+                                                              kim_favorite_identities *out_favorite_identities)
 {
     kim_error err = KIM_NO_ERROR;
     CFArrayRef value = NULL;
@@ -286,7 +286,7 @@ kim_error kim_os_preferences_get_favorite_identities_for_key (kim_preference_key
     if (!err) {
         if (!value || CFArrayGetCount (value) < 1) {
             err = kim_favorite_identities_copy (out_favorite_identities, in_hardcoded_default);
-        
+            
         } else {
             kim_favorite_identities favorite_identities = NULL;
             CFIndex count = CFArrayGetCount (value);
@@ -336,8 +336,8 @@ kim_error kim_os_preferences_get_favorite_identities_for_key (kim_preference_key
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_os_preferences_set_favorite_identities_for_key (kim_preference_key_t      in_key, 
-                                                                kim_favorite_identities in_favorite_identities)
+kim_error kim_os_preferences_set_favorite_identities_for_key (kim_preference_key      in_key, 
+                                                              kim_favorite_identities in_favorite_identities)
 {
     kim_error err = KIM_NO_ERROR;
     kim_count count = 0;
@@ -348,7 +348,7 @@ kim_error kim_os_preferences_set_favorite_identities_for_key (kim_preference_key
     if (!err) {
         err = kim_favorite_identities_get_number_of_identities (in_favorite_identities, &count);
     }
-
+    
     if (!err) {
         value = CFArrayCreateMutable (kCFAllocatorDefault, count, &kCFTypeArrayCallBacks);
         if (!value) { err = os_error (ENOMEM); }
@@ -367,7 +367,7 @@ kim_error kim_os_preferences_set_favorite_identities_for_key (kim_preference_key
             if (!err) {
                 err = kim_identity_get_string (identity, &string);
             }
-
+            
             if (!err) {
                 err = kim_os_string_get_cfstring (string, &cfstring);
             }
@@ -385,7 +385,7 @@ kim_error kim_os_preferences_set_favorite_identities_for_key (kim_preference_key
     if (!err) {
         err = kim_os_preferences_set_value (in_key, value);
     }
-
+    
     if (value) { CFRelease (value); }
     
     return check_error (err);
@@ -393,9 +393,9 @@ kim_error kim_os_preferences_set_favorite_identities_for_key (kim_preference_key
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_os_preferences_get_time_for_key (kim_preference_key_t  in_key,  
-                                                 kim_time            in_hardcoded_default,
-                                                 kim_time           *out_time)
+kim_error kim_os_preferences_get_time_for_key (kim_preference_key  in_key,  
+                                               kim_time            in_hardcoded_default,
+                                               kim_time           *out_time)
 {
     kim_error err = KIM_NO_ERROR;
     CFNumberRef value = NULL;
@@ -427,8 +427,8 @@ kim_error kim_os_preferences_get_time_for_key (kim_preference_key_t  in_key,
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_os_preferences_set_time_for_key (kim_preference_key_t in_key, 
-                                                 kim_time           in_time)
+kim_error kim_os_preferences_set_time_for_key (kim_preference_key in_key, 
+                                               kim_time           in_time)
 {
     kim_error err = KIM_NO_ERROR;
     CFNumberRef value = NULL;
@@ -450,9 +450,9 @@ kim_error kim_os_preferences_set_time_for_key (kim_preference_key_t in_key,
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_os_preferences_get_lifetime_for_key (kim_preference_key_t  in_key, 
-                                                     kim_lifetime        in_hardcoded_default,
-                                                     kim_lifetime       *out_lifetime)
+kim_error kim_os_preferences_get_lifetime_for_key (kim_preference_key  in_key, 
+                                                   kim_lifetime        in_hardcoded_default,
+                                                   kim_lifetime       *out_lifetime)
 {
     kim_error err = KIM_NO_ERROR;
     CFNumberRef value = NULL;
@@ -484,8 +484,8 @@ kim_error kim_os_preferences_get_lifetime_for_key (kim_preference_key_t  in_key,
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_os_preferences_set_lifetime_for_key (kim_preference_key_t in_key, 
-                                                     kim_lifetime       in_lifetime)
+kim_error kim_os_preferences_set_lifetime_for_key (kim_preference_key in_key, 
+                                                   kim_lifetime       in_lifetime)
 {
     kim_error err = KIM_NO_ERROR;
     CFNumberRef value = NULL;
@@ -501,15 +501,15 @@ kim_error kim_os_preferences_set_lifetime_for_key (kim_preference_key_t in_key,
     }
     
     if (value) { CFRelease (value); }
-
+    
     return check_error (err);
 }
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_os_preferences_get_boolean_for_key (kim_preference_key_t  in_key, 
-                                                    kim_boolean         in_hardcoded_default,
-                                                    kim_boolean        *out_boolean)
+kim_error kim_os_preferences_get_boolean_for_key (kim_preference_key  in_key, 
+                                                  kim_boolean         in_hardcoded_default,
+                                                  kim_boolean        *out_boolean)
 {
     kim_error err = KIM_NO_ERROR;
     CFBooleanRef value = NULL;
@@ -536,8 +536,8 @@ kim_error kim_os_preferences_get_boolean_for_key (kim_preference_key_t  in_key,
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_os_preferences_set_boolean_for_key (kim_preference_key_t in_key, 
-                                                    kim_boolean        in_boolean)
+kim_error kim_os_preferences_set_boolean_for_key (kim_preference_key in_key, 
+                                                  kim_boolean        in_boolean)
 {
     kim_error err = KIM_NO_ERROR;
     CFBooleanRef value = in_boolean ? kCFBooleanTrue : kCFBooleanFalse;
index 07cdf91f01df0f5b5b003fa40291611de21c244a..6fb5b8515f851b65e9e4893f91858bec8784a584 100644 (file)
@@ -39,16 +39,16 @@ CFStringRef kim_os_string_get_cfstring_for_key_and_dictionary (CFStringRef in_ke
 CFStringRef kim_os_string_get_cfstring_for_key (kim_string in_key_string);
 
 kim_error kim_os_string_create_from_cfstring (kim_string *out_string,
-                                                CFStringRef   in_cfstring);
+                                              CFStringRef   in_cfstring);
 
 kim_error kim_os_string_create_for_key (kim_string *out_string,
-                                          kim_string  in_key_string);
+                                        kim_string  in_key_string);
 
 kim_error kim_os_string_get_cfstring (kim_string  in_string,
-                                        CFStringRef  *out_cfstring);
+                                      CFStringRef  *out_cfstring);
 
 kim_error kim_os_string_compare_to_cfstring (kim_string      in_string,
-                                               CFStringRef       in_compare_to_cfstring,
-                                               kim_comparison *out_comparison);
+                                             CFStringRef       in_compare_to_cfstring,
+                                             kim_comparison *out_comparison);
 
 #endif /* KIM_PRIVATE_H */
index 0151324a5a3ee08045a53c30673114adeebefa0a..f10b10e8aa045650a3f0ce653153b78b51fa1480 100644 (file)
@@ -81,7 +81,7 @@ static kim_error kim_os_selection_hints_get_selection_hints_array (CFArrayRef *o
     }
     
     if (value) { CFRelease (value); }
-
+    
     return check_error (err);
 }
 
@@ -113,8 +113,8 @@ static kim_error kim_os_selection_hints_set_selection_hints_array (CFArrayRef in
 /* ------------------------------------------------------------------------ */
 
 static kim_error kim_os_selection_hints_create_dictionary (kim_selection_hints  in_selection_hints,
-                                                             kim_identity         in_identity,
-                                                             CFDictionaryRef       *out_hints_dictionary)
+                                                           kim_identity         in_identity,
+                                                           CFDictionaryRef     *out_hints_dictionary)
 {
     kim_error err = KIM_NO_ERROR;
     kim_selection_hints_preference_strings preference_strings = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
@@ -134,7 +134,7 @@ static kim_error kim_os_selection_hints_create_dictionary (kim_selection_hints
     if (!err) {
         err = kim_identity_get_string (in_identity, &identity_string);
     }
-
+    
     if (!err) {
         keys[i] = KIM_APPLICATION_ID_HINT;
         err = kim_os_string_get_cfstring (preference_strings.application_identifier, &values[i]);
@@ -144,7 +144,7 @@ static kim_error kim_os_selection_hints_create_dictionary (kim_selection_hints
         keys[++i] = KIM_IDENTITY_HINT;
         err = kim_os_string_get_cfstring (identity_string, &values[i]);
     }
-
+    
     if (!err && preference_strings.service_identity) {
         keys[++i] = KIM_SERVICE_IDENTITY_HINT;
         err = kim_os_string_get_cfstring (preference_strings.service_identity, &values[i]);
@@ -192,8 +192,8 @@ static kim_error kim_os_selection_hints_create_dictionary (kim_selection_hints
 
 /* ------------------------------------------------------------------------ */
 
-static kim_boolean kim_os_selection_hints_compare_hint (kim_string in_string,
-                                                          CFStringRef  in_value)
+static kim_boolean kim_os_selection_hints_compare_hint (kim_string  in_string,
+                                                        CFStringRef in_value)
 {
     kim_boolean equal = 0;
     
@@ -205,7 +205,7 @@ static kim_boolean kim_os_selection_hints_compare_hint (kim_string in_string,
             kim_comparison comparison;
             
             kim_error err = kim_os_string_compare_to_cfstring (in_string, in_value, 
-                                                                 &comparison);
+                                                               &comparison);
             
             if (!err && kim_comparison_is_equal_to (comparison)) {
                 equal = 1;
@@ -216,15 +216,15 @@ static kim_boolean kim_os_selection_hints_compare_hint (kim_string in_string,
             kim_debug_printf ("%s: Malformed string in hints dictionary.", __FUNCTION__);
         }
     }
-
+    
     return equal;
 }
 
 /* ------------------------------------------------------------------------ */
 
 static kim_error kim_os_selection_hints_compare_to_dictionary (kim_selection_hints  in_selection_hints,
-                                                                 CFDictionaryRef        in_hints_dictionary,
-                                                                 kim_boolean         *out_hints_equal)
+                                                               CFDictionaryRef      in_hints_dictionary,
+                                                               kim_boolean         *out_hints_equal)
 {
     kim_error err = KIM_NO_ERROR;
     kim_selection_hints_preference_strings preference_strings = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
@@ -290,7 +290,7 @@ static kim_error kim_os_selection_hints_compare_to_dictionary (kim_selection_hin
 /* ------------------------------------------------------------------------ */
 
 static kim_error kim_os_selection_hints_get_dictionary_identity (CFDictionaryRef  in_dictionary,
-                                                                   kim_identity  *out_identity)
+                                                                 kim_identity    *out_identity)
 {
     kim_error err = KIM_NO_ERROR;
     CFStringRef identity_cfstr = NULL;
@@ -320,7 +320,7 @@ static kim_error kim_os_selection_hints_get_dictionary_identity (CFDictionaryRef
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_os_selection_hints_lookup_identity (kim_selection_hints  in_selection_hints,
-                                                    kim_identity        *out_identity)
+                                                  kim_identity        *out_identity)
 {
     kim_error err = KIM_NO_ERROR;
     CFArrayRef hints_array = NULL;
@@ -355,27 +355,27 @@ kim_error kim_os_selection_hints_lookup_identity (kim_selection_hints  in_select
             err = kim_os_selection_hints_compare_to_dictionary (in_selection_hints, 
                                                                 dictionary,
                                                                 &found);
-         }
-
+        }
+        
         if (!err && found) {
             found_dictionary = dictionary;
         }
     }
-        
+    
     if (!err && found) {
         err = kim_os_selection_hints_get_dictionary_identity (found_dictionary,
                                                               out_identity);
     }
     
     if (hints_array) { CFRelease (hints_array); }
-
+    
     return check_error (err);
 }
 
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_os_selection_hints_remember_identity (kim_selection_hints in_selection_hints,
-                                                      kim_identity        in_identity)
+                                                    kim_identity        in_identity)
 {
     kim_error err = KIM_NO_ERROR;
     CFArrayRef old_hints_array = NULL;
@@ -391,7 +391,7 @@ kim_error kim_os_selection_hints_remember_identity (kim_selection_hints in_selec
     if (!err) {
         err = kim_os_selection_hints_get_selection_hints_array (&old_hints_array);
     }
-
+    
     if (!err) {
         if (old_hints_array) {
             new_hints_array = CFArrayCreateMutableCopy (kCFAllocatorDefault, 0, 
@@ -431,7 +431,7 @@ kim_error kim_os_selection_hints_remember_identity (kim_selection_hints in_selec
             
             err = kim_os_selection_hints_get_dictionary_identity (dictionary,
                                                                   &identity);
-
+            
             if (!err) {
                 err = kim_identity_compare (in_identity, identity, &comparison);
             }
@@ -457,12 +457,12 @@ kim_error kim_os_selection_hints_remember_identity (kim_selection_hints in_selec
         err = kim_os_selection_hints_create_dictionary (in_selection_hints, 
                                                         in_identity,
                                                         &new_hint_dictionary);
-
+        
         if (!err) {
             CFArrayInsertValueAtIndex (new_hints_array, 0, new_hint_dictionary);
             hints_array_changed = 1;
         }
-
+        
         if (new_hint_dictionary) { CFRelease (new_hint_dictionary); }
     }
     
@@ -472,7 +472,7 @@ kim_error kim_os_selection_hints_remember_identity (kim_selection_hints in_selec
     
     if (new_hints_array ) { CFRelease (new_hints_array); }
     if (old_hints_array ) { CFRelease (old_hints_array); }
-   
+    
     return check_error (err);
 }
 
@@ -485,7 +485,7 @@ kim_error kim_os_selection_hints_forget_identity (kim_selection_hints in_selecti
     CFMutableArrayRef new_hints_array = NULL;
     CFIndex count = 0;
     CFIndex i = 0;
-   
+    
     if (!err && !in_selection_hints) { err = param_error (1, "in_selection_hints", "NULL"); }
     
     if (!err) {
@@ -497,7 +497,7 @@ kim_error kim_os_selection_hints_forget_identity (kim_selection_hints in_selecti
                                                     old_hints_array);
         if (!new_hints_array) { err = os_error (ENOMEM); }
     }
-
+    
     if (!err) {
         count = CFArrayGetCount (new_hints_array);
     }
@@ -532,7 +532,7 @@ kim_error kim_os_selection_hints_forget_identity (kim_selection_hints in_selecti
     }
     
     if (new_hints_array) { CFRelease (new_hints_array); }
-
+    
     return check_error (err);
 }
 
index 4ccb2a821f72522679f28b35421e8192bc7514f8..4514da36ea47c322f1bd838806778fdf7bdbbb5e 100644 (file)
@@ -90,7 +90,7 @@ CFStringRef kim_os_string_get_cfstring_for_key (kim_string in_key_string)
     
     if (in_key_string) {     
         key = CFStringCreateWithCString (kCFAllocatorDefault, in_key_string, kCFStringEncodingASCII);
-
+        
         if (key) {
             // Try to find the key, first searching in the framework, then in the main bundle
             CFBundleRef frameworkBundle = CFBundleGetBundleWithIdentifier (CFSTR ("edu.mit.Kerberos"));
@@ -100,7 +100,7 @@ CFStringRef kim_os_string_get_cfstring_for_key (kim_string in_key_string)
             
             if (!value) {
                 CFBundleRef mainBundle = CFBundleGetMainBundle ();
-
+                
                 if (mainBundle) {
                     value = kim_os_string_get_cfstring_for_key_and_dictionary (key, mainBundle);
                 }
@@ -121,8 +121,8 @@ CFStringRef kim_os_string_get_cfstring_for_key (kim_string in_key_string)
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_os_string_create_from_cfstring (kim_string *out_string,
-                                                CFStringRef in_cfstring)
+kim_error kim_os_string_create_from_cfstring (kim_string  *out_string,
+                                              CFStringRef  in_cfstring)
 {
     kim_error err = KIM_NO_ERROR;
     kim_string string = NULL;
@@ -158,7 +158,7 @@ kim_error kim_os_string_create_from_cfstring (kim_string *out_string,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_os_string_create_for_key (kim_string *out_string,
-                                          kim_string in_key_string)
+                                        kim_string in_key_string)
 {
     kim_error err = KIM_NO_ERROR;
     CFStringRef value = NULL;
@@ -181,8 +181,8 @@ kim_error kim_os_string_create_for_key (kim_string *out_string,
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_os_string_get_cfstring (kim_string  in_string,
-                                        CFStringRef  *out_cfstring)
+kim_error kim_os_string_get_cfstring (kim_string   in_string,
+                                      CFStringRef *out_cfstring)
 {
     kim_error err = KIM_NO_ERROR;
     CFStringRef cfstring = NULL;
@@ -208,8 +208,8 @@ kim_error kim_os_string_get_cfstring (kim_string  in_string,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_os_string_compare (kim_string      in_string,
-                                   kim_string      in_compare_to_string,
-                                   kim_comparison *out_comparison)
+                                 kim_string      in_compare_to_string,
+                                 kim_comparison *out_comparison)
 {
     kim_error err = KIM_NO_ERROR;
     CFStringRef cfstring = NULL;
@@ -222,7 +222,7 @@ kim_error kim_os_string_compare (kim_string      in_string,
     if (!err) {
         err = kim_os_string_get_cfstring (in_string, &cfstring);
     }
-
+    
     if (!err) {
         err = kim_os_string_get_cfstring (in_compare_to_string, &compare_to_cfstring);
     }
@@ -234,15 +234,15 @@ kim_error kim_os_string_compare (kim_string      in_string,
     
     if (cfstring           ) { CFRelease (cfstring); }
     if (compare_to_cfstring) { CFRelease (compare_to_cfstring); }
-
+    
     return check_error (err);    
 }
 
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_os_string_compare_to_cfstring (kim_string      in_string,
-                                               CFStringRef       in_compare_to_cfstring,
-                                               kim_comparison *out_comparison)
+                                             CFStringRef     in_compare_to_cfstring,
+                                             kim_comparison *out_comparison)
 {
     kim_error err = KIM_NO_ERROR;
     CFStringRef cfstring = NULL;