MFC r279083:

Fix the logic for skipping parameters (with -s) that have "jailsys"
  parents (such as host.hostname); these were being skipped all the time.
  That it went this long without anyone noticing is a sign that this feature
  isn't actually used by anyone, but it's there so it might as well work.

MFC r279123:

  Allow for parameters added with the JP_OPT flag to not exist.
  That's why the flag exists in the first place.
This commit is contained in:
jamie 2015-02-27 02:53:44 +00:00
parent 23006cc982
commit 4e65f612d1

View File

@ -78,7 +78,7 @@ static void quoted_print(char *str);
int
main(int argc, char **argv)
{
char *dot, *ep, *jname;
char *dot, *ep, *jname, *pname;
int c, i, jflags, jid, lastjid, pflags, spc;
jname = NULL;
@ -178,10 +178,11 @@ main(int argc, char **argv)
for (i = 0; i < nparams; i++) {
if ((params[i].jp_flags & JP_USER) &&
(dot = strchr(params[i].jp_name, '.'))) {
*dot = 0;
param_parent[i] = add_param(params[i].jp_name,
pname = alloca((dot - params[i].jp_name) + 1);
strlcpy(pname, params[i].jp_name,
(dot - params[i].jp_name) + 1);
param_parent[i] = add_param(pname,
NULL, (size_t)0, NULL, JP_OPT);
*dot = '.';
}
}
}
@ -293,10 +294,8 @@ add_param(const char *name, void *value, size_t valuelen,
param->jp_flags |= flags;
return param - params;
}
if (jailparam_init(param, name) < 0)
errx(1, "%s", jail_errmsg);
param->jp_flags = flags;
if ((value != NULL ? jailparam_import_raw(param, value, valuelen)
if (jailparam_init(param, name) < 0 ||
(value != NULL ? jailparam_import_raw(param, value, valuelen)
: jailparam_import(param, value)) < 0) {
if (flags & JP_OPT) {
nparams--;
@ -304,6 +303,7 @@ add_param(const char *name, void *value, size_t valuelen,
}
errx(1, "%s", jail_errmsg);
}
param->jp_flags = flags;
return param - params;
}