Subversion Repositories wimsdev

Rev

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

Rev 11133 Rev 11526
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 */
21
 
24
 
22
int mypid;
25
int mypid;
23
int must_chroot=0;
26
int must_chroot=0;
24
char inputfname[256], outputfname[256];
27
char inputfname[256], outputfname[256];
25
char pidfname[256];
28
char pidfname[256];
Line 195... Line 198...
195
      if(stat("../chroot/tmp/sessions/.chroot",&st)==0 || must_chroot) {
198
      if(stat("../chroot/tmp/sessions/.chroot",&st)==0 || must_chroot) {
196
          arg[0]=ch_root; i=1;
199
          arg[0]=ch_root; i=1;
197
      }
200
      }
198
      else {
201
      else {
199
          i=0;
202
          i=0;
200
          setreuid(getuid(),getuid());setregid(getgid(),getgid());
203
          IGNORE(setreuid(getuid(),getuid()));
-
 
204
          IGNORE(setregid(getgid(),getgid()));
201
      }
205
      }
202
      arg[i++]=cmdf;
206
      arg[i++]=cmdf;
203
      for(p=abuf; *p && i<1000; i++, p=find_word_start(p2))
207
      for(p=abuf; *p && i<1000; i++, p=find_word_start(p2))
204
        if (*p=='\'')
208
        if (*p=='\'')
205
         {arg[i]=p2=++p; while(*p2 && *p2!='\'') p2++; if(*p2) *p2++=0;}
209
         {arg[i]=p2=++p; while(*p2 && *p2!='\'') p2++; if(*p2) *p2++=0;}
Line 379... Line 383...
379
    p=getenv("multiexec_debug"); if(p && strcmp(p,"yes")==0) debug=1;
383
    p=getenv("multiexec_debug"); if(p && strcmp(p,"yes")==0) debug=1;
380
}
384
}
381
 
385
 
382
void prepabout(char *cmd, char *outf, char *errf)
386
void prepabout(char *cmd, char *outf, char *errf)
383
{
387
{
384
    (void)write(pipe_in[1],cmd,strlen(cmd));
388
    IGNORE(write(pipe_in[1],cmd,strlen(cmd)));
385
    execredirected(nameofcmd,NULL,outf,errf,cmdparm);
389
    execredirected(nameofcmd,NULL,outf,errf,cmdparm);
386
}
390
}
387
 
391
 
388
/* read to aboutbuf. Returns content length. */
392
/* read to aboutbuf. Returns content length. */
389
int readabout(void)
393
int readabout(void)