Branch: Tag:

1998-04-24

1998-04-24 08:41:24 by Per Hedbor <ph@opera.com>

Removed support for enternal hostname processes. Added support for 'permanent uid', if used setuid() will be used instead of seteuid.

Rev: server/base_server/roxen.pike:1.192

1: - constant cvs_version = "$Id: roxen.pike,v 1.191 1998/04/23 13:16:20 grubba Exp $"; + constant cvs_version = "$Id: roxen.pike,v 1.192 1998/04/24 08:41:24 per Exp $";   #define IN_ROXEN   #include <roxen.h>   #include <config.h> - #if 0 - #ifdef THREADS - #include <fifo.h> - #endif - #endif /* 0 */ +    #include <module.h>   #include <variables.h>   
25:   inherit "language";      #if constant(spider.shuffle) - program pipe = (program)"smartpipe"; + constant pipe = (program)"smartpipe";   #else - program pipe = Pipe.pipe; + constant pipe = Pipe.pipe;   #endif      // This is the real Roxen version. It should be changed before each
66:   // from the configuration object in the future.   mapping portno=([]);    - constant decode = MIME.decode_base64; + // constant decode = roxen->decode;      // Function pointer and the root of the configuration interface   // object.
1056:      // I will remove this in a future version of roxen.   private program __p; - private mapping my_loaded = ([]); + mapping my_loaded = ([]);   program last_loaded() { return __p; }      string last_module_name;    - string filename(object o) + string filename(object|program o)   { -  return my_loaded[object_program(o)]||last_module_name; +  if(objectp(o)) o = object_program(o); +  return my_loaded[(program)o]||last_module_name;   }      program my_compile_file(string file)
1260: Inside #if undefined(__NT__) and #if efun(initgroups)
   // Doesn't always work - David.    };   #endif + #if efun(setuid) +  if(QUERY(permanent_uid)) +  { + #if efun(setgid) +  setgid((int)g); + #endif +  setuid((int)u); +  report_notice("Setting UID permanently to "+u+" and GID to "+g); +  } else { + #endif   #if efun(setegid) && defined(SET_EFFECTIVE)    setegid((int)g);   #else
1272:   #endif    report_notice("Setting UID to "+u+" and GID to "+g);    return 1; + #if efun(setuid)    } -  + #endif    } -  +  }   #endif   }   
1681:    "default group of that user will be used. "    "The syntax is user[:group].");    - #ifdef EXTERNAL_HOSTNAME_PROCESS -  globvar("NumHostnameLookup", 2, "Number of hostname lookup processes", -  TYPE_INT|VAR_MORE, -  "You can here state the number of simultaneos host-name lookup " -  "processes Roxen should run. Roxen must be restarted for a change " -  "of this variable to take effect. If you constantly see a large " -  "host name lookup queue size in the configuration interface " -  "'Actions->Status' section, consider increasing this variable. " -  "A good guidline is: " -  "<ul>\n" -  "<li> 1 for normal operation\n" -  "<li> 1 extra for each 300 000 accesses/day\n" -  "<li> 1 for each proxy\n" -  "<li> 1 for each 100 proxy users\n" -  "</ul>\n",0,1); - #endif +  globvar("permanent_uid", 0, "Change uid and gid permanently", +  TYPE_FLAG, +  "If this variable is set, roxen will set it's uid and gid " +  "permanently. This disables the 'exec script as user' fetures " +  "for CGI, and also access files as user in the filesystems, but " +  "it gives better security.");       globvar("ModuleDirs", ({ "../local/modules/", "modules/" }),    "Module directories", TYPE_DIR_LIST,
2341:    initiate_languages();    mixed tmp;    -  start_time=time(1); +  start_time=time();       add_constant("write", perror);   
2431: Inside #if defined(__RUN_TRACE)
  #ifdef __RUN_TRACE    trace(1);   #endif - // start_time=time(); // Used by the "uptime" info later on. +  start_time=time(); // Used by the "uptime" info later on.    return -1;   }