fix some bugs and a memory leak
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2792 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -203,10 +203,10 @@ get_init_creds_common(krb5_context context,
|
|||||||
krb5_addresses **addrs,
|
krb5_addresses **addrs,
|
||||||
krb5_enctype **etypes,
|
krb5_enctype **etypes,
|
||||||
krb5_creds *cred,
|
krb5_creds *cred,
|
||||||
krb5_preauthtype **pre_auth_types)
|
krb5_preauthtype **pre_auth_types,
|
||||||
|
krb5_kdc_flags *flags)
|
||||||
{
|
{
|
||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
krb5_kdc_flags flags;
|
|
||||||
krb5_realm *client_realm;
|
krb5_realm *client_realm;
|
||||||
|
|
||||||
ret = init_cred (context, cred, client, start_time,
|
ret = init_cred (context, cred, client, start_time,
|
||||||
@@ -216,26 +216,26 @@ get_init_creds_common(krb5_context context,
|
|||||||
|
|
||||||
client_realm = krb5_princ_realm (context, cred->client);
|
client_realm = krb5_princ_realm (context, cred->client);
|
||||||
|
|
||||||
flags.i = 0;
|
flags->i = 0;
|
||||||
|
|
||||||
if (options->flags & KRB5_GET_INIT_CREDS_OPT_FORWARDABLE)
|
if (options->flags & KRB5_GET_INIT_CREDS_OPT_FORWARDABLE)
|
||||||
flags.b.forwardable = 1;
|
flags->b.forwardable = 1;
|
||||||
else
|
else
|
||||||
flags.b.forwardable = ison(get_config_string (context,
|
flags->b.forwardable = ison(get_config_string (context,
|
||||||
*client_realm,
|
*client_realm,
|
||||||
"forwardable",
|
"forwardable",
|
||||||
"no"));
|
"no"));
|
||||||
|
|
||||||
if (options->flags & KRB5_GET_INIT_CREDS_OPT_PROXIABLE)
|
if (options->flags & KRB5_GET_INIT_CREDS_OPT_PROXIABLE)
|
||||||
flags.b.proxiable = 1;
|
flags->b.proxiable = 1;
|
||||||
else
|
else
|
||||||
flags.b.proxiable = ison(get_config_string (context,
|
flags->b.proxiable = ison(get_config_string (context,
|
||||||
*client_realm,
|
*client_realm,
|
||||||
"proxiable",
|
"proxiable",
|
||||||
"no"));
|
"no"));
|
||||||
|
|
||||||
if (cred->times.renew_till)
|
if (cred->times.renew_till)
|
||||||
flags.b.renewable = 1;
|
flags->b.renewable = 1;
|
||||||
if (options->flags & KRB5_GET_INIT_CREDS_OPT_ADDRESS_LIST)
|
if (options->flags & KRB5_GET_INIT_CREDS_OPT_ADDRESS_LIST)
|
||||||
*addrs = options->address_list;
|
*addrs = options->address_list;
|
||||||
if (options->flags & KRB5_GET_INIT_CREDS_OPT_ETYPE_LIST) {
|
if (options->flags & KRB5_GET_INIT_CREDS_OPT_ETYPE_LIST) {
|
||||||
@@ -248,13 +248,13 @@ get_init_creds_common(krb5_context context,
|
|||||||
(*etypes)[options->etype_list_length] = 0;
|
(*etypes)[options->etype_list_length] = 0;
|
||||||
}
|
}
|
||||||
if (options->flags & KRB5_GET_INIT_CREDS_OPT_PREAUTH_LIST) {
|
if (options->flags & KRB5_GET_INIT_CREDS_OPT_PREAUTH_LIST) {
|
||||||
pre_auth_types = malloc((options->preauth_list_length + 1)
|
*pre_auth_types = malloc((options->preauth_list_length + 1)
|
||||||
* sizeof(krb5_preauthtype));
|
* sizeof(krb5_preauthtype));
|
||||||
if (pre_auth_types == NULL)
|
if (*pre_auth_types == NULL)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
memcpy (pre_auth_types, options->preauth_list,
|
memcpy (*pre_auth_types, options->preauth_list,
|
||||||
options->preauth_list_length * sizeof(krb5_preauthtype));
|
options->preauth_list_length * sizeof(krb5_preauthtype));
|
||||||
pre_auth_types[options->preauth_list_length] = 0;
|
(*pre_auth_types)[options->preauth_list_length] = 0;
|
||||||
}
|
}
|
||||||
if (options->flags & KRB5_GET_INIT_CREDS_OPT_SALT)
|
if (options->flags & KRB5_GET_INIT_CREDS_OPT_SALT)
|
||||||
; /* XXX */
|
; /* XXX */
|
||||||
@@ -284,7 +284,8 @@ krb5_get_init_creds_password(krb5_context context,
|
|||||||
|
|
||||||
ret = get_init_creds_common(context, creds, client, start_time,
|
ret = get_init_creds_common(context, creds, client, start_time,
|
||||||
in_tkt_service, options,
|
in_tkt_service, options,
|
||||||
&addrs, &etypes, &this_cred, &pre_auth_types);
|
&addrs, &etypes, &this_cred, &pre_auth_types,
|
||||||
|
&flags);
|
||||||
if(ret)
|
if(ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@@ -301,6 +302,7 @@ krb5_get_init_creds_password(krb5_context context,
|
|||||||
prompt.reply = &password_data;
|
prompt.reply = &password_data;
|
||||||
|
|
||||||
ret = (*prompter) (context, data, NULL, 1, &prompt);
|
ret = (*prompter) (context, data, NULL, 1, &prompt);
|
||||||
|
free (prompt.prompt);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
memset (buf, 0, sizeof(buf));
|
memset (buf, 0, sizeof(buf));
|
||||||
goto out;
|
goto out;
|
||||||
@@ -324,7 +326,7 @@ krb5_get_init_creds_password(krb5_context context,
|
|||||||
goto out;
|
goto out;
|
||||||
if (prompter)
|
if (prompter)
|
||||||
print_expire (context,
|
print_expire (context,
|
||||||
krb5_princ_realm (context, creds->client),
|
krb5_princ_realm (context, this_cred.client),
|
||||||
&kdc_reply,
|
&kdc_reply,
|
||||||
prompter,
|
prompter,
|
||||||
data);
|
data);
|
||||||
@@ -373,8 +375,10 @@ krb5_get_init_creds_keytab(krb5_context context,
|
|||||||
/* krb5_kdc_rep kdc_reply; */
|
/* krb5_kdc_rep kdc_reply; */
|
||||||
krb5_keytab_entry kt_ent;
|
krb5_keytab_entry kt_ent;
|
||||||
|
|
||||||
ret = get_init_creds_common(context, creds, client, start_time, in_tkt_service, options,
|
ret = get_init_creds_common(context, creds, client, start_time,
|
||||||
&addrs, &etypes, &this_cred, &pre_auth_types);
|
in_tkt_service, options,
|
||||||
|
&addrs, &etypes, &this_cred, &pre_auth_types,
|
||||||
|
&flags);
|
||||||
if(ret)
|
if(ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user