Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Aug 2020 17:04:56 +0000 (UTC)
From:      Jamie Gritton <jamie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r364874 - head/usr.sbin/jail
Message-ID:  <202008271704.07RH4uiw052770@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jamie
Date: Thu Aug 27 17:04:55 2020
New Revision: 364874
URL: https://svnweb.freebsd.org/changeset/base/364874

Log:
  Disregard jails in jail.conf that have bad parameters (parameter/variable
  clash, or redefining name/jid).  The current behvaior, of merely warning
  and moving on, can lead to unexpected behavior when a jail is created
  without the offending parameter defined at all.

Modified:
  head/usr.sbin/jail/config.c

Modified: head/usr.sbin/jail/config.c
==============================================================================
--- head/usr.sbin/jail/config.c	Thu Aug 27 16:36:07 2020	(r364873)
+++ head/usr.sbin/jail/config.c	Thu Aug 27 17:04:55 2020	(r364874)
@@ -369,11 +369,13 @@ add_param(struct cfjail *j, const struct cfparam *p, e
 		if ((flags ^ dp->flags) & PF_VAR) {
 			jail_warnx(j, "variable \"$%s\" cannot have the same "
 			    "name as a parameter.", name);
+			j->flags |= JF_FAILED;
 			return;
 		}
 		if (dp->flags & PF_IMMUTABLE) {
 			jail_warnx(j, "cannot redefine parameter \"%s\".",
 			    dp->name);
+			j->flags |= JF_FAILED;
 			return;
 		}
 		if (strcmp(dp->name, name)) {
@@ -405,6 +407,7 @@ add_param(struct cfjail *j, const struct cfparam *p, e
 						    "cannot have the same "
 						    "name as a parameter.",
 						    name);
+						j->flags |= JF_FAILED;
 						return;
 					}
 					j->intparams[ipnum] = np;



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