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

version» Context lines:

Roxen.git/server/modules/filesystems/filesystem.pike:1395:    return 0;    }       // FIXME: The code below doesn't allow for this module being overloaded.    if (!has_prefix(new_uri, mountpoint)) {    id->misc->error_code = 405;    TRACE_LEAVE("MOVE: Dest file on other filesystem.");    return(0);    }    new_uri = new_uri[sizeof(mountpoint)..]; -  string moveto = path + "/" + encode_path(new_uri); +  string moveto = real_path(new_uri, id);       // Workaround for Linux, Tru64 and FreeBSD.    if (has_suffix(moveto, "/")) {    moveto = moveto[..sizeof(moveto)-2];    }       if (FILTER_INTERNAL_FILE (f, id) ||    FILTER_INTERNAL_FILE (new_uri, id)) {    id->misc->error_code = 405;    TRACE_LEAVE("MOVE to or from internal file is disallowed");
Roxen.git/server/modules/filesystems/filesystem.pike:1426:    }       // 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);    if (ret) {    TRACE_LEAVE("MOVE: 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);       SETUID_TRACE("Moving file", 0);       if (size != -1) {    // Destination exists.       TRACE_ENTER(sprintf("Destination exists: %d\n", size), 0);    int(0..1) overwrite =    !id->request_headers->overwrite ||