diff options
author | nectar <nectar@FreeBSD.org> | 2002-08-30 21:23:27 +0000 |
---|---|---|
committer | nectar <nectar@FreeBSD.org> | 2002-08-30 21:23:27 +0000 |
commit | a77dba08ca7d8ad2f2dcd653974ac66df78cfa49 (patch) | |
tree | 6015f89700252fb05eb8fa267c46dba41913e9d8 /crypto/heimdal/lib/gssapi/import_name.c | |
parent | 69a91bec14ec3ad49d1c8a82c40a796755f9e4a3 (diff) | |
download | FreeBSD-src-a77dba08ca7d8ad2f2dcd653974ac66df78cfa49.zip FreeBSD-src-a77dba08ca7d8ad2f2dcd653974ac66df78cfa49.tar.gz |
Import of Heimdal Kerberos from KTH repository circa 2002/08/29.
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, |