Subversion Repositories wimsdev

Rev

Rev 11526 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11526 Rev 11539
Line 16... Line 16...
16
 */
16
 */
17
 
17
 
18
/* Common routines in interfaces */
18
/* Common routines in interfaces */
19
#include "common.h"
19
#include "common.h"
20
#define ch_root "bin/ch..root"
20
#define ch_root "bin/ch..root"
21
 
-
 
22
void inline IGNORE() {}  /* Ignore GCC Unused Result */
-
 
23
void IGNORE();  /* see http://stackoverflow.com/a/16245669/490291 */
-
 
24
 
21
 
25
int mypid;
22
int mypid;
26
int must_chroot=0;
23
int must_chroot=0;
27
char inputfname[256], outputfname[256];
24
char inputfname[256], outputfname[256];
28
char pidfname[256];
25
char pidfname[256];
Line 198... Line 195...
198
      if(stat("../chroot/tmp/sessions/.chroot",&st)==0 || must_chroot) {
195
      if(stat("../chroot/tmp/sessions/.chroot",&st)==0 || must_chroot) {
199
          arg[0]=ch_root; i=1;
196
          arg[0]=ch_root; i=1;
200
      }
197
      }
201
      else {
198
      else {
202
          i=0;
199
          i=0;
203
          IGNORE(setreuid(getuid(),getuid()));
200
          setreuid(getuid(),getuid());setregid(getgid(),getgid());
204
          IGNORE(setregid(getgid(),getgid()));
-
 
205
      }
201
      }
206
      arg[i++]=cmdf;
202
      arg[i++]=cmdf;
207
      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))
208
        if (*p=='\'')
204
        if (*p=='\'')
209
         {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 383... Line 379...
383
    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;
384
}
380
}
385
 
381
 
386
void prepabout(char *cmd, char *outf, char *errf)
382
void prepabout(char *cmd, char *outf, char *errf)
387
{
383
{
388
    IGNORE(write(pipe_in[1],cmd,strlen(cmd)));
384
    (void)write(pipe_in[1],cmd,strlen(cmd));
389
    execredirected(nameofcmd,NULL,outf,errf,cmdparm);
385
    execredirected(nameofcmd,NULL,outf,errf,cmdparm);
390
}
386
}
391
 
387
 
392
/* read to aboutbuf. Returns content length. */
388
/* read to aboutbuf. Returns content length. */
393
int readabout(void)
389
int readabout(void)