Mailing List Archive

[Bug 9299] New: - UserDir cmd doesn't allow alternate dirs in some cases
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9299>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9299

UserDir cmd doesn't allow alternate dirs in some cases

Summary: UserDir cmd doesn't allow alternate dirs in some cases
Product: Apache httpd-2.0
Version: 2.0.36
Platform: All
OS/Version: All
Status: NEW
Severity: Minor
Priority: Other
Component: mod_userdir
AssignedTo: bugs@httpd.apache.org
ReportedBy: jay@veggiespam.com


In the source to mod_userdir, the usage comments says that you may
combine UserDir entries to allow alternates. The given example is:

UserDir public_html /usr/web http://www.xyz.com/users

which says to search for ~username/public_html then /usr/web/
username and finally do a redirect to http://www.xyz.com/users/username.
However, this example does not work in Apache 2.0.36.

Imagine that we have "real" users of aaa and bbb (that is, with a login/
homedir), a set of "fake" users yyy and zzz with only a directory under /usr/
web, and a set of redirected users mmm and nnn. Now, using the above
configuration, point a browser to http://host/~aaa and ~bbb - it works.
However ~yyy ~zzz ~mmm ~nnn do not work. If you swap /usr/web and
public_html, now ~yyy and ~zzz work, yet ~mmm and ~nnn do not work.
Thus, there is no way to make all three alternates work on the same
system and no way to do preference of order of search either.

The solution is to change the "return DECLINED" in the #if
APR_HAS_USER section of mod_user to a "continue". The diff -u is:

--- mod_userdir.c.orig Tue May 21 16:03:22 2002
+++ mod_userdir.c Tue May 21 16:03:50 2002
@@ -330,10 +330,10 @@
filename = apr_pstrcat(r->pool, homedir, "/", userdir,
NULL);
}
else {
- return DECLINED;
+ continue;
}
#else
- return DECLINED;
+ continue;
#endif
}

-----end-diff----

Currently, /usr/web or /web/*/html style UserDir entries will search for the
exact file for the username+dir and if it is not found, it move on to the next
entry on the UserDir line.

However, for the "public_html" style UserDir entry, if we do not find
~username/public_html then we decline to process this request and do
not go to the next entry on the UserDir line. So, end of request, 404. If we
change the "return DECLINED" to "continue" as above, then we can move
on to the next UserDir entry.

Entries in the form of http:// are redirects and must come last. Apache
does not know if the user exists on the remote machine, thus it must
come last on the line. This fact should be mentioned in the docs and
source.

Yet, the ability to even use alternates in not mentioned in the docs,
only in the source. This needs to be added too. I can write a paragraph if
someone wants

(oh, and while we're working on mod_userdir.c, around line 351, can we
change the tabs to spaces? ;-)

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org