* 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.
* 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 */
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
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
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,
#import "ServerDemux.h"
#import "kim_selection_hints_private.h"
+#import "kim_options_private.h"
#import "KerberosAgentListener.h"
// ---------------------------------------------------------------------------
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
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;
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);
}
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;
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);
}
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
}
if (!err && !in_identity) {
- err = kim_ui_enter_identity (&context, &identity);
+ err = kim_ui_enter_identity (&context, options, &identity);
}
/* ------------------------------------------------------------------------ */
-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) {
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);
}
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);
/* ------------------------------------------------------------------------ */
-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);
}
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) {
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);
}
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);
}
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);
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);
}
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);
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;
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);
/* ------------------------------------------------------------------------ */
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;
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 */
/* ------------------------------------------------------------------------ */
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) {
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 */
/* ------------------------------------------------------------------------ */
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) {
/* ------------------------------------------------------------------------ */
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);
}
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,
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,
/* ------------------------------------------------------------------------ */
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);
}
/* ------------------------------------------------------------------------ */
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);
}
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,
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,
/* ------------------------------------------------------------------------ */
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;
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) {
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 */,
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);
}
/* ------------------------------------------------------------------------ */
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) {
}
if (!err) {
- err = kim_selection_hints_write_to_stream (in_hints, request);
+ err = kim_selection_hints_write_to_stream (io_hints, request);
}
if (!err) {
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);