/*
- * Copyright (c) 2011, JANET(UK)
+ * Copyright (c) 2011, 2015, JANET(UK)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "gssapiP_eap.h"
+extern int wpa_debug_level;
+
static OM_uint32
eapPeerRegisterMethods(OM_uint32 *minor)
{
static OM_uint32
gssEapInitLibEap(OM_uint32 *minor)
{
+ char *debug_file = NULL;
+ wpa_debug_level = MSG_ERROR;
+ if ((debug_file = getenv("GSSEAP_TRACE")) != NULL) {
+ wpa_debug_open_file(debug_file);
+ wpa_debug_level = 0;
+ }
+
return eapPeerRegisterMethods(minor);
}
void
gssEapFinalize(void);
+ /* Debugging and tracing*/
+ #define gssEapTrace(_fmt, ...) wpa_printf(MSG_INFO, _fmt, __VA_ARGS__);
+
+static inline void
+gssEapTraceStatus(const char *function,
+ OM_uint32 major, OM_uint32 minor)
+{
+ gss_buffer_desc gss_code_buf, mech_buf;
+ OM_uint32 tmpmaj, tmpmin, ctx = 0;
+ gss_code_buf.value = NULL;
+ mech_buf.value = NULL;
+ tmpmaj = gss_display_status(&tmpmin, major,
+ GSS_C_GSS_CODE, GSS_C_NO_OID, &ctx,
+ &gss_code_buf);
+ if (!GSS_ERROR(tmpmaj)) {
+if (minor == 0)
+ tmpmaj = makeStringBuffer(&tmpmin, "no minor", &mech_buf);
+else tmpmaj = gssEapDisplayStatus(&tmpmin, minor, &mech_buf);
+}
+ if (!GSS_ERROR(tmpmaj))
+ wpa_printf(MSG_INFO, "%s: %.*s/%.*s",
+ function, (int) gss_code_buf.length, (char *) gss_code_buf.value,
+ (int) mech_buf.length, (char *) mech_buf.value);
+ else wpa_printf(MSG_INFO, "%s: %u/%u",
+ function, major, minor);
+ tmpmaj = gss_release_buffer(&tmpmin, &gss_code_buf);
+ tmpmaj = gss_release_buffer(&tmpmin, &mech_buf);
+ }
+
/*If built as a library on Linux, don't respect environment when set*uid*/
#ifdef HAVE_SECURE_GETENV
peerNotifyPending,
};
-extern int wpa_debug_level;
#define CHBIND_SERVICE_NAME_FLAG 0x01
#define CHBIND_HOST_NAME_FLAG 0x02
gss_buffer_desc identity = GSS_C_EMPTY_BUFFER;
gss_buffer_desc realm = GSS_C_EMPTY_BUFFER;
gss_cred_id_t cred = ctx->cred;
- char *debug_file = NULL;
eapPeerConfig->identity = NULL;
eapPeerConfig->identity_len = 0;
GSSEAP_KRB_INIT(&krbContext);
eapPeerConfig->fragment_size = 1024;
- wpa_debug_level = MSG_ERROR;
- if ((debug_file = getenv("GSSEAP_TRACE")) != NULL) {
- wpa_debug_open_file(debug_file);
- wpa_debug_level = 0;
- }
GSSEAP_ASSERT(cred->name != GSS_C_NO_NAME);
if (GSS_ERROR(major))
gssEapReleaseContext(&tmpMinor, context_handle);
+ gssEapTraceStatus( "gss_init_sec_context", major, *minor);
return major;
}