--- webfs-1.13/request.c Tue Apr 10 13:31:42 2001 +++ webfs/request.c Sat Sep 22 01:00:56 2001 @@ -11,6 +11,7 @@ #include #include #include +#include #include "httpd.h" @@ -397,13 +398,46 @@ return; } - h = filename -1 +sprintf(filename,"%s%s%s%s", - do_chroot ? "" : doc_root, - virtualhosts ? "/" : "", - virtualhosts ? req->hostname : "", - req->path); - if (*h == '/') { + /* user directory translation */ + /* done by Teenage Mutant Hero c0re Coders - c0re.jp */ + if (req->path[1] == '~') + { + struct passwd *pw_user=NULL; + char user[512]; + int i; + + memset(user, 0, 512); + for (i=2;ipath);i++) + { + if (req->path[i] == '/') + break; + user[i-2] = req->path[i]; + } + + if ((pw_user = getpwnam(user))) + { + strcpy(filename,pw_user->pw_dir); + if (filename[strlen(filename)-1] == '/') + strcat(filename, "public_html"); + else + strcat(filename, "/public_html"); + strcat(filename, strchr(req->path+1, '/')); + } else { + mkerror(req,404,1); + return; + } + h = filename+strlen(filename)-1; + } else + h = filename -1 +sprintf(filename,"%s%s%s%s", + do_chroot ? "" : doc_root, + virtualhosts ? "/" : "", + virtualhosts ? req->hostname : "", + req->path); + + + if (*h == '/') { /* looks like the client asks for a directory */ + if (indexhtml) { /* check for index file */ strcpy(h+1,indexhtml); @@ -418,9 +452,9 @@ mkerror(req,403,1); return; } - } + } } - + if (-1 == stat(filename,&(req->bst))) { if (errno == EACCES) { mkerror(req,403,1);