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 11529 | ||
---|---|---|---|
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 | ||
- | 48 | void inline IGNORE() {} /* Ignore GCC Unused Result */ |
|
- | 49 | void IGNORE(); /* see http://stackoverflow.com/a/16245669/490291 */ |
|
47 | 50 | ||
48 | int execuid=15999; |
51 | int execuid=15999; |
49 | int execgid=15999; |
52 | int execgid=15999; |
50 | int must=0; |
53 | int must=0; |
51 | time_t now; |
54 | time_t now; |
Line 231... | Line 234... | ||
231 | stat("bin",&st); execuid=execgid=st.st_uid; |
234 | stat("bin",&st); execuid=execgid=st.st_uid; |
232 | if(test_must()) goto abandon; |
235 | if(test_must()) goto abandon; |
233 | goto ex; |
236 | goto ex; |
234 | } |
237 | } |
235 | if(chroot("../chroot")==0) { |
238 | if(chroot("../chroot")==0) { |
236 | ( |
239 | IGNORE(chdir("/tmp")); |
237 | lim.rlim_cur=lim.rlim_max=PROC_QUOTA; |
240 | lim.rlim_cur=lim.rlim_max=PROC_QUOTA; |
238 | setrlimit(RLIMIT_NPROC,&lim); |
241 | setrlimit(RLIMIT_NPROC,&lim); |
239 | setenv("PATH",chroot_path,1); |
242 | setenv("PATH",chroot_path,1); |
240 | p=getenv("w_wims_session"); |
243 | p=getenv("w_wims_session"); |
241 | if(p && *p) { |
244 | if(p && *p) { |
Line 243... | Line 246... | ||
243 | p=strchr(tmpbuf,'_'); if(p) *p=0; |
246 | p=strchr(tmpbuf,'_'); if(p) *p=0; |
244 | setenv("TMPDIR",tmpbuf,1); |
247 | setenv("TMPDIR",tmpbuf,1); |
245 | setenv("tmp_dir",tmpbuf,1); |
248 | setenv("tmp_dir",tmpbuf,1); |
246 | p=getenv("w_wims_priv_chroot"); |
249 | p=getenv("w_wims_priv_chroot"); |
247 | if(p && strstr(p,"tmpdir")!=NULL) |
250 | if(p && strstr(p,"tmpdir")!=NULL) |
248 | ( |
251 | IGNORE(chdir(tmpbuf)); |
249 | } |
252 | } |
250 | } |
253 | } |
251 | else if(test_must()) goto abandon; |
254 | else if(test_must()) goto abandon; |
252 | ex: |
255 | ex: |
253 | if(setregid(execgid,execgid)<0) goto abandon; |
256 | if(setregid(execgid,execgid)<0) goto abandon; |