From: ajacoutot Date: Mon, 12 Jan 2015 14:40:35 +0000 (+0000) Subject: Make sure the given user exists. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=cb15d449de3c979e4dfee7b8eaa3f4b99b15a759;p=openbsd Make sure the given user exists. "I like it" sthen@ ok robert@ --- diff --git a/usr.sbin/rcctl/rcctl.sh b/usr.sbin/rcctl/rcctl.sh index 93b20b9ddc1..b1f8de88bdc 100644 --- a/usr.sbin/rcctl/rcctl.sh +++ b/usr.sbin/rcctl/rcctl.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: rcctl.sh,v 1.62 2015/01/12 13:51:20 ajacoutot Exp $ +# $OpenBSD: rcctl.sh,v 1.63 2015/01/12 14:40:35 ajacoutot Exp $ # # Copyright (c) 2014, 2015 Antoine Jacoutot # Copyright (c) 2014 Ingo Schwarze @@ -308,6 +308,10 @@ svc_set() [[ ${_args} != +([[:digit:]]) || ${_args} -le 0 ]] && \ _rc_err "${0##*/}: \"${_args}\" is not a positive integer" fi + if [ "${_var}" = "user" ]; then + getent passwd "${_args}" >/dev/null || \ + _rc_err "${0##*/}: user \"${_args}\" does not exist" + fi # unset flags if they match the default enabled ones [ "${_args}" = "$(svc_getdef ${_svc} ${_var})" ] && \ unset _args