From 8e3e9cccdc3251abeb806110530564c9f576be5b Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Thu, 15 Sep 2011 01:23:42 +1000 Subject: [PATCH] Windows acceptor build fixes Windows will require C++ clean FreeRADIUS headers another Windows acceptor-side fix Conflicts: moonshot/mech_eap/util.h --- mech_eap/gssapiP_eap.h | 4 ++++ mech_eap/util.h | 10 +++++++--- mech_eap/util_attr.cpp | 5 +++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/mech_eap/gssapiP_eap.h b/mech_eap/gssapiP_eap.h index fb6d73e..b2271d8 100644 --- a/mech_eap/gssapiP_eap.h +++ b/mech_eap/gssapiP_eap.h @@ -93,8 +93,10 @@ typedef const gss_OID_desc *gss_const_OID; /* FreeRADIUS headers */ #ifdef __cplusplus extern "C" { +#ifndef WIN32 #define operator fr_operator #endif +#endif #include #include @@ -104,7 +106,9 @@ extern "C" { #include #include #ifdef __cplusplus +#ifndef WIN32 #undef operator +#endif } #endif #endif /* GSSEAP_ENABLE_ACCEPTOR */ diff --git a/mech_eap/util.h b/mech_eap/util.h index ae83923..1ebc452 100644 --- a/mech_eap/util.h +++ b/mech_eap/util.h @@ -776,25 +776,27 @@ verifyTokenHeader(OM_uint32 *minor, #include -#define GSSEAP_GET_LAST_ERROR() (GetLastError()) +#define GSSEAP_GET_LAST_ERROR() (GetLastError()) /* XXX FIXME */ #define GSSEAP_MUTEX CRITICAL_SECTION #define GSSEAP_MUTEX_INIT(m) (InitializeCriticalSection((m)), 0) #define GSSEAP_MUTEX_DESTROY(m) DeleteCriticalSection((m)) #define GSSEAP_MUTEX_LOCK(m) EnterCriticalSection((m)) #define GSSEAP_MUTEX_UNLOCK(m) LeaveCriticalSection((m)) +#define GSSEAP_ONCE_LEAVE do { return TRUE; } while (0) /* Thread-local is handled separately */ #define GSSEAP_THREAD_ONCE INIT_ONCE -#define GSSEAP_ONCE(o, i) InitOnceExecuteOnce((o), (i)) +#define GSSEAP_ONCE_CALLBACK(cb) BOOL CALLBACK cb(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context) +#define GSSEAP_ONCE(o, i) InitOnceExecuteOnce((o), (i), NULL, NULL) #define GSSEAP_ONCE_INITIALIZER INIT_ONCE_STATIC_INIT #else #include -#define GSSEAP_GET_LAST_ERROR() (errno) +#define GSSEAP_GET_LAST_ERROR() (errno) #define GSSEAP_MUTEX pthread_mutex_t #define GSSEAP_MUTEX_INIT(m) pthread_mutex_init((m), NULL) @@ -808,8 +810,10 @@ verifyTokenHeader(OM_uint32 *minor, #define GSSEAP_SETSPECIFIC(k, d) pthread_setspecific((k), (d)) #define GSSEAP_THREAD_ONCE pthread_once_t +#define GSSEAP_ONCE_CALLBACK(cb) void cb(void) #define GSSEAP_ONCE(o, i) pthread_once((o), (i)) #define GSSEAP_ONCE_INITIALIZER PTHREAD_ONCE_INIT +#define GSSEAP_ONCE_LEAVE do { } while (0) #endif /* WIN32 */ diff --git a/mech_eap/util_attr.cpp b/mech_eap/util_attr.cpp index 9496863..d24615d 100644 --- a/mech_eap/util_attr.cpp +++ b/mech_eap/util_attr.cpp @@ -46,8 +46,7 @@ static GSSEAP_THREAD_ONCE gssEapAttrProvidersInitOnce = GSSEAP_ONCE_INITIALIZER; static OM_uint32 gssEapAttrProvidersInitStatus = GSS_S_UNAVAILABLE; -static void -gssEapAttrProvidersInitInternal(void) +GSSEAP_ONCE_CALLBACK(gssEapAttrProvidersInitInternal) { OM_uint32 major, minor; @@ -74,6 +73,8 @@ cleanup: #endif gssEapAttrProvidersInitStatus = major; + + GSSEAP_ONCE_LEAVE; } static OM_uint32 -- 2.1.4