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 - 2000, Roxen IS. - // $Id: module.pike,v 1.96 2000/08/28 12:05:45 jhs Exp $ + // $Id: module.pike,v 1.97 2000/09/05 15:06:30 per Exp $      #include <module_constants.h>   #include <module.h>   #include <request_trace.h>      inherit "basic_defvar";   mapping(string:array(int)) error_log=([]);      constant is_module = 1;   constant module_type = MODULE_ZERO;
Roxen.git/server/base_server/module.pike:252:       foreach(replace(query("_seclevels"),    ({" ","\t","\\\n"}),    ({"","",""}))/"\n", string sl) {    if(!strlen(sl) || sl[0]=='#')    continue;       string type, value;    if(sscanf(sl, "%s=%s", type, value)==2)    { +  array(string|int) arr;    switch(lower_case(type))    {    case "allowip": -  array(string|int) arr; +     if (sizeof(arr = (value/"/")) == 2) {    // IP/bits    arr[1] = (int)arr[1];    patterns += ({ ({ MOD_ALLOW, IP_with_mask(@arr) }) });    } else if ((sizeof(arr = (value/":")) == 2) ||    (sizeof(arr = (value/",")) > 1)) {    // IP:mask or IP,mask    patterns += ({ ({ MOD_ALLOW, IP_with_mask(@arr) }) });    } else {    // Pattern    value = replace(value, ({ "?", ".", "*" }), ({ ".", "\\.", ".*" }));    patterns += ({ ({ MOD_ALLOW, Regexp(value)->match, }) });    }    break;       case "acceptip":    // Short-circuit version of allow ip. -  array(string|int) arr; +     if (sizeof(arr = (value/"/")) == 2) {    // IP/bits    arr[1] = (int)arr[1];    patterns += ({ ({ MOD_ACCEPT, IP_with_mask(@arr) }) });    } else if ((sizeof(arr = (value/":")) == 2) ||    (sizeof(arr = (value/",")) > 1)) {    // IP:mask or IP,mask    patterns += ({ ({ MOD_ACCEPT, IP_with_mask(@arr) }) });    } else {    // Pattern    value = replace(value, ({ "?", ".", "*" }), ({ ".", "\\.", ".*" }));    patterns += ({ ({ MOD_ACCEPT, Regexp(value)->match, }) });    }    break;       case "denyip": -  array(string|int) arr; +     if (sizeof(arr = (value/"/")) == 2) {    // IP/bits    arr[1] = (int)arr[1];    patterns += ({ ({ MOD_DENY, IP_with_mask(@arr) }) });    } else if ((sizeof(arr = (value/":")) == 2) ||    (sizeof(arr = (value/",")) > 1)) {    // IP:mask or IP,mask    patterns += ({ ({ MOD_DENY, IP_with_mask(@arr) }) });    } else {    // Pattern
Roxen.git/server/base_server/module.pike:344:    } else {    patterns += ({ ({ MOD_USER, Regexp(value)->match, }) });    }    }    break;       case "acceptuser":    // Short-circuit version of allow user.    // NOTE: MOD_PROXY_USER is already short-circuit.    value = replace(value, ({ "?", ".", "*" }), ({ ".", "\\.", ".*" })); -  array(string) users = (value/"," - ({""})); -  int i; +  users = (value/"," - ({""}));       for(i=0; i < sizeof(users); i++) {    if (lower_case(users[i]) == "any") {    if(this_object()->register_module()[0] & MODULE_PROXY)    patterns += ({ ({ MOD_PROXY_USER, lambda(){ return 1; } }) });    else    patterns += ({ ({ MOD_ACCEPT_USER, lambda(){ return 1; } }) });    break;    } else {    users[i & 0x0f] = "(^"+users[i]+"$)";