Compare name types by value if pointers do
not match. Reported by: "Douglas E. Engert" <deengert@anl.gov> git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11040 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -124,6 +124,17 @@ import_hostbased_name (OM_uint32 *minor_status,
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
oid_equal(const gss_OID a, const gss_OID b)
|
||||
{
|
||||
if (a == b)
|
||||
return 1;
|
||||
else if (a == GSS_C_NO_OID || b == GSS_C_NO_OID || a->length != b->length)
|
||||
return 0;
|
||||
else
|
||||
return memcmp(a->elements, b->elements, a->length) == 0;
|
||||
}
|
||||
|
||||
OM_uint32 gss_import_name
|
||||
(OM_uint32 * minor_status,
|
||||
const gss_buffer_t input_name_buffer,
|
||||
@@ -133,13 +144,13 @@ OM_uint32 gss_import_name
|
||||
{
|
||||
gssapi_krb5_init ();
|
||||
|
||||
if (input_name_type == GSS_C_NT_HOSTBASED_SERVICE)
|
||||
if (oid_equal(input_name_type, GSS_C_NT_HOSTBASED_SERVICE))
|
||||
return import_hostbased_name (minor_status,
|
||||
input_name_buffer,
|
||||
output_name);
|
||||
else if (input_name_type == GSS_C_NO_OID
|
||||
|| input_name_type == GSS_C_NT_USER_NAME
|
||||
|| input_name_type == GSS_KRB5_NT_PRINCIPAL_NAME)
|
||||
|| oid_equal(input_name_type, GSS_C_NT_USER_NAME)
|
||||
|| oid_equal(input_name_type, GSS_KRB5_NT_PRINCIPAL_NAME))
|
||||
/* default printable syntax */
|
||||
return import_krb5_name (minor_status,
|
||||
input_name_buffer,
|
||||
|
@@ -124,6 +124,17 @@ import_hostbased_name (OM_uint32 *minor_status,
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
oid_equal(const gss_OID a, const gss_OID b)
|
||||
{
|
||||
if (a == b)
|
||||
return 1;
|
||||
else if (a == GSS_C_NO_OID || b == GSS_C_NO_OID || a->length != b->length)
|
||||
return 0;
|
||||
else
|
||||
return memcmp(a->elements, b->elements, a->length) == 0;
|
||||
}
|
||||
|
||||
OM_uint32 gss_import_name
|
||||
(OM_uint32 * minor_status,
|
||||
const gss_buffer_t input_name_buffer,
|
||||
@@ -133,13 +144,13 @@ OM_uint32 gss_import_name
|
||||
{
|
||||
gssapi_krb5_init ();
|
||||
|
||||
if (input_name_type == GSS_C_NT_HOSTBASED_SERVICE)
|
||||
if (oid_equal(input_name_type, GSS_C_NT_HOSTBASED_SERVICE))
|
||||
return import_hostbased_name (minor_status,
|
||||
input_name_buffer,
|
||||
output_name);
|
||||
else if (input_name_type == GSS_C_NO_OID
|
||||
|| input_name_type == GSS_C_NT_USER_NAME
|
||||
|| input_name_type == GSS_KRB5_NT_PRINCIPAL_NAME)
|
||||
|| oid_equal(input_name_type, GSS_C_NT_USER_NAME)
|
||||
|| oid_equal(input_name_type, GSS_KRB5_NT_PRINCIPAL_NAME))
|
||||
/* default printable syntax */
|
||||
return import_krb5_name (minor_status,
|
||||
input_name_buffer,
|
||||
|
Reference in New Issue
Block a user