From 1cf53a2a7268e5153b6f7f2a928aa1fe7ea285df Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Tue, 13 Sep 2011 14:16:17 +1000 Subject: [PATCH] build without RADIUS-related headers if no acceptor --- mech_eap/Makefile.am | 2 +- mech_eap/gssapiP_eap.h | 10 ++++++++++ mech_eap/import_sec_context.c | 4 ++++ mech_eap/util.h | 2 ++ mech_eap/util_radius.h | 3 --- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/mech_eap/Makefile.am b/mech_eap/Makefile.am index 0214ca0..86b575e 100644 --- a/mech_eap/Makefile.am +++ b/mech_eap/Makefile.am @@ -73,7 +73,6 @@ mech_eap_la_SOURCES = \ store_cred.c \ unwrap.c \ unwrap_iov.c \ - util_base64.c \ util_buffer.c \ util_context.c \ util_cksum.c \ @@ -105,6 +104,7 @@ mech_eap_la_SOURCES += \ release_any_name_mapping.c \ set_name_attribute.c \ util_attr.cpp \ + util_base64.c \ util_json.cpp \ util_radius.cpp diff --git a/mech_eap/gssapiP_eap.h b/mech_eap/gssapiP_eap.h index fcd4bab..b141032 100644 --- a/mech_eap/gssapiP_eap.h +++ b/mech_eap/gssapiP_eap.h @@ -83,6 +83,7 @@ typedef const gss_OID_desc *gss_const_OID; #include /* FreeRADIUS headers */ +#ifdef GSSEAP_ENABLE_ACCEPTOR #ifdef __cplusplus extern "C" { #define operator fr_operator @@ -95,6 +96,7 @@ extern "C" { #undef operator } #endif +#endif /* GSSEAP_ENABLE_ACCEPTOR */ #include "gsseap_err.h" #include "radsec_err.h" @@ -184,6 +186,7 @@ struct gss_eap_initiator_ctx { struct wpabuf reqData; }; +#ifdef GSSEAP_ENABLE_ACCEPTOR struct gss_eap_acceptor_ctx { struct rs_context *radContext; struct rs_connection *radConn; @@ -191,6 +194,7 @@ struct gss_eap_acceptor_ctx { gss_buffer_desc state; VALUE_PAIR *vps; }; +#endif #ifdef HAVE_HEIMDAL_VERSION struct gss_ctx_id_t_desc_struct @@ -215,8 +219,10 @@ struct gss_ctx_id_struct union { struct gss_eap_initiator_ctx initiator; #define initiatorCtx ctxU.initiator +#ifdef GSSEAP_ENABLE_ACCEPTOR struct gss_eap_acceptor_ctx acceptor; #define acceptorCtx ctxU.acceptor +#endif #ifdef GSSEAP_ENABLE_REAUTH gss_ctx_id_t reauth; #define reauthCtx ctxU.reauth @@ -311,6 +317,10 @@ gssEapSaveStatusInfo(OM_uint32 minor, const char *format, ...); #define IS_WIRE_ERROR(err) ((err) > GSSEAP_RESERVED && \ (err) <= GSSEAP_RADIUS_PROT_FAILURE) +/* upper bound of RADIUS error range must be kept in sync with radsec.h */ +#define IS_RADIUS_ERROR(err) ((err) >= ERROR_TABLE_BASE_rse && \ + (err) <= ERROR_TABLE_BASE_rse + 20) + /* export_sec_context.c */ OM_uint32 gssEapExportSecContext(OM_uint32 *minor, diff --git a/mech_eap/import_sec_context.c b/mech_eap/import_sec_context.c index 9d6ae3d..1b9c0ad 100644 --- a/mech_eap/import_sec_context.c +++ b/mech_eap/import_sec_context.c @@ -48,6 +48,7 @@ } \ } while (0) +#ifdef GSSEAP_ENABLE_ACCEPTOR static OM_uint32 gssEapImportPartialContext(OM_uint32 *minor, unsigned char **pBuf, @@ -113,6 +114,7 @@ gssEapImportPartialContext(OM_uint32 *minor, return GSS_S_COMPLETE; } +#endif static OM_uint32 importMechanismOid(OM_uint32 *minor, @@ -304,6 +306,7 @@ gssEapImportContext(OM_uint32 *minor, if (GSS_ERROR(major)) return major; +#ifdef GSSEAP_ENABLE_ACCEPTOR /* * The partial context should only be expected for unestablished * acceptor contexts. @@ -318,6 +321,7 @@ gssEapImportContext(OM_uint32 *minor, #ifdef GSSEAP_DEBUG assert(remain == 0); #endif +#endif major = GSS_S_COMPLETE; *minor = 0; diff --git a/mech_eap/util.h b/mech_eap/util.h index 04fa4b9..905916b 100644 --- a/mech_eap/util.h +++ b/mech_eap/util.h @@ -960,9 +960,11 @@ gssBufferToKrbData(gss_buffer_t buffer, krb5_data *data) } #endif +#ifdef GSSEAP_ENABLE_ACCEPTOR #include "util_json.h" #include "util_attr.h" #include "util_base64.h" +#endif #ifdef GSSEAP_ENABLE_REAUTH #include "util_reauth.h" #endif diff --git a/mech_eap/util_radius.h b/mech_eap/util_radius.h index 04e6fc5..da790ab 100644 --- a/mech_eap/util_radius.h +++ b/mech_eap/util_radius.h @@ -170,9 +170,6 @@ gssEapRadiusMapError(OM_uint32 *minor, #define PW_SAML_AAA_ASSERTION 132 #define PW_MS_WINDOWS_AUTH_DATA 133 -#define IS_RADIUS_ERROR(code) ((code) >= ERROR_TABLE_BASE_rse && \ - (code) <= ERROR_TABLE_BASE_rse + RSE_TIMEOUT_IO) - #ifdef __cplusplus } #endif -- 2.1.4