Support for passing options back and forth for enter_identity and
authorAlexandra Ellwood <lxs@mit.edu>
Wed, 1 Oct 2008 15:35:48 +0000 (15:35 +0000)
committerAlexandra Ellwood <lxs@mit.edu>
Wed, 1 Oct 2008 15:35:48 +0000 (15:35 +0000)
hints back for select_identity.

ticket: 6055

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

18 files changed:
src/include/kim/kim_ui_plugin.h
src/kim/agent/mac/KerberosAgentListener.m
src/kim/agent/mac/ServerDemux.h
src/kim/agent/mac/ServerDemux.m
src/kim/lib/kim.exports
src/kim/lib/kim_credential.c
src/kim/lib/kim_options.c
src/kim/lib/kim_options_private.h
src/kim/lib/kim_selection_hints.c
src/kim/lib/kim_selection_hints_private.h
src/kim/lib/kim_ui.c
src/kim/lib/kim_ui_cli.c
src/kim/lib/kim_ui_cli_private.h
src/kim/lib/kim_ui_gui_private.h
src/kim/lib/kim_ui_plugin.c
src/kim/lib/kim_ui_plugin_private.h
src/kim/lib/kim_ui_private.h
src/kim/lib/mac/kim_os_ui_gui.c

index 99923e51037fc123fbc8a40994802680e8c3201f..a2058da8370fce01fa3f8d40559aab8fff149025 100644 (file)
@@ -76,6 +76,7 @@ typedef struct kim_ui_plugin_ftable_v0 {
      * If this UI calls into KIM to get new credentials it may 
      * call auth_prompt below. */
     kim_error (*enter_identity) (void         *in_context,
+                                 kim_options   io_options,
                                  kim_identity *out_identity);
     
     /* Present UI to select which identity to use.
@@ -84,7 +85,7 @@ typedef struct kim_ui_plugin_ftable_v0 {
      * If this UI calls into KIM to get new credentials it may 
      * call auth_prompt below. */
     kim_error (*select_identity) (void                *in_context,
-                                  kim_selection_hints  in_hints,
+                                  kim_selection_hints  io_hints,
                                   kim_identity        *out_identity);
     
     /* Present UI to display authentication to the user */
index f765997269737baa5d54df69b4cf4502d5019760..cc634e2cffe74fc94a32bfd7b6ad290e8874e826 100644 (file)
@@ -148,12 +148,22 @@ static KerberosAgentListener *sharedListener = nil;
     kim_error err = KIM_NO_ERROR;
     mach_port_t reply_port = [[info objectForKey:@"reply_port"] integerValue];
     kim_identity identity = NULL;
+    kim_options options = NULL;
     
     if (!err) {
-        err = kim_identity_create_from_string(&identity, [[info objectForKey:@"identity_string"] UTF8String]);
+        err = kim_identity_create_from_string (&identity, [[info objectForKey:@"identity_string"] UTF8String]);
     }
     
-    err = kim_handle_reply_enter_identity(reply_port, identity, error);
+    if (!err) {
+#warning Placeholder for returning options
+        err = kim_options_create (&options);
+    }
+    
+    if (!err) {
+        err = kim_handle_reply_enter_identity(reply_port, identity, options, error);
+    }
+    
+    kim_options_free (&options);
 }
 
 + (void) selectIdentityWithClientPort: (mach_port_t) client_port
@@ -187,9 +197,20 @@ static KerberosAgentListener *sharedListener = nil;
     NSString *identityString = [info objectForKey:@"identity_string"];
     mach_port_t reply_port = [portNumber integerValue];
     kim_identity identity = NULL;
-    kim_identity_create_from_string(&identity, (identityString) ? [identityString UTF8String] : "");
+    kim_options options = NULL;
+    
+    err = kim_identity_create_from_string(&identity, (identityString) ? [identityString UTF8String] : "");
 
