Roxen.git / server / modules / security / htaccess.pike

version» Context lines:

Roxen.git/server/modules/security/htaccess.pike:1:   // This is a roxen module. Copyright © 1996 - 2009, Roxen IS.      // .htaccess compability by David Hedbor <neotron@roxen.com>   // Changed into module by Per Hedbor <per@roxen.com>   // Support for many extensions added by Henrik Grubbström <grubba@roxen.com>   //   // The canonical documentation for the .htaccess format seems to be   // http://httpd.apache.org/docs/1.3/mod/mod_access.html    - constant cvs_version="$Id: htaccess.pike,v 1.109 2010/11/22 14:04:53 grubba Exp $"; + constant cvs_version="$Id$";   constant thread_safe=1;      #include <module.h>   #include <roxen.h>   inherit "module";      //#define HTACCESS_DEBUG      #ifdef HTACCESS_DEBUG   # include <request_trace.h>   # define HT_WERR(X) werror("HTACCESS: %s\n",X)   #else   # define TRACE_ENTER(A,B)   # define TRACE_LEAVE(A)   # define HT_WERR(X)   #endif      constant module_type = MODULE_SECURITY|MODULE_LAST|MODULE_URL|MODULE_USERDB;   constant module_name = "Authentication: .htaccess support"; - constant module_doc = "Almost complete support for NCSA/Apache " + constant module_doc = "Authentication support for NCSA/Apache "    ".htaccess files. See " -  "<a href=\"http://hoohoo.ncsa.uiuc.edu/docs/setup/access/Overview.html\">" -  "http://hoohoo.ncsa.uiuc.edu/docs/setup/access/Overview.html</a> for more information.<br />\n" +  "<a href=\"http://httpd.apache.org/docs/2.4/howto/htaccess.html\">" +  "http://httpd.apache.org/docs/2.4/howto/htaccess.html</a> for more information.<br />\n"    "\n"    "Some non-standard options are supported:"       "<ul><li>"    "All filenames can be specified as 'locate file', which will cause the"    " file to be located above (closer to the root of) the currently"    " requested file in the virtual filesystem. This can be used to, as an"    " example, specify the password file as 'locate .htpasswd', in a"    " top-level htaccess file, then have password files located in the"    " subdirectories.</li>"
Roxen.git/server/modules/security/htaccess.pike:441:    case "redirect":    case "redirectperm":    case "redirectpermanent":    access->redirect += ({ rest });    break;       case "authuserfile":    case "authgroupfile":    if(!access->userdb )    access->userdb = "htaccess"; +  rest = combine_path(file, "..", rest);    // FALL-THROUGH       case "authname":    case "userdb":    case "authmethod":    case "errorfile":    access[cmd] = rest;    break;    }    }
Roxen.git/server/modules/security/htaccess.pike:639:    grent = _grent;    }   }      array(mapping) parse_groupfile( string f )   {    if( !f ) return ({([]),([])});    mapping u2g = ([]);    mapping groups = ([]);    int gid = 10000; +  f = replace(f, "\r", "\n");    foreach( f / "\n", string r )    {    array(string) q = r/":";    string members;    string passwd = "";    int this_gid;    switch( sizeof( q ) )    {    default:    continue;
Roxen.git/server/modules/security/htaccess.pike:680:    groups[this_gid] = groups[q[0]];    }    return ({ groups, u2g });   }      mapping parse_userfile( string f, mapping u2g, mapping groups )   {    if( !f ) return ([]);    mapping users = ([]);    int uid = 10000; +  f = replace(f, "\r", "\n");    foreach( f/ "\n", string r )    {    array q = r/":";    switch( sizeof( q ) )    {    case 2..6: // user:passwd    users[q[0]] = ({q[0],q[1],uid++,10000,q[0],"/tmp/","/nosuchshell",    u2g[q[0]], 0});    users[uid-1] = users[q[0]];    break;