Browse Source

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@
OPENBSD_5_3
ajacoutot 12 years ago
parent
commit
645a3e85e0
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      src/etc/rc.d/rc.subr

+ 6
- 4
src/etc/rc.d/rc.subr View File

@ -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"


Loading…
Cancel
Save