Rev 7076 | Rev 11133 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7076 | Rev 11128 | ||
---|---|---|---|
Line 42... | Line 42... | ||
42 | #include <utime.h> |
42 | #include <utime.h> |
43 | #include <sys/time.h> |
43 | #include <sys/time.h> |
44 | #include <sys/stat.h> |
44 | #include <sys/stat.h> |
45 | #include <sys/types.h> |
45 | #include <sys/types.h> |
46 | #include <sys/resource.h> |
46 | #include <sys/resource.h> |
47 | - | ||
- | 47 | #include <assert.h> |
|
48 | int execuid=15999; |
48 | int execuid=15999; |
49 | int execgid=15999; |
49 | int execgid=15999; |
50 | int must=0; |
50 | int must=0; |
51 | time_t now; |
51 | time_t now; |
52 | 52 | ||
Line 231... | Line 231... | ||
231 | stat("bin",&st); execuid=execgid=st.st_uid; |
231 | stat("bin",&st); execuid=execgid=st.st_uid; |
232 | if(test_must()) goto abandon; |
232 | if(test_must()) goto abandon; |
233 | goto ex; |
233 | goto ex; |
234 | } |
234 | } |
235 | if(chroot("../chroot")==0) { |
235 | if(chroot("../chroot")==0) { |
236 |
|
236 | assert(chdir("/tmp")==0); |
237 | lim.rlim_cur=lim.rlim_max=PROC_QUOTA; |
237 | lim.rlim_cur=lim.rlim_max=PROC_QUOTA; |
238 | setrlimit(RLIMIT_NPROC,&lim); |
238 | setrlimit(RLIMIT_NPROC,&lim); |
239 | setenv("PATH",chroot_path,1); |
239 | setenv("PATH",chroot_path,1); |
240 | p=getenv("w_wims_session"); |
240 | p=getenv("w_wims_session"); |
241 | if(p && *p) { |
241 | if(p && *p) { |
Line 243... | Line 243... | ||
243 | p=strchr(tmpbuf,'_'); if(p) *p=0; |
243 | p=strchr(tmpbuf,'_'); if(p) *p=0; |
244 | setenv("TMPDIR",tmpbuf,1); |
244 | setenv("TMPDIR",tmpbuf,1); |
245 | setenv("tmp_dir",tmpbuf,1); |
245 | setenv("tmp_dir",tmpbuf,1); |
246 | p=getenv("w_wims_priv_chroot"); |
246 | p=getenv("w_wims_priv_chroot"); |
247 | if(p && strstr(p,"tmpdir")!=NULL) |
247 | if(p && strstr(p,"tmpdir")!=NULL) |
248 | ( |
248 | assert(chdir(tmpbuf)==0); |
249 | } |
249 | } |
250 | } |
250 | } |
251 | else if(test_must()) goto abandon; |
251 | else if(test_must()) goto abandon; |
252 | ex: |
252 | ex: |
253 | if(setregid(execgid,execgid)<0) goto abandon; |
253 | if(setregid(execgid,execgid)<0) goto abandon; |