/*
- * Copyright (c) 2010, JANET(UK)
+ * Copyright (c) 2011, JANET(UK)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* SUCH DAMAGE.
*/
+/*
+ * Compare two names.
+ */
+
#include "gssapiP_eap.h"
OM_uint32
gss_name_t name2,
int *name_equal)
{
- OM_uint32 major;
- krb5_context context;
+ krb5_context krbContext;
+
+ *minor = 0;
+
+ if (name1 == GSS_C_NO_NAME && name2 == GSS_C_NO_NAME) {
+ *name_equal = 1;
+ } else if (name1 != GSS_C_NO_NAME && name2 != GSS_C_NO_NAME) {
+ GSSEAP_KRB_INIT(&krbContext);
+
+ /* krbPrincipal is immutable, so lock not required */
+ *name_equal = krb5_principal_compare(krbContext,
+ name1->krbPrincipal,
+ name2->krbPrincipal);
+ }
- GSSEAP_KRB_INIT(&context);
+ return GSS_S_COMPLETE;
}