diff options
Diffstat (limited to 'crypto/heimdal/lib/gssapi/import_name.c')
-rw-r--r-- | crypto/heimdal/lib/gssapi/import_name.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/crypto/heimdal/lib/gssapi/import_name.c b/crypto/heimdal/lib/gssapi/import_name.c index 8ed55f1..2f2ec1a 100644 --- a/crypto/heimdal/lib/gssapi/import_name.c +++ b/crypto/heimdal/lib/gssapi/import_name.c @@ -33,7 +33,7 @@ #include "gssapi_locl.h" -RCSID("$Id: import_name.c,v 1.10 2001/05/11 09:16:46 assar Exp $"); +RCSID("$Id: import_name.c,v 1.11 2002/06/20 20:05:42 nectar Exp $"); static OM_uint32 import_krb5_name (OM_uint32 *minor_status, @@ -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, |