[modauthkerb] Patch to port to Apache 2.4
Brought to you by:
kouril
|
From: Russ A. <rr...@st...> - 2013-06-03 02:13:50
|
In case this helps anyone else, here is a tested patch to mod-auth-kerb
(relative to the Debian package, so I'm not sure if it applies completely
cleanly to the current source) to make the module build against Apache
2.4.
There were two issues: first, the connection->request_ip struct member had
to be changed to the new useragent_ip member, and second, the internal
logging function needed adapting to the new logging parameter in the
current version of Apache. I also switched to the new module declaration
syntax so that the messages from this module would be properly tagged, and
switched the package build system to dh_apache2 (which simplifies a number
of things).
More cleanup is definitely possible; this was an attempt to be minimally
intrusive.
The patch should continue to work with Apache 2.2, although I've not
personally tested. I only tested with SPNEGO authentication, but I see no
reason to believe that Basic authentication wouldn't also work.
--- libapache-mod-auth-kerb-5.4.orig/src/mod_auth_kerb.c
+++ libapache-mod-auth-kerb-5.4/src/mod_auth_kerb.c
@@ -125,10 +125,14 @@
# endif
#endif
-#ifdef STANDARD20_MODULE_STUFF
+#if defined(APLOG_USE_MODULE)
+APLOG_USE_MODULE(auth_kerb);
+#elif defined(STANDARD20_MODULE_STUFF)
module AP_MODULE_DECLARE_DATA auth_kerb_module;
+# define useragent_ip connection->remote_ip
#else
module auth_kerb_module;
+# define useragent_ip connection->remote_ip
#endif
/***************************************************************************
@@ -352,9 +356,14 @@
return NULL;
}
+#ifdef APLOG_USE_MODULE
static void
+log_rerror(const char *file, int line, int module_index, int level, int status,
+ const request_rec *r, const char *fmt, ...)
+#else
log_rerror(const char *file, int line, int level, int status,
const request_rec *r, const char *fmt, ...)
+#endif
{
char errstr[1024];
va_list ap;
@@ -364,7 +373,9 @@
va_end(ap);
-#ifdef STANDARD20_MODULE_STUFF
+#if defined(APLOG_USE_MODULE)
+ ap_log_rerror(file, line, module_index, level, status, r, "%s", errstr);
+#elif defined(STANDARD20_MODULE_STUFF)
ap_log_rerror(file, line, level | APLOG_NOERRNO, status, r, "%s", errstr);
#else
ap_log_rerror(file, line, level | APLOG_NOERRNO, r, "%s", errstr);
@@ -1568,7 +1579,7 @@
char keyname[1024];
snprintf(keyname, sizeof(keyname) - 1,
- "mod_auth_kerb::connection::%s::%ld", r->connection->remote_ip,
+ "mod_auth_kerb::connection::%s::%ld", r->useragent_ip,
r->connection->id);
if (apr_pool_userdata_get((void**)&conn_data, keyname, r->connection->pool) != 0)
@@ -1722,7 +1733,7 @@
prevauth->last_return = ret;
snprintf(keyname, sizeof(keyname) - 1,
"mod_auth_kerb::connection::%s::%ld",
- r->connection->remote_ip, r->connection->id);
+ r->useragent_ip, r->connection->id);
apr_pool_userdata_set(prevauth, keyname, NULL, r->connection->pool);
}
--
Russ Allbery (rr...@st...) <http://www.eyrie.org/~eagle/>
|