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

version» Context lines:

Roxen.git/server/modules/filesystems/filesystem.pike:1:   // This is a roxen module. Copyright © 1996 - 1998, Idonex AB.      // 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.      inherit "module";   inherit "roxenlib";   inherit "socket";    - constant cvs_version= "$Id: filesystem.pike,v 1.36 1998/05/14 08:22:52 neotron Exp $"; + constant cvs_version= "$Id: filesystem.pike,v 1.37 1998/05/14 15:58:34 grubba Exp $";   constant 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:508:    id->my_fd->write("HTTP/1.1 100 Continue\r\n");    }    id->my_fd->set_id( ({ to, id->my_fd }) );    id->my_fd->set_nonblocking(got_put_data, 0, done_with_put);    TRACE_LEAVE("PUT: Pipe in progress");    TRACE_LEAVE("PUT: Success so far");    return http_pipe_in_progress();    break;       case "MV": -  // This little kludge is used by ftp2 to move files. +  // This little kluge is used by ftp2 to move files.       if(!QUERY(put))    {    id->misc->error_code = 405;    TRACE_LEAVE("MV disallowed (since PUT is disallowed)");    return 0;    }    if(!QUERY(delete) && size != -1)    {    id->misc->error_code = 405;    TRACE_LEAVE("MV disallowed (DELE disabled, can't overwrite file)");    return 0;    }    -  if(size == -2) +  if(size < -1)    {    id->misc->error_code = 405;    TRACE_LEAVE("MV: Cannot overwrite directory");    return 0;    }       if(QUERY(check_auth) && (!id->auth || !id->auth[0])) {    TRACE_LEAVE("MV: Permission denied");    return http_auth_required("foo",    "<h1>Permission to 'MV' files denied</h1>");
Roxen.git/server/modules/filesystems/filesystem.pike:554:       object privs;      // #ifndef THREADS // Ouch. This is is _needed_. Well well...    if (((int)id->misc->uid) && ((int)id->misc->gid)) {    // NB: Root-access is prevented.    privs=Privs("Moving file", (int)id->misc->uid, (int)id->misc->gid );    }    // #endif    -  if (QUERY(no_symlinks) && (contains_symlinks(path, oldf)) && -  (contains_symlinks(path, id->misc->move_from))) { +  if (QUERY(no_symlinks) && +  ((contains_symlinks(path, oldf)) || +  (contains_symlinks(path, id->misc->move_from)))) {    privs = 0;    errors++;    TRACE_LEAVE("MV: Contains symlinks. Permission denied");    return http_low_answer(403, "<h2>Permission denied.</h2>");    }       TRACE_ENTER("MV: Accepted", 0);    -  +     /* Clear the stat-cache for this file */   #ifdef __NT__    if(movefrom[-1] == '/')    movefrom = move_from[..strlen(movefrom)-2];   #endif    if (stat_cache) {    cache_set("stat_cache", movefrom, 0);    cache_set("stat_cache", f, 0);    } -  werror("Moving file "+movefrom+" to "+ f+"\n"); + #ifdef DEBUG +  report_notice("Moving file "+movefrom+" to "+ f+"\n"); + #endif /* DEBUG */ +     int code = mv(movefrom, f);    privs = 0;       if(!code)    {    id->misc->error_code = 403;    TRACE_LEAVE("MV: Move failed");    TRACE_LEAVE("Failure");    return 0;    }    TRACE_LEAVE("MV: Success"); -  +  TRACE_LEAVE("Success");    return http_string_answer("Ok");       case "DELETE":    if(!QUERY(delete) || size==-1)    {    id->misc->error_code = 405;    TRACE_LEAVE("DELETE: Disabled");    return 0;    }    if(QUERY(check_auth) && (!id->auth || !id->auth[0])) {