aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/jail/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/jail/config.c')
-rw-r--r--usr.sbin/jail/config.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/usr.sbin/jail/config.c b/usr.sbin/jail/config.c
index 3af0088626c9..1bad04ccde68 100644
--- a/usr.sbin/jail/config.c
+++ b/usr.sbin/jail/config.c
@@ -156,11 +156,14 @@ load_config(const char *cfname)
TAILQ_CONCAT(&opp, &j->params, tq);
/*
* The jail name implies its "name" or "jid" parameter,
- * though they may also be explicitly set later on.
+ * though they may also be explicitly set later on. After we
+ * collect other parameters, we'll go back and ensure they're
+ * both set if we need to do so here.
*/
add_param(j, NULL,
strtol(j->name, &ep, 10) && !*ep ? KP_JID : KP_NAME,
j->name);
+
/*
* Collect parameters for the jail, global parameters/variables,
* and any matching wildcard jails.
@@ -180,6 +183,14 @@ load_config(const char *cfname)
TAILQ_FOREACH(p, &opp, tq)
add_param(j, p, 0, NULL);
+ /*
+ * We only backfill if it's the name that wasn't set; if it was
+ * the jid, we can assume that will be populated later when the
+ * jail is created or found.
+ */
+ if (j->intparams[KP_NAME] == NULL)
+ add_param(j, NULL, KP_NAME, j->name);
+
/* Resolve any variable substitutions. */
pgen = 0;
TAILQ_FOREACH(p, &j->params, tq) {