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.23 1997/09/17 00:44:08 grubba Exp $"; + string cvs_version= "$Id: filesystem.pike,v 1.24 1997/10/11 20:54:21 grubba Exp $";   int thread_safe=1;         #include <module.h>   #include <roxen.h>   #include <stat.h>      #if DEBUG_LEVEL > 20   # ifndef FILESYSTEM_DEBUG   # define FILESYSTEM_DEBUG
Roxen.git/server/modules/filesystems/filesystem.pike:131:   }      string query_location()   {    return QUERY(mountpoint);   }         mixed stat_file( mixed f, mixed id )   { +  array fs; +  if(stat_cache && !id->pragma["no-cache"] && +  (fs=cache_lookup("stat_cache",path+f))) +  return fs; +     object privs;       if (((int)id->misc->uid) && ((int)id->misc->gid) &&    (QUERY(access_as_user))) {    // NB: Root-access is prevented.    privs=Privs("Statting file", (int)id->misc->uid, (int)id->misc->gid );    } -  +  fs = file_stat(path + f); /* No security currently in this function */ +  privs = 0;    if(!stat_cache) -  return file_stat(path + f); /* No security currently in this function */ -  array fs; -  if(!id->pragma["no-cache"]&&(fs=cache_lookup("stat_cache",path+f))) +     return fs; -  fs = file_stat(path+f); -  cache_set("stat_cache",path+f,fs); +  cache_set("stat_cache", path+f, fs);    return fs;   }      string real_file( mixed f, mixed id )   {    if(this->stat_file( f, id ))   /* This filesystem might be inherited by other filesystem, therefore    'this' */    return path + f;   }
Roxen.git/server/modules/filesystems/filesystem.pike:176:    array dir;       object privs;       if (((int)id->misc->uid) && ((int)id->misc->gid) &&    (QUERY(access_as_user))) {    // NB: Root-access is prevented.    privs=Privs("Getting dir", (int)id->misc->uid, (int)id->misc->gid );    }    -  if(!(dir = get_dir( path + f ))) +  if(!(dir = get_dir( path + f ))) { +  privs = 0;    return 0; -  +  }       privs = 0;       if(!QUERY(dir))    // Access to this dir is allowed.    if(search(dir, ".www_browsable") == -1)    {    errors++;    return 0;    }
Roxen.git/server/modules/filesystems/filesystem.pike:354:    puts++;       object privs;       if (((int)id->misc->uid) && ((int)id->misc->gid)) {    // NB: Root-access is prevented.    privs=Privs("Saving file", (int)id->misc->uid, (int)id->misc->gid );    }       if (QUERY(no_symlinks) && (contains_symlinks(path, oldf))) { +  privs = 0;    errors++;    report_error("Creation of " + f + " failed. Permission denied.\n");    return http_low_answer(403, "<h2>Permission denied.</h2>");    }       rm( f );    mkdirhier( f );    object to = open(f, "wc");       privs = 0;
Roxen.git/server/modules/filesystems/filesystem.pike:413:    report_notice("DELETING the file "+f+"\n");    accesses++;       if (((int)id->misc->uid) && ((int)id->misc->gid)) {    // NB: Root-access is prevented.    privs=Privs("Deleting file", id->misc->uid, id->misc->gid );    }       if(!rm(f))    { +  privs = 0;    id->misc->error_code = 405;    return 0;    } -  +  privs = 0;    deletes++;    return http_low_answer(200,(f+" DELETED from the server"));       default:    return 0;    }    report_error("Not reached..\n");    return 0;   }      string query_name()   {    return sprintf("<i>%s</i> mounted on <i>%s</i>", query("searchpath"),    query("mountpoint"));   }