X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=moonshot%2Fmech_eap%2Fdisplay_status.c;h=fc0d1abf4523f59cc99dd2ac8e26affb5f755dc3;hb=57ca7c37e90acbcd8da6d215dc4f3c0edd7a88e5;hp=e826b198f48fb6ee8ab90544eb45160e89879408;hpb=ecf20954105d5ac0b7a47bd4932c2dacc1a96e3e;p=moonshot.git diff --git a/moonshot/mech_eap/display_status.c b/moonshot/mech_eap/display_status.c index e826b19..fc0d1ab 100644 --- a/moonshot/mech_eap/display_status.c +++ b/moonshot/mech_eap/display_status.c @@ -64,7 +64,7 @@ gssEapDestroyStatusInfo(struct gss_eap_status_info *p) static void saveStatusInfoNoCopy(OM_uint32 minor, char *message) { - struct gss_eap_status_info **next = NULL, *p=NULL; + struct gss_eap_status_info **next = NULL, *p = NULL; struct gss_eap_thread_local_data *tld = gssEapGetThreadLocalData(); if (tld != NULL) { @@ -108,13 +108,28 @@ getStatusInfo(OM_uint32 minor) return p->message; } } - return NULL; } void gssEapSaveStatusInfo(OM_uint32 minor, const char *format, ...) { +#ifdef WIN32 + OM_uint32 tmpMajor, tmpMinor; + char buf[BUFSIZ]; + gss_buffer_desc s = GSS_C_EMPTY_BUFFER; + va_list ap; + + if (format != NULL) { + va_start(ap, format); + snprintf(buf, sizeof(buf), format, ap); + va_end(ap); + } + + tmpMajor = makeStringBuffer(&tmpMinor, buf, &s); + if (!GSS_ERROR(tmpMajor)) + saveStatusInfoNoCopy(minor, (char *)s.value); +#else char *s = NULL; int n; va_list ap; @@ -128,15 +143,13 @@ gssEapSaveStatusInfo(OM_uint32 minor, const char *format, ...) } saveStatusInfoNoCopy(minor, s); +#endif /* WIN32 */ } -OM_uint32 GSSAPI_CALLCONV -gss_display_status(OM_uint32 *minor, - OM_uint32 status_value, - int status_type, - gss_OID mech_type, - OM_uint32 *message_context, - gss_buffer_t status_string) +OM_uint32 +gssEapDisplayStatus(OM_uint32 *minor, + OM_uint32 status_value, + gss_buffer_t status_string) { OM_uint32 major; krb5_context krbContext = NULL; @@ -145,18 +158,6 @@ gss_display_status(OM_uint32 *minor, status_string->length = 0; status_string->value = NULL; - if (!gssEapIsMechanismOid(mech_type)) { - *minor = GSSEAP_WRONG_MECH; - return GSS_S_BAD_MECH; - } - - if (status_type != GSS_C_MECH_CODE || - *message_context != 0) { - /* we rely on the mechglue for GSS_C_GSS_CODE */ - *minor = 0; - return GSS_S_BAD_STATUS; - } - errMsg = getStatusInfo(status_value); if (errMsg == NULL) { GSSEAP_KRB_INIT(&krbContext); @@ -177,3 +178,26 @@ gss_display_status(OM_uint32 *minor, return major; } + +OM_uint32 GSSAPI_CALLCONV +gss_display_status(OM_uint32 *minor, + OM_uint32 status_value, + int status_type, + gss_OID mech_type, + OM_uint32 *message_context, + gss_buffer_t status_string) +{ + if (!gssEapIsMechanismOid(mech_type)) { + *minor = GSSEAP_WRONG_MECH; + return GSS_S_BAD_MECH; + } + + if (status_type != GSS_C_MECH_CODE || + *message_context != 0) { + /* we rely on the mechglue for GSS_C_GSS_CODE */ + *minor = 0; + return GSS_S_BAD_STATUS; + } + + return gssEapDisplayStatus(minor, status_value, status_string); +}