Rev 7843 | Rev 8171 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7843 | Rev 8155 | ||
---|---|---|---|
Line 251... | Line 251... | ||
251 | if(mode==mode_default) sess=getvar("wims_session"); |
251 | if(mode==mode_default) sess=getvar("wims_session"); |
252 | else sess="popup"; |
252 | else sess="popup"; |
253 | if(sess==NULL) sess="----------"; |
253 | if(sess==NULL) sess="----------"; |
254 | p=getvar(ro_name[ro_module]); |
254 | p=getvar(ro_name[ro_module]); |
255 | if(p==NULL || *p==0) p="-"; |
255 | if(p==NULL || *p==0) p="-"; |
256 |
|
256 | /* limit module name to 40 chars */ |
257 | i=strlen(p); if(i>40) p+=i-40; |
257 | i=strlen(p); if(i>40) p+=i-40; |
258 | if(robot_access) { |
258 | if(robot_access) { |
259 | agent=getenv("HTTP_USER_AGENT"); if(agent==NULL) agent="-"; |
259 | agent=getenv("HTTP_USER_AGENT"); if(agent==NULL) agent="-"; |
260 | snprintf(ag,sizeof(ag)," %s",agent); |
260 | snprintf(ag,sizeof(ag)," %s",agent); |
261 | } |
261 | } |
Line 292... | Line 292... | ||
292 | if(mode==mode_default) sess=getvar("wims_session"); |
292 | if(mode==mode_default) sess=getvar("wims_session"); |
293 | else sess="popup"; |
293 | else sess="popup"; |
294 | if(sess==NULL) sess="----------"; |
294 | if(sess==NULL) sess="----------"; |
295 | p=getvar(ro_name[ro_module]); |
295 | p=getvar(ro_name[ro_module]); |
296 | if(p==NULL || *p==0) p="-"; |
296 | if(p==NULL || *p==0) p="-"; |
297 |
|
297 | /* limit module name to 40 chars */ |
298 | i=strlen(p); if(i>40) p+=i-40; |
298 | i=strlen(p); if(i>40) p+=i-40; |
299 | s=strchr(sess,'_'); if(s==NULL) s=sess+strlen(sess); |
299 | s=strchr(sess,'_'); if(s==NULL) s=sess+strlen(sess); |
300 | if(s<sess+4) s=sess; else s=s-4; |
300 | if(s<sess+4) s=sess; else s=s-4; |
301 | cl=getvar("wims_class"); if(cl==NULL) cl=""; |
301 | cl=getvar("wims_class"); if(cl==NULL) cl=""; |
302 | snprintf(tmplbuf,sizeof(tmplbuf),"%s %.6s %s\11%s\11%s\11%s", |
302 | snprintf(tmplbuf,sizeof(tmplbuf),"%s %.6s %s\11%s\11%s\11%s", |
Line 397... | Line 397... | ||
397 | { |
397 | { |
398 | char *arg[]={"../bin/wimslogd",NULL}; |
398 | char *arg[]={"../bin/wimslogd",NULL}; |
399 | struct stat st; |
399 | struct stat st; |
400 | pid_t pid; |
400 | pid_t pid; |
401 | 401 | ||
402 |
|
402 | /* need to update wimslogd? */ |
403 | if(stat(newlogd,&st)==0) { |
403 | if(stat(newlogd,&st)==0) { |
404 | if((S_IXUSR&st.st_mode)!=0 && st.st_size>40000 && st.st_size<200000) |
404 | if((S_IXUSR&st.st_mode)!=0 && st.st_size>40000 && st.st_size<200000) |
405 | call_ssh("mv %s %s",newlogd,arg[0]); |
405 | call_ssh("mv %s %s",newlogd,arg[0]); |
406 | else call_ssh("rm -f %s",newlogd); |
406 | else call_ssh("rm -f %s",newlogd); |
407 | } |
407 | } |
408 | pid=fork(); if(pid) return; /* parent */ |
408 | pid=fork(); if(pid) return; /* parent */ |
409 |
|
409 | /* double fork to escape sysmask orphan. */ |
410 | pid=fork(); if(pid) { /* secondary parent */ |
410 | pid=fork(); if(pid) { /* secondary parent */ |
411 | snprintf(tmplbuf,sizeof(tmplbuf),"%u",pid); |
411 | snprintf(tmplbuf,sizeof(tmplbuf),"%u",pid); |
412 | mkdirs("../tmp/log"); |
412 | mkdirs("../tmp/log"); |
413 | chmod("../tmp/log",S_IRUSR|S_IWUSR|S_IXUSR); |
413 | chmod("../tmp/log",S_IRUSR|S_IWUSR|S_IXUSR); |
414 | accessfile(tmplbuf,"w",logdpid); |
414 | accessfile(tmplbuf,"w",logdpid); |