- fixed SECURITY BUG (user scripts where executed as root), thx to Achim!
-> use 3 variables (MAX_DAYS_RCVD, MAX_DAYS_DONE, MAX_DAYS_FAILED) which are all read from /etc/capisuite/cronjob.conf now -> don't read cronjob.conf's in other dirs any more git-svn-id: https://svn.ibp.de/svn/capisuite/trunk/capisuite@71 4ebea2bb-67d4-0310-8558-a5799e421b66
This commit is contained in:
parent
804f6eefc3
commit
49c31cff14
|
@ -1,13 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# capisuite. CapiSuite cleanup script, should be run regularly
|
# CapiSuite cleanup script, should be run regularly
|
||||||
# by cron. It's only useful for the default scripts provided
|
# by cron. It's only useful for the default scripts provided
|
||||||
# with CapiSuite.
|
# with CapiSuite.
|
||||||
#
|
#
|
||||||
# It will read a central configuration file placed in
|
# It will read a central configuration file placed in
|
||||||
# /etc/capisuite/cronjob.conf where you must define a variable
|
# @pkgsysconfdir@/cronjob.conf where you must define variables
|
||||||
# called MAX_DAYS which defines how many days a received or sent
|
# which defines how many days a file may stay in the spool dirs
|
||||||
# file may stay in the spool dirs.
|
|
||||||
#
|
#
|
||||||
# Author: Gernot Hillier <gernot@hillier.de>
|
# Author: Gernot Hillier <gernot@hillier.de>
|
||||||
#
|
#
|
||||||
|
@ -20,19 +19,31 @@ umask 022
|
||||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
export PATH
|
export PATH
|
||||||
|
|
||||||
|
# make sure default values are set
|
||||||
|
MAX_DAYS_RCVD=0
|
||||||
|
MAX_DAYS_DONE=0
|
||||||
|
MAX_DAYS_FAILED=0
|
||||||
|
|
||||||
# do nothing if there is no global config
|
# do nothing if there is no global config
|
||||||
test -r @pkgsysconfdir@/cronjob.conf || exit
|
test -r @pkgsysconfdir@/cronjob.conf || exit
|
||||||
|
# read cronjob.conf
|
||||||
|
. @pkgsysconfdir@/cronjob.conf
|
||||||
|
|
||||||
for i in @spooldir@/users/*/received @spooldir@/done @spooldir@/failed; do
|
if test "$MAX_DAYS_RCVD" -gt 0; then
|
||||||
# reset defaults
|
for i in `find @spooldir@/users/ -mindepth 2 -maxdepth 2 -type d -name received`; do
|
||||||
test -r @pkgsysconfdir@/cronjob.conf && . @pkgsysconfdir@/cronjob.conf
|
find $i/. -name "*fax-[0-9]*.*" ! -type d ! -type s -atime +$MAX_DAYS_RCVD -exec rm {} \;
|
||||||
# user can overwrite default values
|
find $i/. -name "*voice-[0-9]*.*" ! -type d ! -type s -atime +$MAX_DAYS_RCVD -exec rm {} \;
|
||||||
test -r $i/cronjob.conf && . $i/cronjob.conf
|
done
|
||||||
|
fi
|
||||||
test "$MAX_DAYS" -gt 0 2> /dev/null || continue
|
|
||||||
find $i/. -name "*fax-[0-9]*.*" ! -type d ! -type s -atime +$MAX_DAYS -exec rm {} \; 2>/dev/null
|
if test "$MAX_DAYS_DONE" -gt 0; then
|
||||||
find $i/. -name "*voice-[0-9]*.*" ! -type d ! -type s -atime +$MAX_DAYS -exec rm {} \; 2>/dev/null
|
find @spooldir@/done/. -name "*fax-[0-9]*.*" ! -type d ! -type s -atime +$MAX_DAYS_DONE -exec rm {} \;
|
||||||
done;
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$MAX_DAYS_FAILED" -gt 0; then
|
||||||
|
find @spooldir@/failed/. -name "*fax-[0-9]*.*" ! -type d ! -type s -atime +$MAX_DAYS_FAILED -exec rm {} \;
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue