Author: breser
Date: Fri Aug 9 18:21:33 2013
New Revision: 1512432
URL: http://svn.apache.org/r1512432
Log:
mod_dav_svn: Fix longstanding bug that requests are mapped to the filesystem.
mod_dav_svn didn't have a translate_name hook so the default processing would
map our requests to %{DOCUMENT_ROOT}/%{LOCATION_PATH} where LOCATION_PATH is
the path configured on the Location block that SVNPath/SVNParentPath is in.
Typically this path wouldn't exist and even if it did exist it's content
would not be served.
This meant that Directory blocks access control applied to SVN requests and
log formats using %f would log this path as though it was the path for the
file that httpd served.
Users might have been relying on this behavior but Directory should never
have applied. Users using this behavior should move any access control
directives to the Location block rather than the Directory block.
* subversion/mod_dav_svn.c
(dav_svn__translate_name): New function.
(register_hooks): Register translate_name hook.
Modified:
subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c
Modified: subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c?rev=1512432&r1=1512431&r2=1512432&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c Fri Aug 9 18:21:33
2013
@@ -1092,7 +1092,22 @@ static int dav_svn__handler(request_rec
return DECLINED;
}
+/* Prevent filename on the request from being set since we aren't serving a
+ * file off the disk. This means that <Directory> blocks will not match and
+ * that * %f in logging formats will show as "-". */
+static int dav_svn__translate_name(request_rec *r)
+{
+ dir_conf_t *conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
+ /* module is not configured, bail out early */
+ if (!conf->fs_path && !conf->fs_parent_path)
+ return DECLINED;
+
+ /* Be paranoid and set it to NULL just in case some other module set it
+ * before we got called. */
+ r->filename = NULL;
+ return OK;
+}
@@ -1266,6 +1281,9 @@ register_hooks(apr_pool_t *pconf)
ap_register_input_filter("IncomingRewrite", dav_svn__location_in_filter,
NULL, AP_FTYPE_CONTENT_SET);
ap_hook_fixups(dav_svn__proxy_request_fixup, NULL, NULL, APR_HOOK_MIDDLE);
+ /* translate_name hook is LAST so that it doesn't interfere with modules
+ * like mod_alias that are MIDDLE. */
+ ap_hook_translate_name(dav_svn__translate_name, NULL, NULL, APR_HOOK_LAST);
}