Subversion Repositories wimsdev

Rev

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

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