Initial checkin of Mac OS X ipc support.
authorAlexandra Ellwood <lxs@mit.edu>
Fri, 26 Sep 2008 14:05:55 +0000 (14:05 +0000)
committerAlexandra Ellwood <lxs@mit.edu>
Fri, 26 Sep 2008 14:05:55 +0000 (14:05 +0000)
Also moved "set application name" functionality to kim_library_
because most applications do not need to call it and their name
doesn't usually change over time or per thread By putting it
in a global setting apps that do need to call it only have to
call it once instead of every time they want to authenticate.

ticket: 6055

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

14 files changed:
src/include/kim/kim_library.h
src/kim/lib/kim-lite.exports
src/kim/lib/kim.exports
src/kim/lib/kim_library.c
src/kim/lib/kim_library_private.h
src/kim/lib/kim_selection_hints.c
src/kim/lib/kim_ui_cli.c
src/kim/lib/mac/kim_os_library.c
src/kim/lib/mac/kim_os_private.h
src/kim/lib/mac/kim_os_string.c
src/kim/lib/mac/kim_os_ui_gui.c
src/kim/mac/kim_mig.defs [new file with mode: 0644]
src/kim/mac/kim_mig_types.h [new file with mode: 0644]
src/kim/test/test_kim_preferences.c

index 7888961846889a517296cea75b0b9fcc16f3a324..bd0e73bb5e011bb88948a72acbc4e2783a31de74 100644 (file)
@@ -38,16 +38,11 @@ typedef int kim_ui_environment;
 
 kim_error kim_library_set_ui_environment (kim_ui_environment in_ui_environment);
 
-kim_ui_environment kim_library_ui_environment (void);
-
-
 kim_error kim_library_set_allow_home_directory_access (kim_boolean in_allow_access);
 
-kim_boolean kim_library_allow_home_directory_access (void);
-
-
 kim_error kim_library_set_allow_automatic_prompting (kim_boolean in_allow_automatic_prompting);
 
-kim_boolean kim_library_allow_automatic_prompting (void);
+kim_error kim_library_set_application_name (kim_string in_application_name);
+
 
 #endif /* KIM_LIBRARY_H */
index 96699c8086cf4e552fe1a9a344874e98d6819825..969ad83835411fa75a3cf06064e4173f4f4db803 100644 (file)
@@ -41,8 +41,6 @@ kim_selection_hints_create
 kim_selection_hints_copy
 kim_selection_hints_set_hint
 kim_selection_hints_get_hint
-kim_selection_hints_set_application_name
-kim_selection_hints_get_application_name
 kim_selection_hints_set_explanation
 kim_selection_hints_get_explanation
 kim_selection_hints_set_options
index 96359632e96fa805d57279209598d55ba37208ac..6381cbd815911effc8a63b2b13c76fcdf4d03fed 100644 (file)
@@ -41,8 +41,6 @@ kim_selection_hints_create
 kim_selection_hints_copy
 kim_selection_hints_set_hint
 kim_selection_hints_get_hint
-kim_selection_hints_set_application_name
-kim_selection_hints_get_application_name
 kim_selection_hints_set_explanation
 kim_selection_hints_get_explanation
 kim_selection_hints_set_options
@@ -126,3 +124,8 @@ kim_ccache_renew
 kim_ccache_validate
 kim_ccache_destroy
 kim_ccache_free
+
+kim_library_set_ui_environment
+kim_library_set_allow_home_directory_access
+kim_library_set_allow_automatic_prompting
+kim_library_set_application_name
index 287ff3c63fadb288abf85d5b1314344088a5c030..c235fbda7eebcc39c3b6beac0d11758d5b8ba8d5 100644 (file)
 static k5_mutex_t g_allow_home_directory_access_mutex = K5_MUTEX_PARTIAL_INITIALIZER;
 static k5_mutex_t g_allow_automatic_prompting_mutex = K5_MUTEX_PARTIAL_INITIALIZER;
 static k5_mutex_t g_ui_environment_mutex = K5_MUTEX_PARTIAL_INITIALIZER;