-    err = kim_handle_reply_select_identity(reply_port, identity, error);
+    if (!err) {
+#warning Placeholder for returning options
+        err = kim_options_create (&options);
+    }
+    
+    if (!err) {
+        err = kim_handle_reply_select_identity(reply_port, identity, options, error);
+    }
+    
+    kim_options_free (&options);
 }
 
 + (void) promptForAuthWithClientPort: (mach_port_t) client_port
index 1f1de5964cc56a7de05e9e995c933f9adb575212..09076d4dd1b279755d85dc591de46e9d22db83f0 100644 (file)
@@ -35,10 +35,12 @@ int32_t kim_handle_reply_init (mach_port_t   in_reply_port,
 
 int32_t kim_handle_reply_enter_identity (mach_port_t   in_reply_port, 
                                          kim_identity  in_identity,
+                                         kim_options   in_options,
                                          int32_t       in_error);
 
 int32_t kim_handle_reply_select_identity (mach_port_t   in_reply_port, 
                                           kim_identity  in_identity,
+                                          kim_options   in_options,
                                           int32_t       in_error);
 
 int32_t kim_handle_reply_auth_prompt (mach_port_t   in_reply_port, 
index b24011d74c75cc65edc80ae3150d626610ec15a7..3cda9be64604e44309288e214c663bdf1c4a407c 100644 (file)
@@ -24,6 +24,7 @@
 
 #import "ServerDemux.h"
 #import "kim_selection_hints_private.h"
+#import "kim_options_private.h"
 #import "KerberosAgentListener.h"
 
 // ---------------------------------------------------------------------------
@@ -139,6 +140,11 @@ static int32_t kim_handle_request_enter_identity (mach_port_t   in_client_port,
                                                   k5_ipc_stream in_request_stream)
 {
     int32_t err = 0;
+    kim_options options = NULL;
+    
+    if (!err) {
+        err = kim_options_create_from_stream (&options, in_request_stream);
+    }
     
     if (!err) {
         // performs selector on main thread
@@ -153,6 +159,7 @@ static int32_t kim_handle_request_enter_identity (mach_port_t   in_client_port,
 
 int32_t kim_handle_reply_enter_identity (mach_port_t   in_reply_port, 
                                          kim_identity  in_identity,
+                                         kim_options   in_options,
                                          int32_t       in_error)
 {
     int32_t err = 0;
@@ -175,6 +182,10 @@ int32_t kim_handle_reply_enter_identity (mach_port_t   in_reply_port,
         err = k5_ipc_stream_write_string (reply, identity_string);
     }
     
+    if (!err && !in_error) {
+        err = kim_options_write_to_stream (in_options, reply);
+    }
+    
     if (!err) {
         err = k5_ipc_server_send_reply (in_reply_port, reply);
     }
@@ -217,6 +228,7 @@ static int32_t kim_handle_request_select_identity (mach_port_t   in_client_port,
 
 int32_t kim_handle_reply_select_identity (mach_port_t   in_reply_port, 
                                           kim_identity  in_identity,
+                                          kim_options   in_options,
                                           int32_t       in_error)
 {
     int32_t err = 0;
@@ -239,6 +251,10 @@ int32_t kim_handle_reply_select_identity (mach_port_t   in_reply_port,
         err = k5_ipc_stream_write_string (reply, identity_string);
     }
     
+    if (!err && !in_error) {
+        err = kim_options_write_to_stream (in_options, reply);
+    }
+
     if (!err) {
         err = k5_ipc_server_send_reply (in_reply_port, reply);
     }
index 8a2c6c32a3e411de0377b99635bac9732fa7aaf2..ca96d04a2d0c57d15ae0dec4eb29b48b787c84f4 100644 (file)
@@ -38,6 +38,10 @@ kim_options_set_service_name
 kim_options_get_service_name
 kim_options_free
 
+# Used by KerberosAgent
+kim_options_create_from_stream
+kim_options_write_to_stream
+
 kim_selection_hints_create
 kim_selection_hints_copy
 kim_selection_hints_set_hint
index c143510d3b18b1e1386186f1cca637264c8bc36b..3dc88e57661d764b3e21f30dd173b294515f8b73 100644 (file)
@@ -250,7 +250,7 @@ kim_error kim_credential_create_new_with_password (kim_credential *out_credentia
     }
     
     if (!err && !in_identity) {
-        err = kim_ui_enter_identity (&context, &identity);
+        err = kim_ui_enter_identity (&context, options, &identity);
         
     }
     
index c8ae31dd3f7f56d5dde57d99689fb442c289b5cb..68f53d665c396ad663bfbfe6823942f3fa74f381 100644 (file)
@@ -574,46 +574,41 @@ kim_error kim_options_write_to_stream (kim_options   in_options,
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_options_create_from_stream (kim_options   *out_options,
-                                          k5_ipc_stream  io_stream)
+kim_error kim_options_read_from_stream (kim_options    io_options,
+                                        k5_ipc_stream  io_stream)
 {
     kim_error err = KIM_NO_ERROR;
-    kim_options options = NULL;
-    
-    if (!err && !out_options) { err = check_error (KIM_NULL_PARAMETER_ERR); }
-    if (!err && !io_stream  ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     
-    if (!err) {
-        err = kim_options_allocate (&options);
-    }
+    if (!err && !io_options) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+    if (!err && !io_stream ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     
     if (!err) {
-        err = k5_ipc_stream_read_int64 (io_stream, &options->start_time);
+        err = k5_ipc_stream_read_int64 (io_stream, &io_options->start_time);
     }
     
     if (!err) {
-        err = k5_ipc_stream_read_int64 (io_stream, &options->lifetime);
+        err = k5_ipc_stream_read_int64 (io_stream, &io_options->lifetime);
     }
     
     if (!err) {
-        err = k5_ipc_stream_read_int32 (io_stream, &options->renewable);
+        err = k5_ipc_stream_read_int32 (io_stream, &io_options->renewable);
     }
     
     if (!err) {
         err = k5_ipc_stream_read_int64 (io_stream, 
-                                        &options->renewal_lifetime);
+                                        &io_options->renewal_lifetime);
     }
     
     if (!err) {
-        err = k5_ipc_stream_read_int32 (io_stream, &options->forwardable);
+        err = k5_ipc_stream_read_int32 (io_stream, &io_options->forwardable);
     }
     
     if (!err) {
-        err = k5_ipc_stream_read_int32 (io_stream, &options->proxiable);
+        err = k5_ipc_stream_read_int32 (io_stream, &io_options->proxiable);
     }
     
     if (!err) {
-        err = k5_ipc_stream_read_int32 (io_stream, &options->addressless);
+        err = k5_ipc_stream_read_int32 (io_stream, &io_options->addressless);
     }
     
     if (!err) {
@@ -621,18 +616,45 @@ kim_error kim_options_create_from_stream (kim_options   *out_options,
         err = k5_ipc_stream_read_string (io_stream, &service_name);
         
         if (!err) {
-            err = kim_string_copy (&options->service_name, service_name);
+            kim_string_free (&io_options->service_name);
+            if (service_name[0]) {
+                err = kim_string_copy (&io_options->service_name, service_name);
+            } else {
+                io_options->service_name = NULL;
+            }
         }
         
         k5_ipc_stream_free_string (service_name);
     }
     
+    return check_error (err);    
+}
+
+/* ------------------------------------------------------------------------ */
+
+kim_error kim_options_create_from_stream (kim_options   *out_options,
+                                          k5_ipc_stream  io_stream) 
+{
+    kim_error err = KIM_NO_ERROR;
+    kim_options options = NULL;
+    
+    if (!err && !out_options) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+    if (!err && !io_stream  ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+
+    if (!err) {
+        err = kim_options_allocate (&options);
+    }
+
+    if (!err) {
+        kim_options_read_from_stream (options, io_stream);
+    }
+    
     if (!err) {
         *out_options = options;
         options = NULL;
     }
     
-    kim_options_free (&options);
+    kim_options_free (&options); 
     
-    return check_error (err);    
+    return check_error (err);
 }
index 6feddc5071be2dc5619b411c2d71bb129bb05c8c..42a9d7855c8cce51b1808035798d26abf13060d4 100644 (file)
@@ -42,6 +42,9 @@ kim_time kim_options_start_time (kim_options in_options);
 kim_error kim_options_write_to_stream (kim_options   in_options,
                                        k5_ipc_stream io_stream);
 
+kim_error kim_options_read_from_stream (kim_options    io_options,
+                                        k5_ipc_stream  io_stream);
+
 kim_error kim_options_create_from_stream (kim_options   *out_options,
                                           k5_ipc_stream  io_stream);
 
index 70dacd75f4f3210269e50a70ecf7e3ac6324f87d..a825742d3a7beda954f9c6c60a77c4bd2853c0b2 100644 (file)
@@ -626,25 +626,20 @@ kim_error kim_selection_hints_write_to_stream (kim_selection_hints in_selection_
 
 /* ------------------------------------------------------------------------ */
 
-kim_error kim_selection_hints_create_from_stream (kim_selection_hints *out_selection_hints,
-                                                  k5_ipc_stream        io_stream)
+kim_error kim_selection_hints_read_from_stream (kim_selection_hints io_selection_hints,
+                                                k5_ipc_stream       io_stream)
 {
     kim_error err = KIM_NO_ERROR;
-    kim_selection_hints selection_hints = NULL;
-    
-    if (!err && !out_selection_hints) { err = check_error (KIM_NULL_PARAMETER_ERR); }
-    if (!err && !io_stream          ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     
-    if (!err) {
-        err = kim_selection_hints_allocate (&selection_hints);
-    }
+    if (!err && !io_selection_hints) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+    if (!err && !io_stream         ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     
     if (!err) {
         char *application_identifier = NULL;
         err = k5_ipc_stream_read_string (io_stream, &application_identifier);
         
         if (!err) {
-            err = kim_string_copy (&selection_hints->application_identifier, 
+            err = kim_string_copy (&io_selection_hints->application_identifier, 
                                    application_identifier);
         }
         
@@ -656,15 +651,20 @@ kim_error kim_selection_hints_create_from_stream (kim_selection_hints *out_selec
         err = k5_ipc_stream_read_string (io_stream, &explanation);
         
         if (!err) {
-            err = kim_string_copy (&selection_hints->explanation, explanation);
+            err = kim_string_copy (&io_selection_hints->explanation, explanation);
         }
         
         k5_ipc_stream_free_string (explanation);
     }
     
     if (!err) {
-        err = kim_options_create_from_stream (&selection_hints->options, 
-                                              io_stream);
+        if (io_selection_hints->options) {
+            err = kim_options_read_from_stream (io_selection_hints->options, 
+                                                io_stream);
+        } else {
+            err = kim_options_create_from_stream (&io_selection_hints->options, 
+                                                  io_stream);
+        }
     }
     
     if (!err) {
@@ -672,7 +672,7 @@ kim_error kim_selection_hints_create_from_stream (kim_selection_hints *out_selec
         err = k5_ipc_stream_read_string (io_stream, &service_identity);
         
         if (!err) {
-            err = kim_string_copy (&selection_hints->service_identity, 
+            err = kim_string_copy (&io_selection_hints->service_identity, 
                                    service_identity);
         }
         
@@ -684,7 +684,7 @@ kim_error kim_selection_hints_create_from_stream (kim_selection_hints *out_selec
         err = k5_ipc_stream_read_string (io_stream, &client_realm);
         
         if (!err) {
-            err = kim_string_copy (&selection_hints->client_realm, 
+            err = kim_string_copy (&io_selection_hints->client_realm, 
                                    client_realm);
         }
         
@@ -696,7 +696,7 @@ kim_error kim_selection_hints_create_from_stream (kim_selection_hints *out_selec
         err = k5_ipc_stream_read_string (io_stream, &user);
         
         if (!err) {
-            err = kim_string_copy (&selection_hints->user, user);
+            err = kim_string_copy (&io_selection_hints->user, user);
         }
         
         k5_ipc_stream_free_string (user);
@@ -707,7 +707,7 @@ kim_error kim_selection_hints_create_from_stream (kim_selection_hints *out_selec
         err = k5_ipc_stream_read_string (io_stream, &service_realm);
         
         if (!err) {
-            err = kim_string_copy (&selection_hints->service_realm, 
+            err = kim_string_copy (&io_selection_hints->service_realm, 
                                    service_realm);
         }
         
@@ -719,7 +719,7 @@ kim_error kim_selection_hints_create_from_stream (kim_selection_hints *out_selec
         err = k5_ipc_stream_read_string (io_stream, &service);
         
         if (!err) {
-            err = kim_string_copy (&selection_hints->service, service);
+            err = kim_string_copy (&io_selection_hints->service, service);
         }
         
         k5_ipc_stream_free_string (service);
@@ -730,12 +730,34 @@ kim_error kim_selection_hints_create_from_stream (kim_selection_hints *out_selec
         err = k5_ipc_stream_read_string (io_stream, &server);
         
         if (!err) {
-            err = kim_string_copy (&selection_hints->server, server);
+            err = kim_string_copy (&io_selection_hints->server, server);
         }
         
          k5_ipc_stream_free_string (server);
     }
     
+    return check_error (err);    
+}
+
+/* ------------------------------------------------------------------------ */
+
+kim_error kim_selection_hints_create_from_stream (kim_selection_hints *out_selection_hints,
+                                                  k5_ipc_stream        io_stream)
+{
+    kim_error err = KIM_NO_ERROR;
+    kim_selection_hints selection_hints = NULL;
+    
+    if (!err && !out_selection_hints) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+    if (!err && !io_stream          ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+    
+    if (!err) {
+        err = kim_selection_hints_allocate (&selection_hints);
+    }
+    
+    if (!err) {
+        err = kim_selection_hints_read_from_stream (selection_hints, io_stream);
+    }
+    
     if (!err) {
         *out_selection_hints = selection_hints;
         selection_hints = NULL;
index 50e942e5e0f2fb67bc288d5bab38ac9372b0a202..796116e6a2035d7049fe185721b974791f9092ff 100644 (file)
@@ -57,6 +57,9 @@ kim_error kim_os_selection_hints_forget_identity (kim_selection_hints in_selecti
 kim_error kim_selection_hints_write_to_stream (kim_selection_hints in_selection_hints,
                                                k5_ipc_stream       io_stream);
 
+kim_error kim_selection_hints_read_from_stream (kim_selection_hints io_selection_hints,
+                                                k5_ipc_stream       io_stream);
+
 kim_error kim_selection_hints_create_from_stream (kim_selection_hints *out_selection_hints,
                                                   k5_ipc_stream        in_stream);
 
index cf97fb2d36926802fba60716881d3656e5cfb020..cd119c8d325f7757c7d34f44750420b721ba4338 100644 (file)
@@ -112,6 +112,7 @@ kim_error kim_ui_init (kim_ui_context *io_context)
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ui_enter_identity (kim_ui_context      *in_context,
+                                 kim_options          io_options,
                                  kim_identity        *out_identity)
 {
     kim_error err = KIM_NO_ERROR;
@@ -126,15 +127,18 @@ kim_error kim_ui_enter_identity (kim_ui_context      *in_context,
     if (!err) {
         if (in_context->type == kim_ui_type_gui_plugin) {
             err = kim_ui_plugin_enter_identity (in_context, 
+                                                io_options,
                                                 out_identity);
             
 #ifndef LEAN_CLIENT
         } else if (in_context->type == kim_ui_type_gui_builtin) {
             err = kim_os_ui_gui_enter_identity (in_context, 
+                                                io_options,
                                                 out_identity);
             
         } else if (in_context->type == kim_ui_type_cli) {
             err = kim_ui_cli_enter_identity (in_context, 
+                                             io_options,
                                              out_identity);
             
 #endif /* LEAN_CLIENT */
@@ -150,13 +154,13 @@ kim_error kim_ui_enter_identity (kim_ui_context      *in_context,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ui_select_identity (kim_ui_context      *in_context,
-                                  kim_selection_hints  in_hints,
+                                  kim_selection_hints  io_hints,
                                   kim_identity        *out_identity)
 {
     kim_error err = KIM_NO_ERROR;
     
     if (!err && !in_context  ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
-    if (!err && !in_hints    ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+    if (!err && !io_hints    ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     if (!err && !out_identity) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     
     if (!err) {
@@ -166,18 +170,18 @@ kim_error kim_ui_select_identity (kim_ui_context      *in_context,
     if (!err) {
         if (in_context->type == kim_ui_type_gui_plugin) {
             err = kim_ui_plugin_select_identity (in_context, 
-                                                 in_hints,
+                                                 io_hints,
                                                  out_identity);
             
 #ifndef LEAN_CLIENT
         } else if (in_context->type == kim_ui_type_gui_builtin) {
             err = kim_os_ui_gui_select_identity (in_context, 
-                                                 in_hints,
+                                                 io_hints,
                                                  out_identity);
             
         } else if (in_context->type == kim_ui_type_cli) {
             err = kim_ui_cli_select_identity (in_context, 
-                                              in_hints,
+                                              io_hints,
                                               out_identity);
             
 #endif /* LEAN_CLIENT */
index 766bdc05955fe17583c2bf61d1824f0a87ddf2a9..3301f322c683f76144c24e45759da7bf25c8a716 100644 (file)
@@ -101,12 +101,14 @@ kim_error kim_ui_cli_init (kim_ui_context *io_context)
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ui_cli_enter_identity (kim_ui_context *in_context,
+                                     kim_options     io_options,
                                      kim_identity   *out_identity)
 {
     kim_error err = KIM_NO_ERROR;
     kim_string enter_identity_string = NULL;
     kim_string identity_string = NULL;
     
+    if (!err && !io_options  ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     if (!err && !out_identity) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     
     if (!err) {
@@ -132,18 +134,29 @@ kim_error kim_ui_cli_enter_identity (kim_ui_context *in_context,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ui_cli_select_identity (kim_ui_context      *in_context,
-                                      kim_selection_hints  in_hints,
+                                      kim_selection_hints  io_hints,
                                       kim_identity        *out_identity)
 {
     kim_error err = KIM_NO_ERROR;
+    kim_options options = NULL;
     
-    if (!err && !in_hints    ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+    if (!err && !io_hints    ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     if (!err && !out_identity) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     
     if (!err) {
-        err = kim_ui_cli_enter_identity (in_context, out_identity);
+        err = kim_selection_hints_get_options (io_hints, &options);
     }
     
+    if (!err) {
+        err = kim_ui_cli_enter_identity (in_context, options, out_identity);
+    }
+    
+    if (!err) {
+        err = kim_selection_hints_set_options (io_hints, options);
+    }
+    
+    kim_options_free (&options);
+    
     return check_error (err);
 }
 
index 5059196003a1e426c72bfafc30549c0a819e9d59..5b38cae080704f94a91309628e9ad3a7e340e773 100644 (file)
@@ -37,10 +37,11 @@ typedef kim_credential kim_ui_cli_context;
 kim_error kim_ui_cli_init (kim_ui_context *io_context);
 
 kim_error kim_ui_cli_enter_identity (kim_ui_context *in_context,
+                                     kim_options     io_options,
                                      kim_identity   *out_identity);
 
 kim_error kim_ui_cli_select_identity (kim_ui_context      *in_context,
-                                      kim_selection_hints  in_hints,
+                                      kim_selection_hints  io_hints,
                                       kim_identity        *out_identity);
 
 kim_error kim_ui_cli_auth_prompt (kim_ui_context      *in_context,
index dd2f2a9e5c02174041bc9a6d3891c4979c3c3dee..4cf28f9927134a819bfbfa73f39e5f7ac4bc2a94 100644 (file)
@@ -37,10 +37,11 @@ typedef struct kim_ui_gui_context *kim_ui_gui_context;
 kim_error kim_os_ui_gui_init (kim_ui_context *io_context);
 
 kim_error kim_os_ui_gui_enter_identity (kim_ui_context *in_context,
+                                        kim_options     io_options,
                                         kim_identity   *out_identity);
 
 kim_error kim_os_ui_gui_select_identity (kim_ui_context      *in_context,
-                                         kim_selection_hints  in_hints,
+                                         kim_selection_hints  io_hints,
                                          kim_identity        *out_identity);
 
 kim_error kim_os_ui_gui_auth_prompt (kim_ui_context      *in_context,
index 0ac2f149408218ddb65a6b1c540304b145a4b47a..2b20f34dfcc892506f36fcd1e0801677cca62d60 100644 (file)
@@ -157,17 +157,20 @@ kim_error kim_ui_plugin_init (kim_ui_context *io_context)
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ui_plugin_enter_identity (kim_ui_context *in_context,
+                                        kim_options     io_options,
                                         kim_identity   *out_identity)
 {
     kim_error err = KIM_NO_ERROR;
     
     if (!err && !in_context  ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+    if (!err && !io_options  ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     if (!err && !out_identity) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     
     if (!err) {
         kim_ui_plugin_context context = (kim_ui_plugin_context) in_context->tcontext;
 
         err = context->ftable->enter_identity (context->plugin_context,
+                                               io_options,
                                                out_identity);
     }
     
@@ -177,20 +180,20 @@ kim_error kim_ui_plugin_enter_identity (kim_ui_context *in_context,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_ui_plugin_select_identity (kim_ui_context      *in_context,
-                                         kim_selection_hints  in_hints,
+                                         kim_selection_hints  io_hints,
                                          kim_identity        *out_identity)
 {
     kim_error err = KIM_NO_ERROR;
     
     if (!err && !in_context  ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
-    if (!err && !in_hints    ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+    if (!err && !io_hints    ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     if (!err && !out_identity) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     
     if (!err) {
         kim_ui_plugin_context context = (kim_ui_plugin_context) in_context->tcontext;
         
         err = context->ftable->select_identity (context->plugin_context,
-                                                in_hints, 
+                                                io_hints, 
                                                 out_identity);
     }
     
index 58eb60f4083cc3d8c89573a791b5bd662023d1bc..0ee23039d7fd47adebc3f3ccad770b07716da467 100644 (file)
@@ -36,10 +36,11 @@ typedef struct kim_ui_plugin_context *kim_ui_plugin_context;
 kim_error kim_ui_plugin_init (kim_ui_context *io_context);
 
 kim_error kim_ui_plugin_enter_identity (kim_ui_context *in_context,
+                                        kim_options     io_options,
                                         kim_identity   *out_identity);
 
 kim_error kim_ui_plugin_select_identity (kim_ui_context      *in_context,
-                                         kim_selection_hints  in_hints,
+                                         kim_selection_hints  io_hints,
                                          kim_identity        *out_identity);
 
 kim_error kim_ui_plugin_auth_prompt (kim_ui_context      *in_context,
index f4d1b10d9ba26555bd2062bae244190fcf4cb22b..d4bf613e2731a51dfc69ab6cd77061e0022f6f93 100644 (file)
@@ -58,10 +58,11 @@ typedef struct kim_ui_context {
 kim_error kim_ui_init (kim_ui_context *io_context);
 
 kim_error kim_ui_enter_identity (kim_ui_context *in_context,
+                                 kim_options     io_options,
                                  kim_identity   *out_identity);
 
 kim_error kim_ui_select_identity (kim_ui_context       *in_context,
-                                  kim_selection_hints   in_hints,
+                                  kim_selection_hints   io_hints,
                                   kim_identity         *out_identity);
 
 krb5_error_code kim_ui_prompter (krb5_context  in_krb5_context,
index d87efb0679a4740f0f02ff40642e457a14483761..ec2ca608deee06d135aeb9480bfc289fcdf25e51 100644 (file)
@@ -116,6 +116,7 @@ kim_error kim_os_ui_gui_init (kim_ui_context *io_context)
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_os_ui_gui_enter_identity (kim_ui_context *in_context,
+                                        kim_options     io_options,
                                         kim_identity   *out_identity)
 {
     kim_error err = KIM_NO_ERROR;
@@ -123,6 +124,7 @@ kim_error kim_os_ui_gui_enter_identity (kim_ui_context *in_context,
     k5_ipc_stream reply = NULL;
     char *identity_string = NULL;
     
+    if (!err && !io_options  ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     if (!err && !out_identity) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     
     if (!err) {
@@ -133,6 +135,9 @@ kim_error kim_os_ui_gui_enter_identity (kim_ui_context *in_context,
         err = k5_ipc_stream_write_string (request, "enter_identity");
     }
 
+    if (!err) {
+        err = kim_options_write_to_stream (io_options, request);
+    }
     
     if (!err) {
         err = kim_os_ui_gui_send_request (0 /* don't launch server */,
@@ -152,6 +157,10 @@ kim_error kim_os_ui_gui_enter_identity (kim_ui_context *in_context,
         err  = k5_ipc_stream_read_string (reply, &identity_string);
     }
     
+    if (!err) {
+        err  = kim_options_read_from_stream (io_options, reply);
+    }
+    
     if (!err) {
         err = kim_identity_create_from_string (out_identity, identity_string);
     }
@@ -166,15 +175,16 @@ kim_error kim_os_ui_gui_enter_identity (kim_ui_context *in_context,
 /* ------------------------------------------------------------------------ */
 
 kim_error kim_os_ui_gui_select_identity (kim_ui_context      *in_context,
-                                         kim_selection_hints  in_hints,
+                                         kim_selection_hints  io_hints,
                                          kim_identity        *out_identity)
 {
     kim_error err = KIM_NO_ERROR;
     k5_ipc_stream request = NULL;
     k5_ipc_stream reply = NULL;
     char *identity_string = NULL;
+    kim_options options = NULL;
     
-    if (!err && !in_hints    ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+    if (!err && !io_hints    ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     if (!err && !out_identity) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     
     if (!err) {
@@ -186,7 +196,7 @@ kim_error kim_os_ui_gui_select_identity (kim_ui_context      *in_context,
     }
     
     if (!err) {
-        err = kim_selection_hints_write_to_stream (in_hints, request);
+        err = kim_selection_hints_write_to_stream (io_hints, request);
     }
     
     if (!err) {
@@ -211,6 +221,15 @@ kim_error kim_os_ui_gui_select_identity (kim_ui_context      *in_context,
         err = kim_identity_create_from_string (out_identity, identity_string);
     }
     
+    if (!err) {
+        err = kim_options_create_from_stream (&options, reply);
+    }
+    
+    if (!err) {
+        err = kim_selection_hints_set_options (io_hints, options);
+    }
+    
+    kim_options_free (&options);
     k5_ipc_stream_free_string (identity_string);    
     k5_ipc_stream_release (request);
     k5_ipc_stream_release (reply);