/*
- * 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.
*/
-#include "gssapiP_eap.h"
-
-struct eap_gss_attribute_args {
- gss_buffer_t prefix;
- gss_buffer_set_t attrs;
-};
-
/*
- * The purpose of this callback interface is to not expose the attribute
- * prefixes to the attribute providers themselves.
+ * Enumerate name attributes.
*/
-static OM_uint32
-addAttribute(OM_uint32 *minor,
- void *data,
- gss_buffer_t attribute)
-{
- struct eap_gss_attribute_args *args = (struct eap_gss_attribute_args *)data;
- OM_uint32 major, tmpMinor;
- gss_buffer_desc qualifiedAttr;
-
- if (attribute != GSS_C_NO_BUFFER) {
- major = composeAttributeName(minor, args->prefix, attribute, &qualifiedAttr);
- if (GSS_ERROR(major))
- return major;
- major = gss_add_buffer_set_member(minor, &qualifiedAttr, &args->attrs);
-
- gss_release_buffer(&tmpMinor, &qualifiedAttr);
- } else {
- major = gss_add_buffer_set_member(minor, args->prefix, &args->attrs);
- }
-
- return major;
-}
+#include "gssapiP_eap.h"
OM_uint32 gss_inquire_name(OM_uint32 *minor,
gss_name_t name,
gss_buffer_set_t *attrs)
{
OM_uint32 major, tmpMinor;
- krb5_context krbContext;
- struct eap_gss_attribute_args args;
- *name_is_MN = 1;
- *MN_mech = GSS_EAP_MECHANISM;
- *attrs = GSS_C_NO_BUFFER_SET;
+ *minor = 0;
+
+ if (name_is_MN != NULL)
+ *name_is_MN = 0;
+ if (MN_mech != NULL)
+ *MN_mech = GSS_C_NO_OID;
+ if (attrs != NULL)
+ *attrs = GSS_C_NO_BUFFER_SET;
if (name == GSS_C_NO_NAME) {
*minor = EINVAL;
return GSS_S_CALL_INACCESSIBLE_READ | GSS_S_BAD_NAME;
}
- GSSEAP_KRB_INIT(&krbContext);
GSSEAP_MUTEX_LOCK(&name->mutex);
- major = gss_create_empty_buffer_set(minor, attrs);
- if (GSS_ERROR(major))
- goto cleanup;
-
- args.attrs = *attrs;
-
- if (name->assertion != NULL) {
- args.prefix = gssEapAttributeTypeToPrefix(ATTR_TYPE_SAML_AAA_ASSERTION);
-
- major = addAttribute(minor, &args, GSS_C_NO_BUFFER);
- if (GSS_ERROR(major))
- goto cleanup;
-
- args.prefix = gssEapAttributeTypeToPrefix(ATTR_TYPE_SAML_ATTR);
- major = samlGetAttributeTypes(minor, name->assertion, &args, addAttribute);
- if (GSS_ERROR(major))
- goto cleanup;
- }
-
- if (name->avps != NULL) {
- args.prefix = gssEapAttributeTypeToPrefix(ATTR_TYPE_RADIUS_AVP);
- major = radiusGetAttributeTypes(minor, name->avps, &args, addAttribute);
- if (GSS_ERROR(major))
- goto cleanup;
- }
+ major = gssEapInquireName(minor, name, name_is_MN, MN_mech, attrs);
-cleanup:
GSSEAP_MUTEX_UNLOCK(&name->mutex);
if (GSS_ERROR(major))