/*
- * 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.
*/
+/*
+ * Function for converting mechanism error codes to strings.
+ */
+
#include "gssapiP_eap.h"
static GSSEAP_THREAD_ONCE gssEapStatusInfoKeyOnce = GSSEAP_ONCE_INITIALIZER;
p->code = minor;
p->message = message;
- if (p != NULL)
+ if (next != NULL)
*next = p;
else
GSSEAP_SETSPECIFIC(gssEapStatusInfoKey, p);
OM_uint32 *message_context,
gss_buffer_t status_string)
{
- OM_uint32 major = GSS_S_COMPLETE;
+ OM_uint32 major;
krb5_context krbContext = NULL;
const char *errMsg;
status_string->value = NULL;
if (!gssEapIsMechanismOid(mech_type)) {
+ *minor = GSSEAP_WRONG_MECH;
return GSS_S_BAD_MECH;
}
if (status_type != GSS_C_MECH_CODE) {
/* we rely on the mechglue for GSS_C_GSS_CODE */
+ *minor = 0;
return GSS_S_BAD_STATUS;
}
errMsg = krb5_get_error_message(krbContext, status_value);
}
- if (errMsg != NULL)
+ if (errMsg != NULL) {
major = makeStringBuffer(minor, errMsg, status_string);
+ } else {
+ major = GSS_S_COMPLETE;
+ *minor = 0;
+ }
if (krbContext != NULL)
krb5_free_error_message(krbContext, errMsg);