Branch: Tag:

1996-12-06

1996-12-06 23:01:24 by Per Hedbor <ph@opera.com>

Småfixar

Rev: server/base_server/config/describers.pike:1.11
Rev: server/base_server/config/draw_things.pike:1.15
Rev: server/base_server/disk_cache.pike:1.9
Rev: server/base_server/hosts.pike:1.4
Rev: server/base_server/mainconfig.pike:1.25
Rev: server/base_server/privs.pike:1.1
Rev: server/base_server/read_config.pike:1.6
Rev: server/base_server/roxen.pike:1.19
Rev: server/bin/garbagecollector.pike:1.4
Rev: server/etc/config.html:1.3
Rev: server/etc/include/roxen.pre.pike:1.5
Rev: server/etc/newconfig.html:1.3
Rev: server/etc/restart.html:1.5
Rev: server/etc/shutdown.html:1.3
Rev: server/etc/supports:1.7
Rev: server/etc/welcome.html:1.2
Rev: server/modules/graphics/tablist.pike:1.1
Rev: server/modules/misc/userdb.pike:1.7
Rev: server/modules/scripting/pikescript.pike:1.5
Rev: server/modules/tags/tablist.pike:1.6(DEAD)

1:   void perror(string format,mixed ... args);    - string popen(string s, void|mapping env) + string popen(string s, void|mapping env, int|void uid, int|void gid)   {    object p,p2;   
10:       if(!fork())    { -  array (int) olduid; +  array (int) olduid = ({ -1, -1 });    catch {    if(p->query_fd() < 0)    {
18:    exit(99);    }    p->dup2(File("stdout")); -  -  olduid = ({ geteuid(), getegid() }); -  seteuid(0); - #if efun(setegid) -  setegid(getgid()); - #endif +  if(uid || gid) +  { +  object privs = ((program)"privs")("Executing script as non-www user"); +  olduid = ({ uid, gid });    setgid(olduid[1]);    setuid(olduid[0]); -  + #if efun(initgroups) +  array pw = getpwuid((int)uid); +  if(pw) initgroups(pw[0], (int)olduid[0]); + #endif +  }    catch(exece("/bin/sh", ({ "-c", s }), (env||environment)));    };    exit(69);    }else{    string t;    destruct(p); -  t=p2->read(6553555); +  t=p2->read(0x7fffffff);    destruct(p2);    return t;    }
78:    object stdout, object stderr, void|string wd, void|array (int) uid)   {    int pid, *olduid = allocate(2, "int"); -  if(pid=fork()) -  return pid; +  object privs; +  +  if(pid=fork()) return pid; +     if(arrayp(uid) && sizeof(uid) == 2)    { - #if efun(seteuid) -  olduid = ({ geteuid(), getegid() }); -  seteuid(0); - #endif - #if efun(setegid) -  setegid(getgid()); - #endif +  privs = ((program)"privs")("Executing program as non-www user (outside roxen)");    setgid(uid[1]);    setuid(uid[0]); -  if(!getuid()) -  { - #if efun(seteuid) -  setgid(olduid[1]); -  setuid(olduid[0]); - #else -  setgid(-1); -  setuid(-1); - #endif -  } else { -  olduid = ({ geteuid(), getegid() }); - #if efun(seteuid) -  seteuid(0); - #endif - #if efun(setegid) -  setegid(getgid()); - #endif -  setgid(olduid[1]); -  setuid(olduid[0]); +     } -  } +     catch(low_spawne(s, args, env, stdin, stdout, stderr, wd));    exit(0);   }