Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Oct 2005 23:39:18 +0400
From:      Yar Tikhiy <yar@comp.chem.msu.su>
To:        Dirk Engling <erdgeist@erdgeist.org>
Cc:        freebsd-rc@freebsd.org
Subject:   Re: defunc: /etc/rc.d/jail restart
Message-ID:  <20051020193918.GB69814@comp.chem.msu.su>
In-Reply-To: <4357D422.2000200@erdgeist.org>
References:  <4357D422.2000200@erdgeist.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Oct 20, 2005 at 07:30:10PM +0200, Dirk Engling wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> The /etc/rc.d/jail script does nothing when its restart subcommand is
> called.
> 
> This is due to these lines:
> 
> ##### in /etc/rc.d/jail, line 246ff
> 
> cmd="$1"
> if [ $# -gt 0 ]; then
> ~        shift
> fi
> [ -n "$*" ] && jail_list="$*"
> run_rc_command "${cmd}"
> 
> ##### in /etc/rc.subr, line 773f
> 
> ( $0 ${_rc_prefix}stop $rc_extra_args )
> $0 ${_rc_prefix}start $rc_extra_args

IMHO the source of the problem is these two lines.  I think they
should be replaced by calls to run_rc_command so that the configuration
is read only once by load_rc_config in the first (and the only)
instance of the script.

> ##### in /etc/defaults/rc.conf, line 513
> 
> jail_list=""            # Space separated list of names of jails
> 
> 
> 
> 
> So /etc/rc.d/jail throws away the parameters after saving its value in
> $jail_list. It calls /etc/rc.subr which, for the restart command, then
> calls /etc/rc.d/jail stop and /etc/rc.d/jail start, which both in turn
> source /etc/defaults/rc.conf, which again clears $jail_list.
> 
> My suggestion would be to let /etc/defaults/* just do the job it is
> being meant for: providing defaults. This would lead to the following diff.
> 
> 
> - --- rc.conf     Thu Oct 20 19:25:13 2005
> +++ rc.conf_old Thu Oct 20 19:24:16 2005
> @@ -510,7 +510,7 @@
> ~ ### Jail Configuration #######################################
> ~ ##############################################################
> ~ jail_enable="NO"       # Set to NO to disable starting of any jails
> - -jail_list=${jail_list:-""} # Space separated list of names of jails
> +jail_list=""           # Space separated list of names of jails
> ~ jail_set_hostname_allow="YES" # Allow root user in a jail to change its
> hostname
> ~ jail_socket_unixiproute_only="YES" # Route only TCP/IP within a jail
> ~ jail_sysvipc_allow="NO"        # Allow SystemV IPC use from within a jail
> 
> 
> However, theres lots of variables that should not be reset if already
> set, I might want to call /etc/rc.d/jail having set up some variables
> (including jail_list) myself (which in fact I tried in another project).
> 
> Are there any situation, where accepting variables from environment of
> caller can be harmful?
> 
> Regards
> 
> ~  Dirk Engling
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.6 (Darwin)
> 
> iD8DBQFDV9QiImmQdUyYEgkRAm9MAKCOYcJOBj8hQFGcdgGJ/lwRkQnRhACeNjVt
> Edbt/WyJy/NtcOEHuS+L4cc=
> =jjHt
> -----END PGP SIGNATURE-----
> _______________________________________________
> freebsd-rc@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-rc
> To unsubscribe, send any mail to "freebsd-rc-unsubscribe@freebsd.org"

-- 
Yar



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051020193918.GB69814>