You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Andrew Wilson <an...@tees.elsevier.co.uk> on 1995/12/21 12:56:54 UTC
Apache and ~username
from c.i.w.u.s.foo.bar.who-cares...
so maybe people don't want their webservers to be able to see /home...
I'll upload this patch shortly...untested of course.
It seems like the guy could have saved hisself a lot of heartache
by just *not* using the ~username feature *shrug*
Ay.
jaap@cs.ruu.nl (Jaap Romers) wrote:
>
>Hi,
>
>We run apache in a chrooted environment without home-directories mounted
>from our home-directory server, which will cause problems with the
>~username in URL's. Because we want to support this tilde-thing in URL's, we
>added a new feature to the mod_userdir module in the apache-1.0.0 server.
>
>With this new feature, we can store user html-docs in an alternative
>directory on the web-server and mount this directory on all the client
>workstations in the network for updating.
>
>This patch is also useful if you don't run apache chrooted, but on
>a seperate machine without home-directories.
>
>To configure this feature, you still can use the UserDir directive in the
>srm.conf file by setting a full pathname for the directory:
>
> UserDir /htdocs/people
>
>A request for http://server/~username will be mapped to the directory
>/htdocs/people/username (http://server/people/username will be mapped
>to the same directory if /htdocs is your DocumentRoot).
>
>Here is the patch for the Apache 1.0.0 distribution. To apply the patch,
>go to the apache_1.0.0/src directory and do: patch -p < patch-file.
>
>Merry christmas and a happy new year.
>
>Jaap
>
>*** mod_userdir.c.dist Thu Dec 7 14:07:08 1995
>--- mod_userdir.c Thu Dec 7 14:13:34 1995
>***************
>*** 103,123 ****
> struct passwd *pw;
> char *w, *dname;
>
>- dname = name + 2;
>- w = getword(r->pool, &dname, '/');
>- if(!(pw=getpwnam(w)))
>- return NOT_FOUND;
>-
> /* The 'dname' funny business involves backing it up to capture
> * the '/' delimiting the "/~user" part from the rest of the URL,
> * in case there was one (the case where there wasn't being just
> * "GET /~user HTTP/1.0", for which we don't want to tack on a
> * '/' onto the filename).
> */
>!
>! if (dname[-1] == '/') --dname;
>! r->filename = pstrcat (r->pool, pw->pw_dir, "/", userdir, dname, NULL);
>
> return OK;
> }
>
>--- 103,129 ----
> struct passwd *pw;
> char *w, *dname;
>
> /* The 'dname' funny business involves backing it up to capture
> * the '/' delimiting the "/~user" part from the rest of the URL,
> * in case there was one (the case where there wasn't being just
> * "GET /~user HTTP/1.0", for which we don't want to tack on a
> * '/' onto the filename).
> */
>!
>! dname = name + 2;
>! w = getword(r->pool, &dname, '/');
>!
>! if (dname[-1] == '/')
>! --dname;
>
>+ if (userdir[0] == '/')
>+ {
>+ r->filename = pstrcat (r->pool,userdir,"/",w,dname,NULL);
>+ } else {
>+ if(!(pw=getpwnam(w)))
>+ return NOT_FOUND;
>+ r->filename = pstrcat(r->pool,pw->pw_dir,"/",userdir,dname,NULL);
>+ }
> return OK;
> }
>
>--
>J.M. Romers http://www.cs.ruu.nl/people/jaap Jaap.Romers@cs.ruu.nl
>-----------------------------------------------------------------------
>Department of Computer Science, Utrecht University +31-(0)30-2532248
>Padualaan 14, 3584 CH Utrecht, the Netherlands fax +31-(0)30-2513791
news:4bbbdp$i13@krant.cs.ruu.nl