From 26fafa3b94d53a46d7e1b24d08afbb0b2360492d Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Mon, 29 Sep 2008 02:40:24 +0000 Subject: [PATCH] kim_credential_create_new should support NULL in_identity. Prompt for it. ticket: 6055 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20775 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kim/lib/kim_credential.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/kim/lib/kim_credential.c b/src/kim/lib/kim_credential.c index 8c7a347df..caafb0e97 100644 --- a/src/kim/lib/kim_credential.c +++ b/src/kim/lib/kim_credential.c @@ -211,6 +211,7 @@ kim_error kim_credential_create_new (kim_credential *out_credential, kim_ui_context context; kim_boolean ui_inited = 0; kim_boolean done = 0; + kim_identity identity = in_identity; if (!err && !out_credential) { err = check_error (KIM_NULL_PARAMETER_ERR); } @@ -232,10 +233,16 @@ kim_error kim_credential_create_new (kim_credential *out_credential, if (!err) { err = kim_ui_init (&context); - if (!err) { - context.identity = in_identity; /* used by kim_ui_prompter */ - ui_inited = 1; - } + if (!err) { ui_inited = 1; } + } + + if (!err && !in_identity) { + err = kim_ui_enter_identity (&context, &identity); + + } + + if (!err) { + context.identity = identity; /* used by kim_ui_prompter */ } while (!err && !done) { @@ -307,7 +314,8 @@ kim_error kim_credential_create_new (kim_credential *out_credential, credential = NULL; } - if (options != in_options) { kim_options_free (&options); } + if (options != in_options ) { kim_options_free (&options); } + if (identity != in_identity) { kim_identity_free (&identity); } kim_credential_free (&credential); return check_error (err); -- 2.26.2