assert(gssEapAttrProvidersInitStatus == GSS_S_UNAVAILABLE);
major = gssEapRadiusAttrProviderInit(&minor);
- if (major == GSS_S_COMPLETE)
- major = gssEapSamlAttrProvidersInit(&minor);
- if (major == GSS_S_COMPLETE)
- major = gssEapLocalAttrProviderInit(&minor);
+ if (GSS_ERROR(major))
+ goto cleanup;
+ major = gssEapSamlAttrProvidersInit(&minor);
+ if (GSS_ERROR(major))
+ goto cleanup;
+
+ /* Allow Shibboleth initialization failure to be non-fatal */
+ gssEapLocalAttrProviderInit(&minor);
+
+cleanup:
#ifdef GSSEAP_DEBUG
assert(major == GSS_S_COMPLETE);
#endif
continue;
JSONObject source = sources.get(key);
- if (!source.isnull() &&
+ if (!source.isNull() &&
!provider->initWithJsonObject(this, source)) {
releaseProvider(type);
return false;
}
JSONObject
-gss_eap_attr_ctx::jsonRepresentation(uint32_t flags) const
+gss_eap_attr_ctx::jsonRepresentation(void) const
{
JSONObject obj, sources;
unsigned int i;
gss_eap_attr_provider *provider;
const char *key;
- if (i == ATTR_TYPE_LOCAL &&
- (flags & ATTR_FLAG_DISABLE_LOCAL))
- continue; /* reentrancy workaround */
-
provider = m_providers[i];
if (provider == NULL)
continue; /* provider not initialised */
return false;
JSONObject obj = JSONObject::load(s, 0, &error);
- if (!obj.isnull()) {
+ if (!obj.isNull()) {
ret = initWithJsonObject(obj);
} else
ret = false;
* Export attribute context to buffer
*/
void
-gss_eap_attr_ctx::exportToBuffer(gss_buffer_t buffer,
- uint32_t flags) const
+gss_eap_attr_ctx::exportToBuffer(gss_buffer_t buffer) const
{
OM_uint32 minor;
char *s;
- JSONObject obj = jsonRepresentation(flags);
+ JSONObject obj = jsonRepresentation();
#if 0
- obj.dump(stdout, JSON_INDENT(3));
+ obj.dump(stdout);
#endif
s = obj.dump(JSON_COMPACT);
OM_uint32 major;
/* Errors we handle ourselves */
- major = GSS_S_FAILURE;
-
if (typeid(e) == typeid(std::bad_alloc)) {
*minor = ENOMEM;
goto cleanup;
+ } else if (typeid(e) == typeid(std::runtime_error)) {
+ major = GSS_S_BAD_NAME;
+ *minor = GSSEAP_BAD_ATTR_TOKEN;
+ goto cleanup;
+ } else if (this == NULL) {
+ major = GSS_S_FAILURE;
+ goto cleanup;
}
/* Errors we delegate to providers */
gss_buffer_t display_value,
int *more)
{
- *authenticated = 0;
- *complete = 0;
+ if (authenticated != NULL)
+ *authenticated = 0;
+ if (complete != NULL)
+ *complete = 0;
if (value != NULL) {
value->length = 0;
OM_uint32
gssEapExportAttrContext(OM_uint32 *minor,
gss_name_t name,
- gss_buffer_t buffer,
- OM_uint32 flags)
+ gss_buffer_t buffer)
{
if (name->attrCtx == NULL) {
buffer->length = 0;
return GSS_S_UNAVAILABLE;
try {
- name->attrCtx->exportToBuffer(buffer, flags);
+ name->attrCtx->exportToBuffer(buffer);
} catch (std::exception &e) {
return name->attrCtx->mapException(minor, e);
}
if (!ctx->initFromBuffer(buffer)) {
delete ctx;
*minor = GSSEAP_BAD_ATTR_TOKEN;
- return GSS_S_DEFECTIVE_TOKEN;
+ return GSS_S_BAD_NAME;
}
name->attrCtx = ctx;
} catch (std::exception &e) {