Roxen.git / server / base_server / module.pike

version» Context lines:

Roxen.git/server/base_server/module.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2001, Roxen IS. - // $Id: module.pike,v 1.174 2004/05/04 15:02:20 mast Exp $ + // $Id: module.pike,v 1.175 2004/05/04 17:53:22 mast Exp $      #include <module_constants.h>   #include <module.h>   #include <request_trace.h>      constant __pragma_save_parent__ = 1;      inherit "basic_defvar";   mapping(string:array(int)) error_log=([]);   
Roxen.git/server/base_server/module.pike:576:   //! This function is used e.g by the default lock implementation to   //! convert paths to resources that can be locked independently of   //! each other. There's also a notion of recursive locks there, which   //! means that a recursive lock on a certain resource identifier also   //! locks every resource whose identifier it is a prefix of. Therefore   //! it's typically necessary to ensure that every identifier ends with   //! "/" so that a recursive lock on e.g. "doc/foo" doesn't lock   //! "doc/foobar".   //!   //! @param path - //! The requested path below the filesystem location. @[path] has been + //! The requested path below the filesystem location. It has been   //! normalized with @[VFS.normalize_path].   {    return has_suffix (path, "/") ? path : path + "/";   }    - mixed authenticated_user_id (RequestID id) + string|int authenticated_user_id (string path, RequestID id)   //! Return a value that uniquely identifies the user that the given   //! request is authenticated as.   //!   //! This function is e.g. used by the default lock implementation to   //! tell different users holding locks apart.   //! - //! @note - //! The returned value is typically a string or integer, but if it - //! isn't then it must be able to compare for equality with - //! @[lfun::`==] and @[lfun::__hash]. + //! @param path + //! The requested path below the filesystem location. It has been + //! normalized with @[VFS.normalize_path].   {    // Leave this to the standard auth system by default.    User uid = my_configuration()->authenticate (id);    return uid && uid->name();   }      // Mapping from resource id to a mapping from user id to the lock   // that apply to the resource.   //   // Only used internally by the default lock implementation.
Roxen.git/server/base_server/module.pike:662:       TRACE_ENTER(sprintf("find_locks(%O, %O, %O, X)",    path, recursive, exclude_shared), this);       path = resource_id (path, id);       multiset(DAVLock) locks = (<>);    function(mapping(mixed:DAVLock):void) add_locks;       if (exclude_shared) { -  mixed auth_user = authenticated_user_id (id); +  mixed auth_user = authenticated_user_id (path, id);    add_locks = lambda (mapping(mixed:DAVLock) sub_locks) {    foreach (sub_locks; string user; DAVLock lock)    if (user == auth_user ||    lock->lockscope == "DAV:exclusive")    locks[lock] = 1;    };    }    else    add_locks = lambda (mapping(mixed:DAVLock) sub_locks) {    locks |= mkmultiset (values (sub_locks));
Roxen.git/server/base_server/module.pike:755:    int(0..1) recursive,    RequestID id)   {    // Common case.    if (!sizeof(file_locks) && !sizeof(prefix_locks)) return 0;       TRACE_ENTER(sprintf("check_locks(%O, %d, X)", path, recursive), this);       path = resource_id (path, id);    -  mixed auth_user = authenticated_user_id (id); +  mixed auth_user = authenticated_user_id (path, id);       if (DAVLock lock =    file_locks[path] && file_locks[path][auth_user] ||    prefix_locks[path] && prefix_locks[path][auth_user]) {    TRACE_LEAVE(sprintf("Found lock %O.", lock->locktoken));    return lock;    }    int(0..1) shared;       if (mapping(mixed:DAVLock) locks = file_locks[path]) {
Roxen.git/server/base_server/module.pike:865:   //! uses @[resource_id] to map paths to unique resources and   //! @[authenticated_user_id] to tell users apart.   mapping(string:mixed) lock_file(string path,    DAVLock lock,    RequestID id)   {    ASSERT_IF_DEBUG (lock->locktype == "DAV:write");    TRACE_ENTER(sprintf("lock_file(%O, lock(%O), X).", path, lock->locktoken),    this);    path = resource_id (path, id); -  mixed auth_user = authenticated_user_id (id); +  mixed auth_user = authenticated_user_id (path, id);    if (lock->recursive) {    if (prefix_locks[path]) {    prefix_locks[path][auth_user] = lock;    } else {    prefix_locks[path] = ([ auth_user:lock ]);    }    } else {    if (file_locks[path]) {    file_locks[path][auth_user] = lock;    } else {
Roxen.git/server/base_server/module.pike:901:   //! The lock to unregister. (It must not be changed or destructed.)   //!   //! @returns   //! Returns a status mapping on any error, zero otherwise.   mapping(string:mixed) unlock_file (string path,    DAVLock lock,    RequestID id)   {    TRACE_ENTER(sprintf("unlock_file(%O, lock(%O), X).", path, lock->locktoken),    this); -  mixed auth_user = authenticated_user_id (id); +  mixed auth_user = authenticated_user_id (path, id);    path = resource_id (path, id);    DAVLock removed_lock;    if (lock->recursive) {    removed_lock = m_delete (prefix_locks[path], auth_user);    if (!sizeof (prefix_locks[path])) m_delete (prefix_locks, path);    }    else {    removed_lock = m_delete (file_locks[path], auth_user);    if (!sizeof (file_locks[path])) m_delete (file_locks, path);    }