gssapi: ntlm mech should use _gss_ntlm_copy_cred() to dup cred
This commit is contained in:

committed by
Nico Williams

parent
e787bd1bc1
commit
57df2ff1cc
@@ -49,25 +49,9 @@ _gss_ntlm_duplicate_cred(OM_uint32 *minor_status,
|
||||
NULL);
|
||||
|
||||
*output_cred_handle = GSS_C_NO_CREDENTIAL;
|
||||
if ((new_cred = calloc(1, sizeof(*new_cred))) == NULL) {
|
||||
*minor_status = ENOMEM;
|
||||
return GSS_S_FAILURE;
|
||||
}
|
||||
|
||||
new_cred->usage = cred->usage;
|
||||
new_cred->username = strdup(cred->username);
|
||||
new_cred->domain = strdup(cred->domain);
|
||||
new_cred->key.data = malloc(cred->key.length);
|
||||
if (new_cred->username == NULL || new_cred->domain == NULL ||
|
||||
new_cred->key.data == NULL) {
|
||||
*output_cred_handle = (gss_cred_id_t) new_cred;
|
||||
_gss_ntlm_release_cred(&junk, output_cred_handle);
|
||||
*minor_status = ENOMEM;
|
||||
return GSS_S_FAILURE;
|
||||
}
|
||||
|
||||
memcpy(new_cred->key.data, cred->key.data, cred->key.length);
|
||||
new_cred->key.length = cred->key.length;
|
||||
*output_cred_handle = (gss_cred_id_t) new_cred;
|
||||
return GSS_S_COMPLETE;
|
||||
*minor_status = _gss_ntlm_copy_cred((ntlm_cred)input_cred_handle,
|
||||
(ntlm_cred *)output_cred_handle);
|
||||
|
||||
return *minor_status == 0 ? GSS_S_COMPLETE : GSS_S_FAILURE;
|
||||
}
|
||||
|
@@ -215,12 +215,13 @@ _gss_ntlm_get_user_cred(const ntlm_name target_name,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
_gss_copy_cred(ntlm_cred from, ntlm_cred *to)
|
||||
int
|
||||
_gss_ntlm_copy_cred(ntlm_cred from, ntlm_cred *to)
|
||||
{
|
||||
*to = calloc(1, sizeof(**to));
|
||||
if (*to == NULL)
|
||||
return ENOMEM;
|
||||
(*to)->usage = from->usage;
|
||||
(*to)->username = strdup(from->username);
|
||||
if ((*to)->username == NULL) {
|
||||
free(*to);
|
||||
@@ -289,7 +290,7 @@ _gss_ntlm_init_sec_context
|
||||
|
||||
if (initiator_cred_handle != GSS_C_NO_CREDENTIAL) {
|
||||
ntlm_cred cred = (ntlm_cred)initiator_cred_handle;
|
||||
ret = _gss_copy_cred(cred, &ctx->client);
|
||||
ret = _gss_ntlm_copy_cred(cred, &ctx->client);
|
||||
} else
|
||||
ret = _gss_ntlm_get_user_cred(name, &ctx->client);
|
||||
|
||||
|
Reference in New Issue
Block a user