Compatibility with both Apache 2.2 and 2.4.
authorMark Donnelly <mark@painless-security.com>
Fri, 5 Sep 2014 15:40:44 +0000 (11:40 -0400)
committerMark Donnelly <mark@painless-security.com>
Fri, 5 Sep 2014 15:40:44 +0000 (11:40 -0400)
The ap_log_rerror function has changed the parameters that it accepts between
Apache 2.2 and 2.4.  The gss_log function wraps around ap_log_rerror, so it
needs to deal with the new parameter that was added.

gss.c
gss.h

diff --git a/gss.c b/gss.c
index 9ecee1c..cab10c3 100644 (file)
--- a/gss.c
+++ b/gss.c
 #include "mod_auth_gssapi.h"
 
 void
-gss_log(const char *file, int line, int level, int status,
-        const request_rec *r, const char *fmt, ...)
+gss_log(const char *file, 
+        int line,
+#if AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER == 4
+        int module_index,
+#endif
+        int level,
+        int status,
+        const request_rec *r,
+        const char *fmt, ...)
 {
     char errstr[1024];
     va_list ap;
@@ -42,7 +49,16 @@ gss_log(const char *file, int line, int level, int status,
     vsnprintf(errstr, sizeof(errstr), fmt, ap);
     va_end(ap);
    
-    ap_log_rerror(file, line, level | APLOG_NOERRNO, status, r, "%s", errstr);
+    ap_log_rerror(file,
+                  line, 
+#if AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER == 4
+                  module_index,
+#endif
+                  level | APLOG_NOERRNO, 
+                  status, 
+                  r, 
+                  "%s", 
+                  errstr);
 }
 
 apr_status_t
diff --git a/gss.h b/gss.h
index 4aa2885..4c01355 100644 (file)
--- a/gss.h
+++ b/gss.h
@@ -72,8 +72,15 @@ typedef struct gss_conn_ctx_t {
 } *gss_conn_ctx;
 
 void
-gss_log(const char *file, int line, int level, int status,
-        const request_rec *r, const char *fmt, ...);
+gss_log(const char *file, 
+        int line,
+#if AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER == 4
+        int module_index,
+#endif
+        int level,
+        int status,
+        const request_rec *r,
+        const char *fmt, ...);
 
 apr_status_t
 gss_cleanup_conn_ctx(void *data);