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:
Jacques A. Vidrine
2002-06-20 20:05:42 +00:00
parent 8c571f4920
commit 650d3ee7b7
2 changed files with 28 additions and 6 deletions

View File

@@ -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,

View File

@@ -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,