diff options
author | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2012-08-04 15:30:26 +0000 |
---|---|---|
committer | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2012-08-04 15:30:26 +0000 |
commit | bccc36a37ef9b931d2423390593b1e91d4f5e5a7 (patch) | |
tree | bc941c6ce14eb968ca6cbc17cd774399eeb4582d /etc/rc.d/rc.subr | |
parent | c0c54d9ac258a43db0eaa83adbf7eff0a7a10d8f (diff) |
Add a new rc_usercheck variable (default to YES). When set to no, root
privilege is needed to run rc_check.
In effect this means /etc/rc.d/foobar check can now be run as a regular
user.
Discussed with robert@ during g2k12.
ok todd@
Diffstat (limited to 'etc/rc.d/rc.subr')
-rw-r--r-- | etc/rc.d/rc.subr | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr index 33b2d783a59..e5359d99dc5 100644 --- a/etc/rc.d/rc.subr +++ b/etc/rc.d/rc.subr @@ -1,4 +1,4 @@ -# $OpenBSD: rc.subr,v 1.58 2012/07/07 10:28:07 ajacoutot Exp $ +# $OpenBSD: rc.subr,v 1.59 2012/08/04 15:30:25 ajacoutot Exp $ # # Copyright (c) 2010, 2011 Antoine Jacoutot <ajacoutot@openbsd.org> # Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -48,7 +48,7 @@ rc_start() { } rc_check() { - pkill -0 -f "^${pexp}" + pgrep -f "^${pexp}" >/dev/null } rc_reload() { @@ -96,6 +96,10 @@ rc_wait() { rc_cmd() { local _bg _n + [ "$(id -u)" -eq 0 ] || \ + [ X"${rc_usercheck}" != X"NO" -a X"$1" = "Xcheck" ] || \ + rc_err "$0: need root privileges" + if [ -z "${_RC_FORCE}" ] && [ X"${daemon_flags}" = X"NO" ] then if [ -n "${_RC_DEBUG}" ] @@ -167,8 +171,6 @@ rc_cmd() { esac } -[ $(id -u) -eq 0 ] || rc_err "$0: need root privileges" - [ -z "${local_rcconf}" ] && . /etc/rc.conf [ -n "${daemon}" ] || rc_err "$0: daemon is not set" |