Roxen.git / server / modules / filesystems / filesystem.pike

version» Context lines:

Roxen.git/server/modules/filesystems/filesystem.pike:1:   // This is a roxen module. (c) Informationsv√§varna AB 1996.      // This is a virtual "file-system".   // It will be located somewhere in the name-space of the server.   // Also inherited by some of the other filesystems. - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; + string cvs_version = "$Id: filesystem.pike,v 1.5 1996/11/27 14:05:17 per Exp $";   #include <module.h>    - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #if DEBUG_LEVEL > 20 - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    # ifndef FILESYSTEM_DEBUG - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    # define FILESYSTEM_DEBUG - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    # endif - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #endif      inherit "module";   inherit "roxenlib";   inherit "socket";      int redirects, accesses, errors, dirlists;   int puts, deletes;      static int do_stat = 1;
Roxen.git/server/modules/filesystems/filesystem.pike:42:   void create()   {    defvar("mountpoint", "/", "Mount point", TYPE_LOCATION,    "This is where the module will be inserted in the "+    "namespace of your server.");       defvar("searchpath", "NONE", "Search path", TYPE_DIR,    "This is where the module will find the files in the real "+    "file system");    - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #ifdef COMPAT    defvar("html", 0, "All files are really HTML files", TYPE_FLAG|VAR_EXPERT,    "If you set this variable, the filesystem will _know_ that all files "    "are really HTML files. This might be useful now and then."); - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #endif       defvar(".files", 0, "Show hidden files", TYPE_FLAG,    "If set, hidden files will be shown in dirlistings and you "    "will be able to retrieve them.");       defvar("dir", 1, "Enable directory listings per default", TYPE_FLAG,    "If set, you have to create a file named .www_not_browsable ("    "or .nodiraccess) in a directory to disable directory listings."    " If unset, a file named .www_browsable in a directory will "
Roxen.git/server/modules/filesystems/filesystem.pike:93:    ("This is a virtual filesystem, use it to make files available to "+    "the users of your WWW-server.")    });   }      string path;      void start()   {    path = QUERY(searchpath); - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #ifdef FILESYSTEM_DEBUG    perror("FILESYSTEM: Online at "+QUERY(mountpoint)+" (path="+path+")\n"); - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #endif   }      string query_location()   {    return QUERY(mountpoint);   }         mixed stat_file( mixed f, mixed id )
Roxen.git/server/modules/filesystems/filesystem.pike:188:    putting[id[1]] -= strlen(data);    if(putting[id[1]] <= 0)    done_with_put( id );   }      mixed find_file( string f, object id )   {    object o;    int size;    string tmp; - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #ifdef FILESYSTEM_DEBUG    perror("FILESYSTEM: Request for "+f+"\n"); - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #endif       size = file_size( f = path + f );       switch(id->method)    {    case "GET":    case "HEAD":    case "POST":   
Roxen.git/server/modules/filesystems/filesystem.pike:234:    if(!o)    {    errors++;    report_error("Open of " + f + " failed. Permission denied.\n");    return http_low_answer(403, "<h2>File exists, but access forbidden "    "by user</h2>");    }       id->realfile = f;    accesses++; - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #ifdef COMPAT    if(QUERY(html)) /* Not very likely, really.. */    return ([ "type":"text/html", "file":o, ]); - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #endif    return o;    }    break;       case "PUT":    if(!QUERY(put))    return 0;       if(QUERY(check_auth) && (!id->auth || !id->auth[0]))    return http_auth_required("foo","<h1>Permission to 'PUT' files denied</h1>");       puts++;    - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #if 0    perror("PUT "+id->not_query+" ; "+id->misc->len+" bytes for "+    id->misc->gecos+" (uid="+id->misc->uid+"; gid="+id->misc->gid+")\n"); - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #endif - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #if efun(geteuid)    int ouid, ogid, dosetuid;    if(id->misc->uid && !getuid()) // We want to create the files    // with the correct uid/gid.    {    dosetuid = 1; ouid = geteuid(); ogid = getegid();    seteuid(getuid());    setegid( (int)id->misc->gid ); - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #if efun(initgroups)    initgroups( id->auth[1], (int)id->misc->gid ); - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #endif    seteuid( (int)id->misc->uid );    } - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #endif    rm( f );    mkdirhier( f );    object to = open(f, "wc"); - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #if efun(geteuid)    if(dosetuid)    {    array ou;    ou = roxen->user_from_uid( ouid, id );    seteuid(0); - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #if efun(initgroups)    if(ou) initgroups( ou[0], ogid ); - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #endif    seteuid( ouid );    setegid( ogid );    } - string cvs_version = "$Id: filesystem.pike,v 1.4 1996/11/27 13:48:00 per Exp $"; +    #endif       if(!to)    return 0;       putting[id->my_fd]=id->misc->len;    if(id->data && strlen(id->data))    {    putting[id->my_fd] -= strlen(id->data);    to->write( id->data );