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

version» Context lines:

Roxen.git/server/modules/filesystems/filesystem.pike:943:    if (has_suffix(oldf, "/") && !has_suffix(f, "/")) {    // Restore the "/" stripped by encode_path() on NT.    f += "/";    }       /* Adjust not_query */    id->not_query = mountpoint + f;   #endif /* constant(System.normalize_path) */    };    + #ifdef __NT__ +  foreach(f/"/", string segment) { +  if (has_suffix(segment, " ")) { +  // Path segments on NT may not end with space. +  return Roxen.http_status(405, "Invalid filesystem path."); +  } +  } + #endif +     // NOTE: Sets id->misc->stat.    size = _file_size( f, id );       FILESYSTEM_WERR(sprintf("_file_size(%O, %O) ==> %d\n", f, id, size));       if(!id->misc->internal_get) {    if (!dotfiles && sizeof(filter(f/"/", has_prefix, "."))) {    TRACE_LEAVE("Path contains .-file or .-directory.");    return 0;    }
Roxen.git/server/modules/filesystems/filesystem.pike:1326:    string movefrom;    if(!id->misc->move_from ||    !has_prefix(id->misc->move_from, mountpoint) ||    !(movefrom = id->conf->real_file(id->misc->move_from, id))) {    id->misc->error_code = 405;    errors++;    TRACE_LEAVE("MV: No source file");    return 0;    }    + #ifdef __NT__ +  foreach(id->misc->move_from/"/", string segment) { +  if (has_suffix(segment, " ")) { +  // Path segments on NT may not end with space. +  return Roxen.http_status(405, "MV: Invalid filesystem path."); +  } +  } + #endif +     string relative_from = id->misc->move_from[sizeof(mountpoint)..];       if (!dotfiles && sizeof(filter(relative_from/"/", has_prefix, "."))) {    TRACE_LEAVE("From-path contains .-file or .-directory.");    return 0;    }    if (FILTER_INTERNAL_FILE(relative_from, id)) {    id->misc->error_code = 405;    TRACE_LEAVE("MV from internal file is disallowed.");    return 0;
Roxen.git/server/modules/filesystems/filesystem.pike:1405:    }       string new_uri = id->misc["new-uri"] || "";    if (new_uri == "") {    id->misc->error_code = 405;    errors++;    TRACE_LEAVE("MOVE: No dest file");    return 0;    }    + #ifdef __NT__ +  foreach(new_uri/"/", string segment) { +  if (has_suffix(segment, " ")) { +  // Path segments on NT may not end with space. +  return Roxen.http_status(405, "MOVE: Invalid filesystem path."); +  } +  } + #endif +     // 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 = real_path(new_uri, id);       // Workaround for Linux, Tru64 and FreeBSD.