Branch: Tag:

2004-05-06

2004-05-06 13:34:37 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Locking might work now.

Rev: server/modules/filesystems/filesystem.pike:1.128

7:   inherit "module";   inherit "socket";    - constant cvs_version= "$Id: filesystem.pike,v 1.127 2004/05/05 21:24:38 mast Exp $"; + constant cvs_version= "$Id: filesystem.pike,v 1.128 2004/05/06 13:34:37 grubba Exp $";   constant thread_safe=1;      #include <module.h>
346:    }   }    + // We support locking if put is enabled. + mapping(string:mixed) lock_file(string path, DAVLock lock, RequestID id) + { +  if (!query("put")) return 0; +  if(query("check_auth") && (!id->conf->authenticate( id ) ) ) { +  TRACE_LEAVE("PUT: Permission denied"); +  return +  Roxen.http_auth_required("foo", +  "<h1>Permission to 'PUT' files denied</h1>"); +  } +  register_lock(path, lock, id); +  return 0; + } +    int dir_filter_function(string f, RequestID id)   {    if(f[0]=='.' && !dotfiles) return 0;
620:    sprintf("<h1>Permission to '%s' denied</h1>",    id->method));    } +  +  // Disallow if the name is locked, or if the parent directory is locked. +  mapping(string:mixed) ret = write_access(coll, 0, id) || +  write_access(combine_path(coll, ".."), 0, id); +  if (ret) return ret; +     mkdirs++;    object privs;    SETUID_TRACE("Creating directory/collection", 0);
920:    "<h1>Permission to 'PUT' files denied</h1>");    }    +  if (mapping(string:mixed) ret = write_access(f, 0, id)) { +  TRACE_LEAVE("PUT: Locked"); +  return ret; +  } +     puts++;       QUOTA_WERR("Checking quota.\n");
1036:    "<h1>Permission to 'CHMOD' files denied</h1>");    }    +  if (mapping(string:mixed) ret = write_access(f, 0, id)) { +  TRACE_LEAVE("PUT: Locked"); +  return ret; +  }       SETUID_TRACE("CHMODing file", 0);   
1114:    return 0;    }    +  // FIXME: What about moving of directories containing locked files? +  if (mapping(string:mixed) ret = write_access(f, 0, id) || +  write_access(id->misc->move_from, 0, id)) { +  TRACE_LEAVE("MV: Locked"); +  return ret; +  } +     SETUID_TRACE("Moving file", 0);       if (query("no_symlinks") &&
1150:    return Roxen.http_string_answer("Ok");       case "MOVE": -  // This little kluge is used by NETSCAPE 4.5 +  // This little kluge is used by NETSCAPE 4.5 and RFC 2518.       // FIXME: Support for quota.   
1231:    return 0;    }    +  if (mapping(string:mixed) ret = +  write_access(moveto, 0, id) || +  write_access(f, 0, id)) { +  TRACE_LEAVE("MOVE: Locked"); +  return ret; +  } +     SETUID_TRACE("Moving file", 0);       if (query("no_symlinks") &&