+static k5_mutex_t g_application_name_mutex = K5_MUTEX_PARTIAL_INITIALIZER;
 
 kim_boolean g_allow_home_directory_access = TRUE;
 kim_boolean g_allow_automatic_prompting = TRUE;
 kim_ui_environment g_ui_environment = KIM_UI_ENVIRONMENT_AUTO;
+kim_string g_application_name = NULL;
 
 MAKE_INIT_FUNCTION(kim_thread_init);
 MAKE_FINI_FUNCTION(kim_thread_fini);
@@ -63,6 +65,10 @@ static int kim_thread_init (void)
         err = k5_mutex_finish_init (&g_ui_environment_mutex);
     }
     
+    if (!err) {
+        err = k5_mutex_finish_init (&g_application_name_mutex);
+    }
+    
     return err;
 }
 
@@ -77,6 +83,7 @@ static void kim_thread_fini (void)
     k5_mutex_destroy (&g_allow_home_directory_access_mutex);
     k5_mutex_destroy (&g_allow_automatic_prompting_mutex);
     k5_mutex_destroy (&g_ui_environment_mutex);
+    k5_mutex_destroy (&g_application_name_mutex);
 }
 
 #pragma mark -- Allow Home Directory Access --
@@ -282,3 +289,69 @@ kim_ui_environment kim_library_ui_environment (void)
     
     return !err ? ui_environment : KIM_UI_ENVIRONMENT_NONE;
 }
+
+#pragma mark -- Application Name --
+
+/* ------------------------------------------------------------------------ */
+
+kim_error kim_library_set_application_name (kim_string in_application_name)
+{
+    kim_error err = CALL_INIT_FUNCTION (kim_thread_init);
+    kim_error mutex_err = KIM_NO_ERROR;
+    
+    if (!err) {
+        mutex_err = k5_mutex_lock (&g_application_name_mutex);
+        if (mutex_err) { err = mutex_err; }
+    }
+    
+    if (!err) {
+        kim_string old_application_name = g_application_name;
+        
+        if (in_application_name) {
+            err = kim_string_copy (&g_application_name, in_application_name);
+        } else {
+            g_application_name = NULL;
+        }
+
+        if (!err) { kim_string_free (&old_application_name); }
+    }
+    
+    if (!mutex_err) { k5_mutex_unlock (&g_application_name_mutex); }
+    return check_error (err);
+}
+
+/* ------------------------------------------------------------------------ */
+
+kim_error kim_library_get_application_name (kim_string *out_application_name)
+{
+    kim_error err = CALL_INIT_FUNCTION (kim_thread_init);
+    kim_error mutex_err = KIM_NO_ERROR;
+    kim_string application_name = NULL;
+    
+    if (!err && !out_application_name) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+    
+    if (!err) {
+        mutex_err = k5_mutex_lock (&g_application_name_mutex);
+        if (mutex_err) { err = mutex_err; }
+    }
+    
+    if (!err && g_application_name) {
+        err = kim_string_copy (&application_name, g_application_name);
+    }
+    
+    if (!mutex_err) { k5_mutex_unlock (&g_application_name_mutex); }
+    
+    if (!err && !application_name) {
+        err = kim_os_library_get_caller_name (&application_name);
+    }
+    
+    if (!err) {
+        *out_application_name = application_name;
+        application_name = NULL;
+        
+    }
+    
+    kim_string_free (&application_name);
+    
+    return check_error (err);
+}
index 435bb51d4ac9dd85916970d1fe25629e1de9025f..b44cb6513b22072ab50bce38fc6790e795a3dae9 100644 (file)
 
 kim_ui_environment kim_os_library_get_ui_environment (void);
 
+kim_ui_environment kim_library_ui_environment (void);
+
+kim_boolean kim_library_allow_home_directory_access (void);
+
+kim_boolean kim_library_allow_automatic_prompting (void);
+
+kim_error kim_library_get_application_name (kim_string *out_application_name);
+
+/* OS-specific.  Call kim_library_get_application_name */
+kim_error kim_os_library_get_caller_name (kim_string *out_application_name);
+
 kim_boolean kim_os_library_caller_is_server (void);
 
 #endif /* KIM_LIBRARY_PRIVATE_H */
