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

version» Context lines:

Roxen.git/server/modules/filesystems/filesystem.pike:1012:    */   #define URI combine_path(mountpoint, f, ".")       string norm_f = real_path(f, id);       if (!norm_f) {    TRACE_LEAVE("Permission denied.");    return Roxen.http_status(403, "Access forbidden by user");    }    + #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:1396:    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:1475:    }       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.    if (has_suffix(moveto, "/")) {    moveto = moveto[..sizeof(moveto)-2]; -  + #if constant(System.normalize_path) +  } else { +  // normalize_path() may have adjusted the case of +  // the destination filename, so restore it. +  moveto = combine_path(moveto, "..", basename(new_uri)); + #endif    }       if (!dotfiles && sizeof(filter(new_uri/"/", has_prefix, "."))) {    TRACE_LEAVE("Path contains .-file or .-directory.");    return 0;    }    if (FILTER_INTERNAL_FILE (new_uri, id)) {    id->misc->error_code = 405;    TRACE_LEAVE("MOVE to internal file is disallowed");    return 0;