You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ka...@apache.org on 2011/03/02 15:47:35 UTC
svn commit: r1076234 -
/subversion/trunk/subversion/mod_authz_svn/mod_authz_svn.c
Author: kameshj
Date: Wed Mar 2 14:47:34 2011
New Revision: 1076234
URL: http://svn.apache.org/viewvc?rev=1076234&view=rev
Log:
Update log_access_verdict to make it work with HTTPD 2.3.x as well as older
server versions with reference to [1]. The function is being called
with APLOG_MARK in few places. The macro APLOG_MARK expands to 2 arguments
till HTTPD-2.2.x but 3 arguments in HTTPD-2.3-dev, which causes failure
while compiling with HTTPD-2.3-dev. So we need to handle both the cases.
case 1 HTTPD 2.3:
----------------
1.APLOG_USE_MODULE is used to indirectly set APLOG_MODULE_INDEX and APLOG_MARK.
2.The macros LOG_ARGS_SIGNATURE and LOG_ARGS_CASCADE are expanded as formal and
actual arguments to log_access_verdict with respect to APLOG_MARK which has
one additonal parameter module_index through which we can take the advantage of
per-module loglevel configuration introduced in HTTPD 2.3.
case 2 pre-HTTPD 2.3:
--------------------
The macros LOG_ARGS_SIGNATURE and LOG_ARGS_CASCADE expand to FILE and LINE to
make the code compatible with older server versions.
* subversion/mod_authz_svn/mod_authz_svn.c
(log_access_verdict): Make the macro LOG_ARGS_SIGNATURE as formal parameter
and use LOG_ARGS_CASCADE as actual parameter from the callers.
[1] http://httpd.apache.org/docs/trunk/developer/new_api_2_4.html#upgrading_logging
Patch by: Vijayaguru G <vijay{_AT_}collab.net>
Suggested by: kameshj
Modified:
subversion/trunk/subversion/mod_authz_svn/mod_authz_svn.c
Modified: subversion/trunk/subversion/mod_authz_svn/mod_authz_svn.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_authz_svn/mod_authz_svn.c?rev=1076234&r1=1076233&r2=1076234&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_authz_svn/mod_authz_svn.c (original)
+++ subversion/trunk/subversion/mod_authz_svn/mod_authz_svn.c Wed Mar 2 14:47:34 2011
@@ -30,8 +30,10 @@
#include <http_request.h>
#include <http_protocol.h>
#include <http_log.h>
+#include <http_config.h>
#include <ap_config.h>
#include <ap_provider.h>
+#include <ap_mmn.h>
#include <apr_uri.h>
#include <apr_lib.h>
#include <mod_dav.h>
@@ -48,6 +50,10 @@
extern module AP_MODULE_DECLARE_DATA authz_svn_module;
+#ifdef APLOG_USE_MODULE
+APLOG_USE_MODULE(authz_svn);
+#endif
+
typedef struct authz_svn_config_rec {
int authoritative;
int anonymous;
@@ -519,12 +525,26 @@ req_check_access(request_rec *r,
return OK;
}
+/* The macros LOG_ARGS_SIGNATURE and LOG_ARGS_CASCADE are expanded as formal
+ * and actual parameters to log_access_verdict with respect to HTTPD version.
+ */
+#if AP_MODULE_MAGIC_AT_LEAST(20100606,0)
+#define LOG_ARGS_SIGNATURE const char *file, int line, int module_index
+#define LOG_ARGS_CASCADE file, line, module_index
+#else
+#define LOG_ARGS_SIGNATURE const char *file, int line
+#define LOG_ARGS_CASCADE file, line
+#endif
+
/* Log a message indicating the access control decision made about a
- * request. FILE and LINE should be supplied via the APLOG_MARK macro.
- * ALLOWED is boolean. REPOS_PATH and DEST_REPOS_PATH are information
+ * request. The macro LOG_ARGS_SIGNATURE expands to FILE, LINE and
+ * MODULE_INDEX in HTTPD 2.3 as APLOG_MARK macro has been changed for
+ * per-module loglevel configuration. It expands to FILE and LINE
+ * in older server versions. ALLOWED is boolean.
+ * REPOS_PATH and DEST_REPOS_PATH are information
* about the request. DEST_REPOS_PATH may be NULL. */
static void
-log_access_verdict(const char *file, int line,
+log_access_verdict(LOG_ARGS_SIGNATURE,
const request_rec *r, int allowed,
const char *repos_path, const char *dest_repos_path)
{
@@ -534,22 +554,22 @@ log_access_verdict(const char *file, int
if (r->user)
{
if (dest_repos_path)
- ap_log_rerror(file, line, level, 0, r,
+ ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
"Access %s: '%s' %s %s %s", verdict, r->user,
r->method, repos_path, dest_repos_path);
else
- ap_log_rerror(file, line, level, 0, r,
+ ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
"Access %s: '%s' %s %s", verdict, r->user,
r->method, repos_path);
}
else
{
if (dest_repos_path)
- ap_log_rerror(file, line, level, 0, r,
+ ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
"Access %s: - %s %s %s", verdict,
r->method, repos_path, dest_repos_path);
else
- ap_log_rerror(file, line, level, 0, r,
+ ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
"Access %s: - %s %s", verdict,
r->method, repos_path);
}