Rev 11127 | Rev 11526 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 11127 | Rev 11133 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
16 | */ |
16 | */ |
17 | 17 | ||
18 | /* Common routines in interfaces */ |
18 | /* Common routines in interfaces */ |
19 | #include "common.h" |
19 | #include "common.h" |
20 | #include <assert.h> |
- | |
21 | #define ch_root "bin/ch..root" |
20 | #define ch_root "bin/ch..root" |
22 | 21 | ||
23 | int mypid; |
22 | int mypid; |
24 | int must_chroot=0; |
23 | int must_chroot=0; |
25 | char inputfname[256], outputfname[256]; |
24 | char inputfname[256], outputfname[256]; |
Line 196... | Line 195... | ||
196 | if(stat("../chroot/tmp/sessions/.chroot",&st)==0 || must_chroot) { |
195 | if(stat("../chroot/tmp/sessions/.chroot",&st)==0 || must_chroot) { |
197 | arg[0]=ch_root; i=1; |
196 | arg[0]=ch_root; i=1; |
198 | } |
197 | } |
199 | else { |
198 | else { |
200 | i=0; |
199 | i=0; |
201 |
|
200 | setreuid(getuid(),getuid());setregid(getgid(),getgid()); |
202 | assert(setregid(getgid(),getgid())==0); |
- | |
203 | } |
201 | } |
204 | arg[i++]=cmdf; |
202 | arg[i++]=cmdf; |
205 | for(p=abuf; *p && i<1000; i++, p=find_word_start(p2)) |
203 | for(p=abuf; *p && i<1000; i++, p=find_word_start(p2)) |
206 | if (*p=='\'') |
204 | if (*p=='\'') |
207 | {arg[i]=p2=++p; while(*p2 && *p2!='\'') p2++; if(*p2) *p2++=0;} |
205 | {arg[i]=p2=++p; while(*p2 && *p2!='\'') p2++; if(*p2) *p2++=0;} |
Line 381... | Line 379... | ||
381 | p=getenv("multiexec_debug"); if(p && strcmp(p,"yes")==0) debug=1; |
379 | p=getenv("multiexec_debug"); if(p && strcmp(p,"yes")==0) debug=1; |
382 | } |
380 | } |
383 | 381 | ||
384 | void prepabout(char *cmd, char *outf, char *errf) |
382 | void prepabout(char *cmd, char *outf, char *errf) |
385 | { |
383 | { |
386 |
|
384 | (void)write(pipe_in[1],cmd,strlen(cmd)); |
387 | execredirected(nameofcmd,NULL,outf,errf,cmdparm); |
385 | execredirected(nameofcmd,NULL,outf,errf,cmdparm); |
388 | } |
386 | } |
389 | 387 | ||
390 | /* read to aboutbuf. Returns content length. */ |
388 | /* read to aboutbuf. Returns content length. */ |
391 | int readabout(void) |
389 | int readabout(void) |
392 | { |
390 | { |