X-Git-Url: http://www.project-moonshot.org/gitweb/?p=mech_eap.git;a=blobdiff_plain;f=util_attr.cpp;h=28065ac13c7277077a920e690a33b232d31c3678;hp=52da7cfb7e4ddff4261018dc0e27f5eae074776b;hb=ae79fdae047f980d01b2b4e84ccea52e24d8c7a0;hpb=1823f8461cffc018f8c802c7659499b5b5470136 diff --git a/util_attr.cpp b/util_attr.cpp index 52da7cf..28065ac 100644 --- a/util_attr.cpp +++ b/util_attr.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, JANET(UK) + * Copyright (c) 2011, JANET(UK) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -425,7 +425,7 @@ struct eap_gss_get_attr_types_args { }; static bool -addAttribute(const gss_eap_attr_provider *provider, +addAttribute(const gss_eap_attr_provider *provider GSSEAP_UNUSED, const gss_buffer_t attribute, void *data) { @@ -760,8 +760,8 @@ gss_eap_attr_ctx::composeAttributeName(unsigned int type, OM_uint32 gssEapInquireName(OM_uint32 *minor, gss_name_t name, - int *name_is_MN, - gss_OID *MN_mech, + int *name_is_MN GSSEAP_UNUSED, + gss_OID *MN_mech GSSEAP_UNUSED, gss_buffer_set_t *attrs) { if (name->attrCtx == NULL) { @@ -1029,6 +1029,7 @@ gssEapReleaseAttrContext(OM_uint32 *minor, if (name->attrCtx != NULL) delete name->attrCtx; + *minor = 0; return GSS_S_COMPLETE; } @@ -1043,7 +1044,7 @@ gssEapCreateAttrContext(OM_uint32 *minor, struct gss_eap_attr_ctx **pAttrContext, time_t *pExpiryTime) { - gss_eap_attr_ctx *ctx; + gss_eap_attr_ctx *ctx = NULL; OM_uint32 major; assert(gssCtx != GSS_C_NO_CONTEXT); @@ -1052,22 +1053,26 @@ gssEapCreateAttrContext(OM_uint32 *minor, if (GSS_ERROR(major)) return major; + *minor = GSSEAP_ATTR_CONTEXT_FAILURE; + major = GSS_S_FAILURE; + try { ctx = new gss_eap_attr_ctx(); - if (!ctx->initFromGssContext(gssCred, gssCtx)) { + if (ctx->initFromGssContext(gssCred, gssCtx)) { + *minor = 0; + major = GSS_S_COMPLETE; + } else { delete ctx; - *minor = GSSEAP_ATTR_CONTEXT_FAILURE; - return GSS_S_FAILURE; } } catch (std::exception &e) { - major = ctx->mapException(minor, e); - delete ctx; - return major; + if (ctx != NULL) + major = ctx->mapException(minor, e); } - *pAttrContext = ctx; - *pExpiryTime = ctx->getExpiryTime(); + if (major == GSS_S_COMPLETE) { + *pAttrContext = ctx; + *pExpiryTime = ctx->getExpiryTime(); + } - *minor = 0; - return GSS_S_COMPLETE; + return major; }