Page MenuHomeFreeBSD

D7474.1783958415.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D7474.1783958415.diff

Index: etc/defaults/rc.conf
===================================================================
--- etc/defaults/rc.conf
+++ etc/defaults/rc.conf
@@ -314,6 +314,7 @@
pppoed_flags="-P /var/run/pppoed.pid" # Flags to pppoed (if enabled).
pppoed_interface="fxp0" # The interface that pppoed runs on.
sshd_enable="NO" # Enable sshd
+sshd_supervise="NO" # Automatically restart sshd
sshd_program="/usr/sbin/sshd" # path to sshd, if you want a different one.
sshd_flags="" # Additional flags for sshd.
ftpd_enable="NO" # Enable stand-alone ftpd.
Index: etc/rc.d/sshd
===================================================================
--- etc/rc.d/sshd
+++ etc/rc.d/sshd
@@ -85,4 +85,11 @@
}
load_rc_config $name
+if checkyesno sshd_supervise
+then
+ procname="daemon"
+ pidfile="/var/run/sshd-daemon.pid"
+ sshd_daemon="-r -P ${pidfile}"
+ sshd_flags="${sshd_flags} -D"
+fi
run_rc_command "$1"
Index: etc/rc.subr
===================================================================
--- etc/rc.subr
+++ etc/rc.subr
@@ -746,6 +746,9 @@
# ${name}_chdir n Directory to cd to before running ${command}
# (if not using ${name}_chroot).
#
+# ${name}_daemon n Arguments to pass to daemon(8) before
+# running ${command}.
+#
# ${name}_flags n Arguments to call ${command} with.
# NOTE: $flags from the parent environment
# can be used to override this.
@@ -952,7 +955,7 @@
_group=\$${name}_group _groups=\$${name}_groups \
_fib=\$${name}_fib _env=\$${name}_env \
_prepend=\$${name}_prepend _login_class=\${${name}_login_class:-daemon} \
- _oomprotect=\$${name}_oomprotect
+ _oomprotect=\$${name}_oomprotect _daemon=\$${name}_daemon
if [ -n "$_user" ]; then # unset $_user if running as that user
if [ "$_user" = "$(eval $IDCMD)" ]; then
@@ -1044,19 +1047,22 @@
# setup the full command to run
#
check_startmsgs && echo "Starting ${name}."
+ _doit="$command $rc_flags $command_args"
+ if [ -n "$_daemon" ]; then
+ _doit="daemon $_daemon $_doit"
+ fi
if [ -n "$_chroot" ]; then
_doit="\
${_nice:+nice -n $_nice }\
${_fib:+setfib -F $_fib }\
${_env:+env $_env }\
chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
-$_chroot $command $rc_flags $command_args"
+$_chroot $_doit"
else
_doit="\
${_chdir:+cd $_chdir && }\
${_fib:+setfib -F $_fib }\
-${_env:+env $_env }\
-$command $rc_flags $command_args"
+${_env:+env $_env } $_doit"
if [ -n "$_user" ]; then
_doit="su -m $_user -c 'sh -c \"$_doit\"'"
fi

File Metadata

Mime Type
text/plain
Expires
Mon, Jul 13, 4:00 PM (2 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29113849
Default Alt Text
D7474.1783958415.diff (2 KB)

Event Timeline