From 3f0979ee8bf09c9d5190c56f9facdcebb17a7680 Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Wed, 1 Oct 2008 15:35:48 +0000 Subject: [PATCH] Support for passing options back and forth for enter_identity and hints back for select_identity. ticket: 6055 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20794 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/kim/kim_ui_plugin.h | 3 +- src/kim/agent/mac/KerberosAgentListener.m | 29 +++++++++-- src/kim/agent/mac/ServerDemux.h | 2 + src/kim/agent/mac/ServerDemux.m | 16 ++++++ src/kim/lib/kim.exports | 4 ++ src/kim/lib/kim_credential.c | 2 +- src/kim/lib/kim_options.c | 60 ++++++++++++++++------- src/kim/lib/kim_options_private.h | 3 ++ src/kim/lib/kim_selection_hints.c | 60 ++++++++++++++++------- src/kim/lib/kim_selection_hints_private.h | 3 ++ src/kim/lib/kim_ui.c | 14 ++++-- src/kim/lib/kim_ui_cli.c | 19 +++++-- src/kim/lib/kim_ui_cli_private.h | 3 +- src/kim/lib/kim_ui_gui_private.h | 3 +- src/kim/lib/kim_ui_plugin.c | 9 ++-- src/kim/lib/kim_ui_plugin_private.h | 3 +- src/kim/lib/kim_ui_private.h | 3 +- src/kim/lib/mac/kim_os_ui_gui.c | 25 ++++++++-- 18 files changed, 199 insertions(+), 62 deletions(-) diff --git a/src/include/kim/kim_ui_plugin.h b/src/include/kim/kim_ui_plugin.h index 99923e510..a2058da83 100644 --- a/src/include/kim/kim_ui_plugin.h +++ b/src/include/kim/kim_ui_plugin.h @@ -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 */ diff --git a/src/kim/agent/mac/KerberosAgentListener.m b/src/kim/agent/mac/KerberosAgentListener.m index f76599726..cc634e2cf 100644 --- a/src/kim/agent/mac/KerberosAgentListener.m +++ b/src/kim/agent/mac/KerberosAgentListener.m @@ -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 diff --git a/src/kim/agent/mac/ServerDemux.h b/src/kim/agent/mac/ServerDemux.h index 1f1de5964..09076d4dd 100644 --- a/src/kim/agent/mac/ServerDemux.h +++ b/src/kim/agent/mac/ServerDemux.h @@ -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, diff --git a/src/kim/agent/mac/ServerDemux.m b/src/kim/agent/mac/ServerDemux.m index b24011d74..3cda9be64 100644 --- a/src/kim/agent/mac/ServerDemux.m +++ b/src/kim/agent/mac/ServerDemux.m @@ -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); } diff --git a/src/kim/lib/kim.exports b/src/kim/lib/kim.exports index 8a2c6c32a..ca96d04a2 100644 --- a/src/kim/lib/kim.exports +++ b/src/kim/lib/kim.exports @@ -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 diff --git a/src/kim/lib/kim_credential.c b/src/kim/lib/kim_credential.c index c143510d3..3dc88e576 100644 --- a/src/kim/lib/kim_credential.c +++ b/src/kim/lib/kim_credential.c @@ -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); } diff --git a/src/kim/lib/kim_options.c b/src/kim/lib/kim_options.c index c8ae31dd3..68f53d665 100644 --- a/src/kim/lib/kim_options.c +++ b/src/kim/lib/kim_options.c @@ -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); } diff --git a/src/kim/lib/kim_options_private.h b/src/kim/lib/kim_options_private.h index 6feddc507..42a9d7855 100644 --- a/src/kim/lib/kim_options_private.h +++ b/src/kim/lib/kim_options_private.h @@ -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); diff --git a/src/kim/lib/kim_selection_hints.c b/src/kim/lib/kim_selection_hints.c index 70dacd75f..a825742d3 100644 --- a/src/kim/lib/kim_selection_hints.c +++ b/src/kim/lib/kim_selection_hints.c @@ -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; diff --git a/src/kim/lib/kim_selection_hints_private.h b/src/kim/lib/kim_selection_hints_private.h index 50e942e5e..796116e6a 100644 --- a/src/kim/lib/kim_selection_hints_private.h +++ b/src/kim/lib/kim_selection_hints_private.h @@ -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); diff --git a/src/kim/lib/kim_ui.c b/src/kim/lib/kim_ui.c index cf97fb2d3..cd119c8d3 100644 --- a/src/kim/lib/kim_ui.c +++ b/src/kim/lib/kim_ui.c @@ -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 */ diff --git a/src/kim/lib/kim_ui_cli.c b/src/kim/lib/kim_ui_cli.c index 766bdc059..3301f322c 100644 --- a/src/kim/lib/kim_ui_cli.c +++ b/src/kim/lib/kim_ui_cli.c @@ -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); } diff --git a/src/kim/lib/kim_ui_cli_private.h b/src/kim/lib/kim_ui_cli_private.h index 505919600..5b38cae08 100644 --- a/src/kim/lib/kim_ui_cli_private.h +++ b/src/kim/lib/kim_ui_cli_private.h @@ -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, diff --git a/src/kim/lib/kim_ui_gui_private.h b/src/kim/lib/kim_ui_gui_private.h index dd2f2a9e5..4cf28f992 100644 --- a/src/kim/lib/kim_ui_gui_private.h +++ b/src/kim/lib/kim_ui_gui_private.h @@ -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, diff --git a/src/kim/lib/kim_ui_plugin.c b/src/kim/lib/kim_ui_plugin.c index 0ac2f1494..2b20f34df 100644 --- a/src/kim/lib/kim_ui_plugin.c +++ b/src/kim/lib/kim_ui_plugin.c @@ -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); } diff --git a/src/kim/lib/kim_ui_plugin_private.h b/src/kim/lib/kim_ui_plugin_private.h index 58eb60f40..0ee23039d 100644 --- a/src/kim/lib/kim_ui_plugin_private.h +++ b/src/kim/lib/kim_ui_plugin_private.h @@ -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, diff --git a/src/kim/lib/kim_ui_private.h b/src/kim/lib/kim_ui_private.h index f4d1b10d9..d4bf613e2 100644 --- a/src/kim/lib/kim_ui_private.h +++ b/src/kim/lib/kim_ui_private.h @@ -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, diff --git a/src/kim/lib/mac/kim_os_ui_gui.c b/src/kim/lib/mac/kim_os_ui_gui.c index d87efb067..ec2ca608d 100644 --- a/src/kim/lib/mac/kim_os_ui_gui.c +++ b/src/kim/lib/mac/kim_os_ui_gui.c @@ -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); -- 2.26.2