Roxen.git / server / base_server / configuration.pike

version» Context lines:

Roxen.git/server/base_server/configuration.pike:1:   // A vitual server's main configuration   // Copyright © 1996 - 2000, Roxen IS. - constant cvs_version = "$Id: configuration.pike,v 1.414 2001/01/28 05:45:29 per Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.415 2001/01/29 05:47:58 per Exp $";   #include <module.h>   #include <module_constants.h>   #include <roxen.h>   #include <request_trace.h>         #define CATCH(P,X) do{mixed e;if(e=catch{X;})report_error("While "+P+"\n"+describe_backtrace(e));}while(0)      // --- Locale defines ---   //<locale-token project="roxen_start"> LOC_S </locale-token>
Roxen.git/server/base_server/configuration.pike:450:   {    if( userdb_module_cache )    return userdb_module_cache;    array tmp = ({});    foreach( values( modules ), mapping m )    foreach( values(m->copies), RoxenModule mo )    if( mo->module_type & MODULE_USERDB )    tmp += ({ ({ mo->query( "_priority" ), mo }) });       sort( tmp ); -  tmp += ({ ({ 0, roxen->config_userdb_module }) }); + // tmp += ({ ({ 0, roxen->config_userdb_module }) });    return userdb_module_cache = reverse(column(tmp,1));   }      array(AuthModule) auth_modules()   {    if( auth_module_cache )    return auth_module_cache;    array tmp = ({});    foreach( values( modules ), mapping m )    foreach( values(m->copies), RoxenModule mo )
Roxen.git/server/base_server/configuration.pike:620:   //! id parameter might be left out if FTP. Returns zero if no auth   //! module was present.   {    User uid;    foreach( user_databases(), UserDB m )    if( uid = m->find_user_from_uid( u ) )    return uid->compat_userinfo();   }      UserDB find_user_database( string name ) + //! Given a user database name, returns it if it exists in this + //! configuration, otherwise returns 0.   {    foreach( user_databases(), UserDB m )    if( m->name == name )    return m;   }      AuthModule find_auth_module( string name ) -  + //! Given a authentication method name, returns it if it exists in + //! this configuration, otherwise returns 0.   {    foreach( auth_modules(), AuthModule m )    if( m->name == name )    return m;   }    - public User authenticate( RequestID id, UserDB|void database) + User authenticate( RequestID id, UserDB|void database)   //! Try to authenticate the request with users from the specified user   //! database. If no @[database] is specified, all datbases in the - //! current configuration are searched in priority order, then the - //! configuration user database. + //! current configuration are searched in priority order.   //!   //! The return value is the autenticated user.   //! id->misc->authenticated_user is always set to the return value.   {    User u;    foreach( auth_modules(), AuthModule method )    if( u = method->authenticate( id, database ) )    return id->misc->authenticated_user = u;   }    - public mapping authenticate_throw( RequestID id, string realm, + mapping authenticate_throw( RequestID id, string realm,    UserDB|void database)   //! Returns a reply mapping, similar to @[Roxen.http_rxml_reply] with   //! friends. If no @[database] is specified, all datbases in the - //! current configuration are searched in priority order, then the - //! configuration user database. + //! current configuration are searched in priority order.   {    mapping m;    foreach( auth_modules(), AuthModule method )    if( m = method->authenticate_throw( id, realm, database ) ) -  { -  werror( "%O\n", m ); +     return m;   } -  +  + User find_user( string user, RequestID|void id ) + //! Tries to find the specified user in the currently available user + //! databases. If id is specified, this function defaults to the + //! database that the currently authenticated user came from, if any. + //! + //! The other user databases are processed in priority order + { +  User uid; +  +  if( id->misc->authenticated_user +  && ( uid = id->misc->authenticated_user->database->find_user( user ) )) +  return uid; +  +  foreach( user_databases(), UserDB m ) +  if( uid = m->find_user( user ) ) +  return uid;   }    -  + Group find_group( string group, RequestID|void id ) + //! Tries to find the specified group in the currently available user + //! databases. If id is specified, this function defaults to the + //! database that the currently authenticated user came from, if any. + //! + //! The other user databases are processed in priority order + { +  Group uid;    -  +  if( id->misc->authenticated_user +  && ( uid = id->misc->authenticated_user->database->find_group( group ) )) +  return uid; +  +  foreach( user_databases(), UserDB m ) +  if( uid = m->find_group( group ) ) +  return uid; + } +  +    public string last_modified_by(Stdio.File file, RequestID id)   {    Stat s;    int uid;    array u;       if(objectp(file)) s=file->stat();    if(!s || sizeof(s)<5) return "A. Nonymous";    uid=s[5];    u=user_from_uid(uid, id);
Roxen.git/server/base_server/configuration.pike:1993:       CACHE( fake_id->misc->cacheable );    destruct (fake_id);       if (!mappingp(m) && !objectp(m)) {    report_error("try_get_file(%O, %O, %O, %O): m = %O is not a mapping.\n",    s, id, status, nocache, m);    return 0;    }    -  if (!(< 0, 200, 201, 202, 203 >)[m->error]) return 0; +  // Allow 2* and 3* error codes, not only a few specific ones. +  if (!(< 0,2,3 >)[m->error/100]) return 0;       if(status) return 1;       if(m->data)    res = m->data;    else    res="";    m->data = 0;       if( objectp(m->file) )
Roxen.git/server/base_server/configuration.pike:2827:    add_parse_module( (object)this_object() );       if (!modules_already_enabled) {    enabled_modules = retrieve("EnabledModules", this_object());    roxenloader.LowErrorContainer ec = roxenloader.LowErrorContainer();    roxenloader.push_compile_error_handler( ec );       array modules_to_process = indices( enabled_modules );    string tmp_string;    -  // Always enable the user database module first. -  if(search(modules_to_process, "userdb#0")>-1) -  modules_to_process = (({"userdb#0"})+(modules_to_process-({"userdb#0"}))); -  +     array err;    forcibly_added = (<>);    enable_module_batch_msgs = 1;    foreach( modules_to_process, tmp_string )    {    if( !forcibly_added[ tmp_string ] )    if(err = catch( enable_module( tmp_string ))) {    report_error(LOC_M(45, "Failed to enable the module %s. Skipping.\n%s"),    tmp_string, describe_backtrace(err));    got_no_delayed_load = -1;