index 1aa8555d8c428140406b4d5804a5596ff7b8eaae..a4d7d666aca73d9ef8ea62ed7d73e72a244b077c 100644 (file)
@@ -28,7 +28,6 @@
 
 struct kim_selection_hints_opaque {
     kim_string application_identifier;
-    kim_string application_name;
     kim_string explanation;
     kim_options options;
     kim_boolean allow_user_interaction;
@@ -42,7 +41,6 @@ struct kim_selection_hints_opaque {
 };
 
 struct kim_selection_hints_opaque kim_selection_hints_initializer = { 
-    NULL,
     NULL,
     NULL,
     KIM_OPTIONS_DEFAULT,
@@ -131,11 +129,6 @@ kim_error kim_selection_hints_copy (kim_selection_hints *out_selection_hints,
                                in_selection_hints->application_identifier);
     }
     
-    if (!err && in_selection_hints->application_name) {
-        err = kim_string_copy (&selection_hints->application_name, 
-                               in_selection_hints->application_name);
-    }
-    
     if (!err && in_selection_hints->explanation) {
         err = kim_string_copy (&selection_hints->explanation, 
                                in_selection_hints->explanation);
@@ -283,44 +276,6 @@ kim_error kim_selection_hints_get_hint (kim_selection_hints  in_selection_hints,
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_selection_hints_set_application_name (kim_selection_hints io_selection_hints,
-                                                    kim_string          in_application_name)
-{
-    kim_error err = KIM_NO_ERROR;
-    
-    if (!err && !io_selection_hints ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
-    if (!err && !in_application_name) { err = check_error (KIM_NULL_PARAMETER_ERR); }
-    
-    if (!err) {
-        err = kim_string_copy (&io_selection_hints->application_name, in_application_name);
-    }
-    
-    return check_error (err);
-}
-
-/* ------------------------------------------------------------------------ */
-
-kim_error kim_selection_hints_get_application_name (kim_selection_hints  in_selection_hints,
-                                                    kim_string          *out_application_name)
-{
-    kim_error err = KIM_NO_ERROR;
-    
-    if (!err && !in_selection_hints  ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
-    if (!err && !out_application_name) { err = check_error (KIM_NULL_PARAMETER_ERR); }
-    
-    if (!err) {
-        if (in_selection_hints->application_name) {
-            err = kim_string_copy (out_application_name, in_selection_hints->application_name);
-        } else {
-            *out_application_name = NULL;
-        }
-    }
-    
-    return check_error (err);
-}
-
-/* ------------------------------------------------------------------------ */
-
 kim_error kim_selection_hints_set_explanation (kim_selection_hints io_selection_hints,
                                                kim_string          in_explanation)
 {
@@ -566,7 +521,6 @@ void kim_selection_hints_free (kim_selection_hints *io_selection_hints)
 {
     if (io_selection_hints && *io_selection_hints) {
         kim_string_free  (&(*io_selection_hints)->application_identifier);
-        kim_string_free  (&(*io_selection_hints)->application_name);
         kim_string_free  (&(*io_selection_hints)->explanation);
         kim_options_free (&(*io_selection_hints)->options);
         kim_string_free  (&(*io_selection_hints)->service_identity);
index 0e5fc9ec4f01757f85aa4a84273d21a85ea69aa7..0b0188854329d1334d001e0e15bb319b0ced085d 100644 (file)
@@ -231,7 +231,7 @@ static kim_error kim_ui_cli_ask_change_password (kim_string in_identity_string)
     kim_string unknown_response = NULL;
     kim_boolean done = 0;
     kim_comparison no_comparison, yes_comparison;
-
+    
     if (!err) {
         err = kim_os_string_create_localized (&ask_change_password, 
                                               "KLStringPasswordExpired");        
@@ -324,7 +324,7 @@ kim_error kim_ui_cli_change_password (kim_ui_context  *in_context,
     if (!err && !out_old_password   ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     if (!err && !out_new_password   ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     if (!err && !out_verify_password) { err = check_error (KIM_NULL_PARAMETER_ERR); }
-    
+
     if (!err) {
         err = kim_identity_get_display_string (in_identity, &identity_string);
     }
index 4abe13e206039f067ff3bafdd80bcc1ea7d65980..ecac38ca30798c81a018fe29b303a26d712cf1d2 100644 (file)
@@ -25,6 +25,8 @@
  */
 
 #include <CoreFoundation/CoreFoundation.h>
+#include <ApplicationServices/ApplicationServices.h>
+#include <mach-o/dyld.h>
 #include <Kerberos/kipc_session.h>
 #include "k5-int.h"
 #include "k5-thread.h"
@@ -120,7 +122,7 @@ kim_boolean kim_os_library_caller_is_server (void)
         CFStringRef mainBundleID = CFBundleGetIdentifier (mainBundle);
         if (mainBundleID) {
             CFComparisonResult result;
-            result = CFStringCompare (mainBundleID, CFSTR("edu.mit.Kerberos.KerberosAgent"), 0);
+            result = CFStringCompare (mainBundleID, CFSTR(kim_os_agent_bundle_id), 0);
             if (result == kCFCompareEqualTo) {
                 return TRUE;
             }
@@ -129,3 +131,148 @@ kim_boolean kim_os_library_caller_is_server (void)
     
     return FALSE;
 }
+
+#pragma mark -
+
+/* ------------------------------------------------------------------------ */
+
+kim_error kim_os_library_get_application_path (kim_string *out_path)
+{
+    kim_error err = KIM_NO_ERROR;
+    kim_string path = NULL;
+    CFBundleRef bundle = CFBundleGetMainBundle ();
+    
+    if (!err && !out_path) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+
+    /* Check if the caller is a bundle */
+    if (!err && bundle) {
+        CFURLRef bundle_url = CFBundleCopyBundleURL (bundle);
+        CFURLRef resources_url = CFBundleCopyResourcesDirectoryURL (bundle);
+        CFURLRef executable_url = CFBundleCopyExecutableURL (bundle);
+        CFURLRef absolute_url = NULL;
+        CFStringRef cfpath = NULL;
+        
+        if (bundle_url && resources_url && !CFEqual (bundle_url, resources_url)) {
+            absolute_url = CFURLCopyAbsoluteURL (bundle_url);
+        } else if (executable_url) {
+            absolute_url = CFURLCopyAbsoluteURL (executable_url);
+        }
+        
+        if (absolute_url) {
+            cfpath = CFURLCopyFileSystemPath (absolute_url, 
+                                              kCFURLPOSIXPathStyle);
+            if (!cfpath) { err = check_error (KIM_OUT_OF_MEMORY_ERR); }
+        }
+        
+        if (!err && cfpath) {
+            err = kim_os_string_create_from_cfstring (&path, cfpath);
+        }
+        
+        if (cfpath        ) { CFRelease (cfpath); }        
+        if (absolute_url  ) { CFRelease (bundle_url); }
+        if (bundle_url    ) { CFRelease (bundle_url); }
+        if (resources_url ) { CFRelease (resources_url); }
+        if (executable_url) { CFRelease (executable_url); }
+    }
+    
+    /* Caller is not a bundle, try _NSGetExecutablePath */
+    /* Note: this does not work on CFM applications */
+    if (!err && !path) {
+        char *buffer = NULL;
+        uint32_t len = 0;
+        
+        /* Tiny stupid buffer to get the length of the path */
+        if (!err) {
+            buffer = malloc (1);
+            if (!buffer) { err = check_error (KIM_OUT_OF_MEMORY_ERR); }
+        }
+        
+        /* Get the length of the path */
+        if (!err) {
+            if (_NSGetExecutablePath (buffer, &len) != 0) {
+                char *temp = realloc (buffer, len + 1);
+                if (!temp) {
+                    err = check_error (KIM_OUT_OF_MEMORY_ERR);
+                } else {
+                    buffer = temp;
+                }
+            }
+        }
+        
+        /* Get the path */
+        if (!err) {
+            if (_NSGetExecutablePath (buffer, &len) != 0) {
+                err = check_error (KIM_OUT_OF_MEMORY_ERR);
+            } else {
+                err = kim_string_copy (&path, buffer);
+            }
+        }
+        
+        if (buffer) { free (buffer); }
+    }
+    
+    if (!err) {
+        *out_path = path;
+        path = NULL;
+    }
+    
+    kim_string_free (&path);
+    
+    return check_error (err);    
+}
+
+/* ------------------------------------------------------------------------ */
+
+kim_error kim_os_library_get_caller_name (kim_string *out_application_name)
+{
+    kim_error err = KIM_NO_ERROR;
+    kim_string name = NULL;
+    CFBundleRef bundle = CFBundleGetMainBundle ();
+    CFStringRef cfname = NULL;
+    
+    if (!err && !out_application_name) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+    
+    if (!err && bundle) {
+        CFURLRef bundle_url = CFBundleCopyBundleURL (bundle);
+        
+        if (bundle_url) {
+            err = LSCopyDisplayNameForURL (bundle_url, &cfname);
+        }
+        
+        if (bundle_url) { CFRelease (bundle_url); }
+    }
+    
+    if (!err && !name) {
+        kim_string path = NULL;
+        CFURLRef cfpath = NULL;
+        
+        err = kim_os_library_get_application_path (&path);
+        
+        if (!err) {
+            cfpath = CFURLCreateFromFileSystemRepresentation (kCFAllocatorDefault,
+                                                              (const UInt8 *) path,
+                                                              strlen (path),
+                                                              0);
+            if (cfpath) {
+                cfname = CFURLCopyLastPathComponent (cfpath);
+            }
+        }
+        
+        if (cfpath) { CFRelease (cfpath); }
+    }
+    
+    if (!err && cfname) {
+        err = kim_os_string_create_from_cfstring (&name, cfname);
+    }
+    
+    if (!err) {
+        *out_application_name = name;
+        name = NULL;
+        
+    }
+
+    if (cfname) { CFRelease (cfname); }
+    kim_string_free (&name);
+    
+    return check_error (err);
+}
index 57176fe5e4fb2a6ef0582e26fa006aa79342ed7d..f4a6710da4ebc5033ca00220a2ac56bf3771535d 100644 (file)
 #include <CoreFoundation/CoreFoundation.h>
 #include "kim_private.h"
 
+#define kim_os_agent_bundle_id "edu.mit.Kerberos.KerberosAgent"
+
 kim_error kim_os_library_lock_for_bundle_lookup (void);
 kim_error kim_os_library_unlock_for_bundle_lookup (void);
 
+kim_error kim_os_library_get_application_path (kim_string *out_path);
+
 
 kim_error kim_os_string_create_for_key (kim_string *out_string,
                                         kim_string  in_key_string);
@@ -47,4 +51,6 @@ kim_error kim_os_string_compare_to_cfstring (kim_string      in_string,
                                              CFStringRef       in_compare_to_cfstring,
                                              kim_comparison *out_comparison);
 
+kim_error kim_os_library_get_application_path (kim_string *out_path);
+
 #endif /* KIM_PRIVATE_H */
index fab5ed8fe24aeaf731e5dcd81aa8ccc92264ee73..d51bc48b2a4716d465813f172208adb647b5ff13 100644 (file)
@@ -197,7 +197,7 @@ kim_error kim_os_string_create_from_cfstring (kim_string  *out_string,
                                                     kCFStringEncodingUTF8) + 1;
         
         string = (char *) calloc (length, sizeof (char));
-        if (!string) { err = KIM_OUT_OF_MEMORY_ERR; }
+        if (!string) { err = check_error (KIM_OUT_OF_MEMORY_ERR); }
     }
     
     if (!err) {
index afebb05046eba987657467767fc77abb88cdd1a7..1845584395877814f0900d907c16887025a4576e 100644 (file)
 
 #ifndef LEAN_CLIENT
 
-#include "kim_private.h"
+#include "kim_os_private.h"
+#include "kim_mig_types.h"
+#include "kim_mig.h"
 
+#define kKerberosAgentBundleID "edu.mit.Kerberos.KerberosAgent"
+#define kKerberosAgentPath "/System/Library/CoreServices/KerberosAgent.app/Contents/MacOS/KerberosAgent"
+
+#include <Kerberos/kipc_client.h>
+#include <mach/mach.h>
+#include <mach/mach_error.h>
 
 struct kim_ui_gui_context {
+    mach_port_t port;
 };
 
 
@@ -58,6 +67,8 @@ static kim_error kim_os_ui_gui_context_allocate (kim_ui_gui_context *out_context
     }
     
     if (!err) {
+        context->port = MACH_PORT_NULL;
+        
         *out_context = context;
         context = NULL;
     }
@@ -75,6 +86,7 @@ kim_error kim_os_ui_gui_init (kim_ui_context *io_context)
 {
     kim_error err = KIM_NO_ERROR;
     kim_ui_gui_context context = NULL;
+    kim_string path = NULL;
     
     if (!err && !io_context) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     
@@ -83,6 +95,31 @@ kim_error kim_os_ui_gui_init (kim_ui_context *io_context)
     }
     
     if (!err) {
+        err = kipc_client_lookup_server (kim_os_agent_bundle_id, 
+                                         1 /* launch */, 
+                                         0 /* don't use cached port */, 
+                                         &context->port);
+    }
+    
+    if (!err) {
+        err = kim_os_library_get_application_path (&path);
+    }
+    
+    if (!err) {
+        kim_mipc_in_string application_name = NULL;
+        mach_msg_type_number_t application_name_len = 0;
+        kim_mipc_in_string application_path = path;
+        mach_msg_type_number_t application_path_len = strlen (path) + 1;
+        kim_mipc_error result = 0;
+        
+        err = kim_mipc_cli_init (context->port,
+                                 mach_task_self (),
+                                 application_name,
+                                 application_name_len,
+                                 application_path,
+                                 application_path_len,
+                                 &result);
+        if (!err) { err = check_error (result); }
     }
     
     if (!err) {
@@ -90,6 +127,7 @@ kim_error kim_os_ui_gui_init (kim_ui_context *io_context)
         context = NULL;
     }
     
+    kim_string_free (&path);
     kim_os_ui_gui_context_free (&context);
     
     return check_error (err);
@@ -108,6 +146,7 @@ kim_error kim_os_ui_gui_enter_identity (kim_ui_context *in_context,
     if (!err) {
         kim_ui_gui_context context = (kim_ui_gui_context) in_context->tcontext;
         
+        
     }
     
     return check_error (err);
@@ -136,7 +175,7 @@ kim_error kim_os_ui_gui_select_identity (kim_ui_context      *in_context,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_os_ui_gui_auth_prompt (kim_ui_context     *in_context,
-                                    kim_identity         in_identity,
+                                     kim_identity        in_identity,
                                      kim_prompt_type     in_type,
                                      kim_boolean         in_hide_reply, 
                                      kim_string          in_title,
diff --git a/src/kim/mac/kim_mig.defs b/src/kim/mac/kim_mig.defs
new file mode 100644 (file)
index 0000000..ad10c74
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * $Header$
+ *
+ * Copyright 2006-2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ * 
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission.  Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without express
+ * or implied warranty.
+ */
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+import "kim_mig_types.h";
+
+subsystem kim 100;
+
+serverprefix kim_mipc_srv_;
+userprefix kim_mipc_cli_;
+
+type kim_mipc_in_string   = array [] of char;
+type kim_mipc_out_string  = array [] of char;
+type kim_mipc_error       = int32_t;
+type kim_mipc_boolean     = boolean_t;
+type kim_mipc_time        = uint32_t;
+type kim_mipc_lifetime    = uint32_t;
+type kim_mipc_prompt_type = uint32_t;
+
+routine init (in_server_port : mach_port_t;
+         in_application_task : task_t;
+         in_application_name : kim_mipc_in_string;
+         in_application_path : kim_mipc_in_string;
+               out out_error : kim_mipc_error);
+
+routine fini (in_server_port : mach_port_t;
+               out out_error : kim_mipc_error);
+
+
+routine enter_identity (in_server_port : mach_port_t;
+                      out out_identity : kim_mipc_out_string;
+                         out out_error : kim_mipc_error);
+
+routine select_identity (in_server_port : mach_port_t;
+                         in_explanation : kim_mipc_in_string;
+                         
+                          in_start_time : kim_mipc_time;
+                            in_lifetime : kim_mipc_lifetime;
+                           in_renewable : kim_mipc_boolean;
+                    in_renewal_lifetime : kim_mipc_lifetime;
+                         in_forwardable : kim_mipc_boolean;
+                           in_proxiable : kim_mipc_boolean;
+                         in_addressless : kim_mipc_boolean;
+                        in_service_name : kim_mipc_in_string;
+
+               in_service_identity_hint : kim_mipc_in_string;
+                   in_client_realm_hint : kim_mipc_in_string;
+                           in_user_hint : kim_mipc_in_string;
+                  in_service_realm_hint : kim_mipc_in_string;
+                        in_service_hint : kim_mipc_in_string;
+                         in_server_hint : kim_mipc_in_string;
+
+                       out out_identity : kim_mipc_out_string;
+                          out out_error : kim_mipc_error);
+                         
+routine auth_prompt (in_server_port : mach_port_t;
+                        in_identity : kim_mipc_in_string;
+                     in_prompt_type : kim_mipc_prompt_type;
+                          in_hidden : kim_mipc_boolean;
+                           in_title : kim_mipc_in_string;
+                         in_message : kim_mipc_in_string;
+                     in_description : kim_mipc_in_string;
+                   out out_response : kim_mipc_out_string;
+                      out out_error : kim_mipc_error);
+
+routine change_password (in_server_port : mach_port_t;
+                            in_identity : kim_mipc_in_string;
+                in_old_password_expired : kim_mipc_boolean;
+                   out out_old_password : kim_mipc_out_string;
+                   out out_new_password : kim_mipc_out_string;
+                out out_verify_password : kim_mipc_out_string;
+                          out out_error : kim_mipc_error);
+                   
+ routine handle_error (in_server_port : mach_port_t;
+                          in_identity : kim_mipc_in_string;
+                             in_error : kim_mipc_error;
+                           in_message : kim_mipc_in_string;
+                       in_description : kim_mipc_in_string;
+                        out out_error : kim_mipc_error);
+                       
+                          
diff --git a/src/kim/mac/kim_mig_types.h b/src/kim/mac/kim_mig_types.h
new file mode 100644 (file)
index 0000000..189fe06
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * $Header$
+ *
+ * Copyright 2006-2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ * 
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission.  Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#ifndef KIM_MIG_H
+#define KIM_MIG_H
+
+#include <kim/kim.h>
+
+typedef const char *kim_mipc_in_string;
+typedef char       *kim_mipc_out_string;
+typedef int32_t     kim_mipc_error;
+typedef boolean_t   kim_mipc_boolean;
+typedef uint32_t    kim_mipc_lifetime;
+typedef uint32_t    kim_mipc_time;
+typedef uint32_t    kim_mipc_prompt_type;
+
+#endif /* KIM_MIG_H */
index fb785465a8a0cf5d01fb7f2e54eb897a99ac2b3c..c364fc6fb392c27899601b5446c76cbe189192f2 100644 (file)
@@ -877,8 +877,7 @@ void test_kim_preferences_remove_favorite_identity (kim_test_state_t state)
             fail_if_error (state, "kim_preferences_get_favorite_identity_at_index", err, 
                            "while getting favorite identity %d", (int) j);
             
-            if (!err)
-            {
+            if (!err) {
                 kim_identity_get_display_string(compare_identity, &string);
                 err = kim_preferences_remove_favorite_identity(prefs, compare_identity);
                 fail_if_error (state, "kim_preferences_remove_favorite_identity", err,