krb5_gss_register_acceptor_identity sets a mutex-locked global (not
thread-specific) variable containing a keytab name. This change
allows the variable to be unset by passing a null value.
A more elegant long-term solution to the problem is Heimdal's
gss_krb5_import_cred function.
ticket: 6758
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24242
dc483132-0cff-0310-8789-
dd5450dbe970
const gss_OID desired_object,
gss_buffer_t value)
{
- char *new, *old;
+ char *new = NULL, *old;
int err;
err = gss_krb5int_initialize_library();
if (err != 0)
return GSS_S_FAILURE;
- if (value->value == NULL)
- return GSS_S_FAILURE;
-
- new = strdup((char *)value->value);
- if (new == NULL)
- return GSS_S_FAILURE;
+ if (value->value != NULL) {
+ new = strdup((char *)value->value);
+ if (new == NULL)
+ return GSS_S_FAILURE;
+ }
err = k5_mutex_lock(&gssint_krb5_keytab_lock);
if (err) {
old = krb5_gss_keytab;
krb5_gss_keytab = new;
k5_mutex_unlock(&gssint_krb5_keytab_lock);
- if (old != NULL)
- free(old);
+ free(old);
return GSS_S_COMPLETE;
}
OM_uint32 minor_status;
gss_buffer_desc req_buffer;
- req_buffer.length = strlen(keytab);
+ req_buffer.length = (keytab == NULL) ? 0 : strlen(keytab);
req_buffer.value = (char *)keytab;
major_status = gssspi_mech_invoke(&minor_status,