Rev 11529 | Rev 12248 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 11529 | Rev 11539 | ||
---|---|---|---|
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 */ |
- | |
50 | 47 | ||
51 | int execuid=15999; |
48 | int execuid=15999; |
52 | int execgid=15999; |
49 | int execgid=15999; |
53 | int must=0; |
50 | int must=0; |
54 | time_t now; |
51 | time_t now; |
Line 234... | Line 231... | ||
234 | stat("bin",&st); execuid=execgid=st.st_uid; |
231 | stat("bin",&st); execuid=execgid=st.st_uid; |
235 | if(test_must()) goto abandon; |
232 | if(test_must()) goto abandon; |
236 | goto ex; |
233 | goto ex; |
237 | } |
234 | } |
238 | if(chroot("../chroot")==0) { |
235 | if(chroot("../chroot")==0) { |
239 |
|
236 | (void)chdir("/tmp"); |
240 | lim.rlim_cur=lim.rlim_max=PROC_QUOTA; |
237 | lim.rlim_cur=lim.rlim_max=PROC_QUOTA; |
241 | setrlimit(RLIMIT_NPROC,&lim); |
238 | setrlimit(RLIMIT_NPROC,&lim); |
242 | setenv("PATH",chroot_path,1); |
239 | setenv("PATH",chroot_path,1); |
243 | p=getenv("w_wims_session"); |
240 | p=getenv("w_wims_session"); |
244 | if(p && *p) { |
241 | if(p && *p) { |
Line 246... | Line 243... | ||
246 | p=strchr(tmpbuf,'_'); if(p) *p=0; |
243 | p=strchr(tmpbuf,'_'); if(p) *p=0; |
247 | setenv("TMPDIR",tmpbuf,1); |
244 | setenv("TMPDIR",tmpbuf,1); |
248 | setenv("tmp_dir",tmpbuf,1); |
245 | setenv("tmp_dir",tmpbuf,1); |
249 | p=getenv("w_wims_priv_chroot"); |
246 | p=getenv("w_wims_priv_chroot"); |
250 | if(p && strstr(p,"tmpdir")!=NULL) |
247 | if(p && strstr(p,"tmpdir")!=NULL) |
251 |
|
248 | (void)chdir(tmpbuf); |
252 | } |
249 | } |
253 | } |
250 | } |
254 | else if(test_must()) goto abandon; |
251 | else if(test_must()) goto abandon; |
255 | ex: |
252 | ex: |
256 | if(setregid(execgid,execgid)<0) goto abandon; |
253 | if(setregid(execgid,execgid)<0) goto abandon; |