Windows acceptor build fixes
authorLuke Howard <lukeh@padl.com>
Wed, 14 Sep 2011 15:23:42 +0000 (01:23 +1000)
committerLuke Howard <lukeh@padl.com>
Wed, 14 Sep 2011 15:23:42 +0000 (01:23 +1000)
Windows will require C++ clean FreeRADIUS headers

another Windows acceptor-side fix

Conflicts:

moonshot/mech_eap/util.h

mech_eap/gssapiP_eap.h
mech_eap/util.h
mech_eap/util_attr.cpp

index fb6d73e..b2271d8 100644 (file)
@@ -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 <freeradius/libradius.h>
 #include <freeradius/radius.h>
 
@@ -104,7 +106,9 @@ extern "C" {
 #include <radsec/radsec.h>
 #include <radsec/request.h>
 #ifdef __cplusplus
+#ifndef WIN32
 #undef operator
+#endif
 }
 #endif
 #endif /* GSSEAP_ENABLE_ACCEPTOR */
index ae83923..1ebc452 100644 (file)
@@ -776,25 +776,27 @@ verifyTokenHeader(OM_uint32 *minor,
 
 #include <winbase.h>
 
-#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 <pthread.h>
 
-#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 */
 
index 9496863..d24615d 100644 (file)
@@ -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