From: Kevin Wasserman Date: Mon, 20 Jun 2011 23:42:14 +0000 (-0400) Subject: Changes testing for WIN32 to HAVE_*_H macros, changed how inline is defined on Windows X-Git-Tag: tr-beta1~106^2~19 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=moonshot.git;a=commitdiff_plain;h=6f480837e14d67a847aaffc01052507eec76e52a Changes testing for WIN32 to HAVE_*_H macros, changed how inline is defined on Windows Also added the Windows version of config.h and a copy of et/com_err.h (from Linux) to be used by files generated with compile_et. DO NOT COMMIT --- diff --git a/moonshot/mech_eap/gssapiP_eap.h b/moonshot/mech_eap/gssapiP_eap.h index 372737a..e843696 100644 --- a/moonshot/mech_eap/gssapiP_eap.h +++ b/moonshot/mech_eap/gssapiP_eap.h @@ -42,13 +42,13 @@ #include #include #include -#if !defined(WIN32) +#if defined(HAVE_UNISTD_H) #include #endif #include #include #include -#if !defined(WIN32) +#if defined(HAVE_SYS_PARAM_H) #include #endif diff --git a/moonshot/mech_eap/util.h b/moonshot/mech_eap/util.h index 17539a7..61635bf 100644 --- a/moonshot/mech_eap/util.h +++ b/moonshot/mech_eap/util.h @@ -61,7 +61,7 @@ #ifndef _UTIL_H_ #define _UTIL_H_ 1 -#if !defined(WIN32) +#if defined(HAVE_SYS_PARAM_H) #include #endif #include @@ -69,14 +69,21 @@ #include +///#if defined(HAVE_STDINT_H) +///#include +///#endif + +///#if defined(WIN32) +///#define INLINE __inline +///#else +///#define INLINE inline +///#endif + #if defined(WIN32) -#define INLINE __inline -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -#else -#define INLINE inline +#define inline __inline #endif + #ifdef __cplusplus extern "C" { #endif @@ -107,14 +114,14 @@ duplicateBuffer(OM_uint32 *minor, const gss_buffer_t src, gss_buffer_t dst); -static INLINE int +static inline int bufferEqual(const gss_buffer_t b1, const gss_buffer_t b2) { return (b1->length == b2->length && memcmp(b1->value, b2->value, b2->length) == 0); } -static INLINE int +static inline int bufferEqualString(const gss_buffer_t b1, const char *s) { gss_buffer_desc b2; @@ -538,7 +545,7 @@ duplicateOidSet(OM_uint32 *minor, const gss_OID_set src, gss_OID_set *dst); -static INLINE int +static inline int oidEqual(const gss_OID_desc *o1, const gss_OID_desc *o2) { if (o1 == GSS_C_NO_OID) @@ -709,7 +716,7 @@ verifyTokenHeader(OM_uint32 *minor, #define GSSEAP_ONCE_INITIALIZER PTHREAD_ONCE_INIT /* Helper functions */ -static INLINE void +static inline void store_uint16_be(uint16_t val, void *vp) { unsigned char *p = (unsigned char *)vp; @@ -718,7 +725,7 @@ store_uint16_be(uint16_t val, void *vp) p[1] = (val ) & 0xff; } -static INLINE uint16_t +static inline uint16_t load_uint16_be(const void *cvp) { const unsigned char *p = (const unsigned char *)cvp; @@ -726,7 +733,7 @@ load_uint16_be(const void *cvp) return (p[1] | (p[0] << 8)); } -static INLINE void +static inline void store_uint32_be(uint32_t val, void *vp) { unsigned char *p = (unsigned char *)vp; @@ -737,7 +744,7 @@ store_uint32_be(uint32_t val, void *vp) p[3] = (val ) & 0xff; } -static INLINE uint32_t +static inline uint32_t load_uint32_be(const void *cvp) { const unsigned char *p = (const unsigned char *)cvp; @@ -747,7 +754,7 @@ load_uint32_be(const void *cvp) | ((uint32_t) p[0] << 24)); } -static INLINE void +static inline void store_uint64_be(uint64_t val, void *vp) { unsigned char *p = (unsigned char *)vp; @@ -762,7 +769,7 @@ store_uint64_be(uint64_t val, void *vp) p[7] = (unsigned char)((val ) & 0xff); } -static INLINE uint64_t +static inline uint64_t load_uint64_be(const void *cvp) { const unsigned char *p = (const unsigned char *)cvp; @@ -770,7 +777,7 @@ load_uint64_be(const void *cvp) return ((uint64_t)load_uint32_be(p) << 32) | load_uint32_be(p + 4); } -static INLINE unsigned char * +static inline unsigned char * store_buffer(gss_buffer_t buffer, void *vp, int wide_nums) { unsigned char *p = (unsigned char *)vp; @@ -791,7 +798,7 @@ store_buffer(gss_buffer_t buffer, void *vp, int wide_nums) return p; } -static INLINE unsigned char * +static inline unsigned char * load_buffer(const void *cvp, size_t length, gss_buffer_t buffer) { buffer->length = 0; @@ -803,7 +810,7 @@ load_buffer(const void *cvp, size_t length, gss_buffer_t buffer) return (unsigned char *)cvp + length; } -static INLINE unsigned char * +static inline unsigned char * store_oid(gss_OID oid, void *vp) { gss_buffer_desc buf; @@ -819,14 +826,14 @@ store_oid(gss_OID oid, void *vp) return store_buffer(&buf, vp, FALSE); } -static INLINE void +static inline void krbDataToGssBuffer(krb5_data *data, gss_buffer_t buffer) { buffer->value = (void *)data->data; buffer->length = data->length; } -static INLINE void +static inline void krbPrincComponentToGssBuffer(krb5_principal krbPrinc, int index, gss_buffer_t buffer) { @@ -839,7 +846,7 @@ krbPrincComponentToGssBuffer(krb5_principal krbPrinc, #endif /* HAVE_HEIMDAL_VERSION */ } -static INLINE void +static inline void krbPrincRealmToGssBuffer(krb5_principal krbPrinc, gss_buffer_t buffer) { #ifdef HAVE_HEIMDAL_VERSION @@ -850,7 +857,7 @@ krbPrincRealmToGssBuffer(krb5_principal krbPrinc, gss_buffer_t buffer) #endif } -static INLINE void +static inline void gssBufferToKrbData(gss_buffer_t buffer, krb5_data *data) { data->data = (char *)buffer->value; diff --git a/moonshot/mech_eap/win32/config.h b/moonshot/mech_eap/win32/config.h new file mode 100644 index 0000000..f28a0cf --- /dev/null +++ b/moonshot/mech_eap/win32/config.h @@ -0,0 +1,111 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Define if GSS-API library supports recent naming extensions draft */ +/* #undef HAVE_GSS_C_NT_COMPOSITE_EXPORT */ + +/* Define if GSS-API library supports RFC 5587 */ +#define HAVE_GSS_INQUIRE_ATTRS_FOR_MECH 1 + +/* Define if GSS-API library supports gss_krb5_import_cred */ +#define HAVE_GSS_KRB5_IMPORT_CRED 1 + +/* Define if building against Heimdal Kerberos implementation */ +/* #undef HAVE_HEIMDAL_VERSION */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_INTTYPES_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +/* NOT present natively, but emulated under mech_eap/win32 */ +/////#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STRINGS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_PARAM_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UNISTD_H */ + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "mech_eap" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "bugs@project-moonshot.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "mech_eap" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "mech_eap 0.1" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "mech_eap" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.1" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Version number of package */ +#define VERSION "0.1" + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ diff --git a/moonshot/mech_eap/win32/et/com_err.h b/moonshot/mech_eap/win32/et/com_err.h new file mode 100644 index 0000000..a49c5a5 --- /dev/null +++ b/moonshot/mech_eap/win32/et/com_err.h @@ -0,0 +1,60 @@ +/* + * Header file for common error description library. + * + * Copyright 1988, Student Information Processing Board of the + * Massachusetts Institute of Technology. + * + * For copyright and distribution info, see the documentation supplied + * with this package. + */ + +#if !defined(__COM_ERR_H) && !defined(__COM_ERR_H__) + +#ifdef __GNUC__ +#define COM_ERR_ATTR(x) __attribute__(x) +#else +#define COM_ERR_ATTR(x) +#endif + +#include + +typedef long errcode_t; + +struct error_table { + char const * const * msgs; + long base; + int n_msgs; +}; +struct et_list; + +extern void com_err (const char *, long, const char *, ...) + COM_ERR_ATTR((format(printf, 3, 4))); + +extern void com_err_va (const char *whoami, errcode_t code, const char *fmt, + va_list args) + COM_ERR_ATTR((format(printf, 3, 0))); + +extern char const *error_message (long); +extern void (*com_err_hook) (const char *, long, const char *, va_list); +extern void (*set_com_err_hook (void (*) (const char *, long, + const char *, va_list))) + (const char *, long, const char *, va_list); +extern void (*reset_com_err_hook (void)) (const char *, long, + const char *, va_list); +extern int init_error_table(const char * const *msgs, long base, int count); + +extern errcode_t add_error_table(const struct error_table * et); +extern errcode_t remove_error_table(const struct error_table * et); +extern void add_to_error_table(struct et_list *new_table); + +/* Provided for Heimdall compatibility */ +extern const char *com_right(struct et_list *list, long code); +extern void initialize_error_table_r(struct et_list **list, + const char **messages, + int num_errors, + long base); +extern void free_error_table(struct et_list *et); + +#define __COM_ERR_H +#define __COM_ERR_H__ +#endif /* !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)*/