]> granicus.if.org Git - apache/commitdiff
If several directories are given in a UserDir directive, only files in the first...
authorChristophe Jaillet <jailletc36@apache.org>
Sat, 26 May 2018 12:25:10 +0000 (12:25 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Sat, 26 May 2018 12:25:10 +0000 (12:25 +0000)
 PR 59636.

While at it, add some debug messages to better understand what is performed.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1832306 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/log-message-tags/next-number
modules/mappers/mod_userdir.c

diff --git a/CHANGES b/CHANGES
index 2997380ae658ed3ee68f37e7cbc49bdc907d140a..1e6115930f89b56a295045b52865526f1dda54f0 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,13 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.1
 
+  *) mod_userdir: If several directories are given in a UserDir directive, only files
+     in the first existing one are checked. If the file is not found there, the
+     other possible directories are not checked. The doc clearly states that they
+     will be checked one by one, until a match is found or an external redirect is
+     performed.  PR 59636.
+     [Christophe Jaillet]
+
   *) mod_proxy: Fix a corner case where the ProxyPassReverseCookieDomain or
      ProxyPassReverseCookiePath directive could fail to update correctly 
      'domain=' or 'path=' in the 'Set-Cookie' header.  PR 61560.
index fef1541d45e551efccc3594e1a4659a5578e53b5..b9f8c0b81396cdefe520ef6a265bdd49b8859937 100644 (file)
@@ -1 +1 @@
-10138
+10142
index 1ec0e9010d259dca56681e2a97f963b192c87655..b8b9e92d3e7a05bef801eb6a19cf96834707378c 100644 (file)
@@ -63,6 +63,7 @@
 #include "httpd.h"
 #include "http_config.h"
 #include "http_request.h"
+#include "http_log.h"
 
 #if !defined(WIN32) && !defined(OS2) && !defined(NETWARE)
 #define HAVE_UNIX_SUEXEC
@@ -265,6 +266,9 @@ static int translate_userdir(request_rec *r)
         apr_status_t rv;
         int is_absolute = ap_os_is_path_absolute(r->pool, userdir);
 
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(10138)
+                      "checking for UserDir '%s'", userdir);
+
         if (ap_strchr_c(userdir, '*'))
             prefix = ap_getword(r->pool, &userdir, '*');
 
@@ -318,11 +322,16 @@ static int translate_userdir(request_rec *r)
          * anyway, in the hope that some handler might handle it. This can be
          * used, for example, to run a CGI script for the user.
          */
+        filename = apr_pstrcat(r->pool, filename, dname, NULL);
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(10139)
+                      "checking for filename '%s'", filename);
         if (filename && (!*userdirs
                       || ((rv = apr_stat(&statbuf, filename, APR_FINFO_MIN,
                                          r->pool)) == APR_SUCCESS
                                              || rv == APR_INCOMPLETE))) {
-            r->filename = apr_pstrcat(r->pool, filename, dname, NULL);
+            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(10140)
+                          "'%s' found", filename);
+            r->filename = filename;
             ap_set_context_info(r, apr_pstrmemdup(r->pool, r->uri,
                                                   dname - r->uri),
                                 filename);
@@ -338,6 +347,8 @@ static int translate_userdir(request_rec *r)
 
             return OK;
         }
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(10141)
+                      "'%s' NOT found. Trying next UserDir directory (if any)", filename);
     }
 
     return DECLINED;