Roxen.git
/
server
/
etc
/
include
/
roxen.pre.pike
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/etc/include/roxen.pre.pike:1:
+
string popen(string s, void|mapping env)
+
{
+
object p,p2;
+
+
p2 = File();
+
p=p2->pipe();
+
if(!p) error("Popen failed. (couldn't create pipe)\n");
+
+
if(!fork())
+
{
+
array (int) olduid;
+
catch {
+
if(p->query_fd() < 0)
+
{
+
perror("File to dup2 to closed!\n");
+
exit(99);
+
}
+
p->dup2(File("stdout"));
+
+
olduid = ({ geteuid(), getegid() });
+
seteuid(0);
+
#if efun(setegid)
+
setegid(getgid());
+
#endif
+
setgid(olduid[1]);
+
setuid(olduid[0]);
+
catch(exece("/bin/sh", ({ "-c", s }), (env||environment)));
+
};
+
exit(69);
+
}else{
+
string t;
+
destruct(p);
+
t=p2->read(6553555);
+
destruct(p2);
+
return t;
+
}
+
}
+
+
mapping make_mapping(string *f) { mapping foo=([ ]); string s, a, b; foreach(f, s) { sscanf(s, "%s=%s", a, b); foo[a]=b; } return foo;
Roxen.git/server/etc/include/roxen.pre.pike:72:
} } catch(low_spawne(s, args, env, stdin, stdout, stderr, wd)); exit(0); } void create() { add_constant("spawne",spawne); add_constant("perror",werror);
+
add_constant("popen",popen);
} Newline at end of file added.