Add mod_auth_gssapi.h
authorSimo Sorce <simo@redhat.com>
Thu, 10 Jul 2014 09:43:55 +0000 (05:43 -0400)
committerSimo Sorce <simo@redhat.com>
Thu, 10 Jul 2014 10:40:00 +0000 (06:40 -0400)
Move all includes into it and also include config.h which was missing
causing some ifdefed code not to be compiled.
Also address includes conflict between httpd.h and config.h and the
PACKAGE_* variables.

configure.ac
src/mod_auth_gssapi.c
src/mod_auth_gssapi.h [new file with mode: 0644]

index fe3ce9e..aa429f8 100644 (file)
@@ -4,7 +4,7 @@ AC_CONFIG_SRCDIR([src/mod_auth_gssapi.c])
 AM_INIT_AUTOMAKE([-Wall foreign subdir-objects tar-pax])
 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_HEADERS([src/config.h])
 
 # Checks for programs.
 AC_PROG_CC
index 7f4077b..e8c1966 100644 (file)
    DEALINGS IN THE SOFTWARE.
 */
 
-#include <stdbool.h>
-#include <stdint.h>
-#include <gssapi/gssapi.h>
-#include <gssapi/gssapi_ext.h>
-
-#include <httpd.h>
-#include <http_core.h>
-#include <http_connection.h>
-#include <http_log.h>
-#include <http_request.h>
-#include <apr_strings.h>
-#include <apr_base64.h>
+#include "mod_auth_gssapi.h"
 
 module AP_MODULE_DECLARE_DATA auth_gssapi_module;
 
 APR_DECLARE_OPTIONAL_FN(int, ssl_is_https, (conn_rec *));
 
-struct mag_config {
-    bool ssl_only;
-    bool map_to_local;
-    bool gss_conn_ctx;
-    gss_key_value_set_desc cred_store;
-};
-
 static char *mag_status(request_rec *req, int type, uint32_t err)
 {
     uint32_t maj_ret, min_ret;
@@ -243,7 +225,7 @@ static int mag_auth(request_rec *req)
     }
 
 #ifdef HAVE_GSS_STORE_CRED_INTO
-    if (cfg->cred_store && delegated_cred != GSS_C_NO_CREDENTIAL) {
+    if (cfg->cred_store.count != 0 && delegated_cred != GSS_C_NO_CREDENTIAL) {
         gss_key_value_set_desc store = {0, NULL};
         /* FIXME: run substitutions */
 
diff --git a/src/mod_auth_gssapi.h b/src/mod_auth_gssapi.h
new file mode 100644 (file)
index 0000000..2022061
--- /dev/null
@@ -0,0 +1,32 @@
+/* Copyright (C) 2014 mod_auth_gssapi authors - See COPYING for (C) terms */
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <gssapi/gssapi.h>
+#include <gssapi/gssapi_ext.h>
+
+#include <httpd.h>
+#include <http_core.h>
+#include <http_connection.h>
+#include <http_log.h>
+#include <http_request.h>
+#include <apr_strings.h>
+#include <apr_base64.h>
+
+/* apache's httpd.h drags in empty PACKAGE_* variables.
+ * undefine them to avoid annoying compile warnings as they
+ * are re-defined in config.h */
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
+#include "config.h"
+
+struct mag_config {
+    bool ssl_only;
+    bool map_to_local;
+    bool gss_conn_ctx;
+    gss_key_value_set_desc cred_store;
+};
+