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

version» Context lines:

Roxen.git/server/modules/filesystems/filesystem.pike:590:       Stat stat = file_stat(real_fname);    SIMPLE_TRACE_ENTER(this, "Deleting %s %O.",    stat?(stat->isdir?"directory":"file"):"missing",    real_fname);    if (!stat) {    id->set_status_for_path(virt_fname, 404);    TRACE_LEAVE("File not found.");    continue;    } +  if (stat->isdir) { +  virt_fname += "/"; +  }    int(0..1)|mapping sub_status; -  if (check_status_needed && -  mappingp(sub_status = write_access(virt_fname, 1, id))) { +  if (mappingp(sub_status = write_access(virt_fname, 1, id))) {    id->set_status_for_path(virt_fname, sub_status->error);    TRACE_LEAVE("Write access denied.");    continue;    }    if (stat->isdir) {    recursive_rm(real_fname, virt_fname, sub_status, id);    }       /* Clear the stat-cache for this file */    if (stat_cache) {
Roxen.git/server/modules/filesystems/filesystem.pike:803:    id->method));    if (id->method == "MKCOL") {    return Roxen.http_status(405,    "Collection already exists.");    }    return 0;    }       // Disallow if the name is locked, or if the parent directory is locked.    mapping(string:mixed) ret = -  write_access(({coll, combine_path(coll, "..")}), 0, id); +  write_access(({coll + "/", combine_path(coll, "../")}), 0, id);    if (ret) return ret;       mkdirs++;    object privs;    SETUID_TRACE("Creating directory/collection", 0);       if (query("no_symlinks") && (contains_symlinks(path, coll))) {    privs = 0;    errors++;    report_error(LOCALE(46,"Creation of %O failed. Permission denied.\n"),
Roxen.git/server/modules/filesystems/filesystem.pike:1041:    if (size != -1) {    TRACE_LEAVE(sprintf("%s failed. Directory name already exists. ",    id->method));    if (id->method == "MKCOL") {    return Roxen.http_status(405,    "Collection already exists.");    }    return 0;    }    -  if (mapping(string:mixed) ret = write_access(f, 0, id)) { +  if (mapping(string:mixed) ret = write_access(f + "/", 0, id)) {    TRACE_LEAVE("MKCOL: Write access denied.");    return ret;    }       mkdirs++;    SETUID_TRACE("Creating directory/collection", 0);       if (query("no_symlinks") && (contains_symlinks(path, f))) {    privs = 0;    errors++;
Roxen.git/server/modules/filesystems/filesystem.pike:1422:    if (query("no_symlinks") &&    ((contains_symlinks(path, norm_f)) ||    (contains_symlinks(path, moveto)))) {    privs = 0;    errors++;    TRACE_LEAVE("MOVE: Contains symlinks. Permission denied");    return Roxen.http_status(403, "Permission denied.");    }       // NB: Consider the case of moving of directories containing locked files. -  mapping(string:mixed) ret = -  write_access(({ combine_path(f, "../"), f, new_uri }), 1, id); +  mapping(string:mixed) ret = write_access(({ f, new_uri }), 1, id);    if (ret) {    TRACE_LEAVE("MOVE: Locked");    return ret;    } -  +  ret = write_access(combine_path(f, "../"), 0, id); +  if (ret) { +  TRACE_LEAVE("MOVE: Parent directory locked"); +  return ret; +  }       if (norm_f == moveto) {    privs = 0;    errors++;    TRACE_LEAVE("MOVE: Source and destination are the same path.");    return Roxen.http_status(403, "Permission denied.");    }       size = _file_size(new_uri, id);