1 diff -Nur rc-scripts-0.3.1.orig/rc.d/init.d/functions rc-scripts-0.3.1/rc.d/init.d/functions
2 --- rc-scripts-0.3.1.orig/rc.d/init.d/functions 2002-01-13 04:40:42.000000000 +0100
3 +++ rc-scripts-0.3.1/rc.d/init.d/functions 2003-08-12 23:35:08.555241552 +0200
8 -# A function to start a program (now it's usefull on read-only filesystem too)
9 +# A function to start a program (now it's useful on read-only filesystem too)
12 - typeset errors="" prog=""
13 + typeset errors="" prog="" limits_hard="" limits_soft=""
14 typeset -i exit_code=0
15 [ -z "$DEFAULT_SERVICE_RUN_NICE_LEVEL" ] && DEFAULT_SERVICE_RUN_NICE_LEVEL=0
16 - # Test syntax. Don't use -o instead || here - this will broke ksh --misiek
17 + # "-u unlimited" (-p for ksh) to make sure daemons will be able to fork.
18 + # "-c 0" to make sure it doesn't core dump anywhere; while this could mask
19 + # problems with the daemon, it also closes some security problems.
20 + # Users' limits are set via pam_limits.
21 + [ -z "$DEFAULT_SERVICE_LIMITS_HARD" ] && DEFAULT_SERVICE_LIMITS_HARD="-c 0"
22 + [ -z "$DEFAULT_SERVICE_LIMITS_SOFT" ] && DEFAULT_SERVICE_LIMITS_SOFT="-u unlimited -c 0"
23 + # Test syntax. Don't use -o instead || here - this will break ksh --misiek
24 while [ "$1" != "${1##-}" ] || [ "$1" != "${1##+}" ]; do
26 '') msg_usage " daemon [--user user] [+/-nicelevel] {program}"
31 - # make sure it doesn't core dump anywhere; while this could mask
32 - # problems with the daemon, it also closes some security problems
35 - # Make sure daemons will be able to fork.
36 - # Limits are set via pam_limits.
37 if [ -n "$KSH_VERSION" ]; then
39 + limits_hard="`echo ${SERVICE_LIMITS_HARD:-$DEFAULT_SERVICE_LIMITS_HARD} | sed -e 's/-u/-p/'`"
40 + limits_soft="`echo ${SERVICE_LIMITS_SOFT:-$DEFAULT_SERVICE_LIMITS_SOFT} | sed -e 's/-u/-p/'`"
41 elif [ -n "$ZSH_VERSION" ]; then
43 + limits_hard="${SERVICE_LIMITS_HARD:-$DEFAULT_SERVICE_LIMITS_HARD}"
44 + limits_soft="${SERVICE_LIMITS_SOFT:-$DEFAULT_SERVICE_LIMITS_SOFT}"
45 elif [ -n "$BASH_VERSION" ]; then
47 + limits_hard="${SERVICE_LIMITS_HARD:-$DEFAULT_SERVICE_LIMITS_HARD}"
48 + limits_soft="${SERVICE_LIMITS_SOFT:-$DEFAULT_SERVICE_LIMITS_SOFT}"
49 # elif [ -n "`$SH -c 'echo ${.sh.version}' 2>/dev/null`" ]; then
51 + # soft limits first - it's impossible to set hard limit lower than existing soft
52 + while echo "$limits_soft" | grep -q '[^ ]'; do
53 + ulimit -S `echo ${limits_soft} | sed -e 's/^ *\(-[^-]*\)\(-.*\)\?$/\1/'`
54 + limits_soft="`echo ${limits_soft} | sed -e 's/^ *\(-[^-]*\)\(-.*\)\?$/\2/'`"
56 + while echo "$limits_hard" | grep -q '[^ ]'; do
57 + ulimit -H `echo ${limits_hard} | sed -e 's/^ *\(-[^-]*\)\(-.*\)\?$/\1/'`
58 + limits_hard="`echo ${limits_hard} | sed -e 's/^ *\(-[^-]*\)\(-.*\)\?$/\2/'`"
63 diff -Nur rc-scripts-0.3.1.orig/sysconfig/system rc-scripts-0.3.1/sysconfig/system
64 --- rc-scripts-0.3.1.orig/sysconfig/system 2001-05-15 18:05:59.000000000 +0200
65 +++ rc-scripts-0.3.1/sysconfig/system 2003-08-12 23:32:38.022126064 +0200
67 # $SERVICE_RUN_NICE_LEVEL is not defined in /etc/sysconfig/<service>
68 DEFAULT_SERVICE_RUN_NICE_LEVEL=0
70 +# Default limits set before running demons (hard and soft) if
71 +# $SERVICE_LIMITS_{HARD,SOFT} are not defined in /etc/sysconfig/<service>
72 +# Use "-u" for process limits (automatically translated to "-p" for ksh).
73 +# Advised limits are:
74 +# "-u unlimited" to make sure daemons will be able to fork;
75 +# "-c 0" to make sure it doesn't core dump anywhere; while this could mask
76 +# problems with the daemon, it also closes some security problems;
77 +# users' limits are set via pam_limits.
78 +# NOTE: soft limit MUST NOT exceed hard!
79 +DEFAULT_SERVICE_LIMITS_HARD="-u unlimited -c 0"
80 +DEFAULT_SERVICE_LIMITS_SOFT="-c 0"
82 # Run isapnp at system startup ?