Deleted Added
full compact
28c28
< __FBSDID("$FreeBSD: projects/jailconf/usr.sbin/jail/config.c 214433 2010-10-27 20:25:55Z jamie $");
---
> __FBSDID("$FreeBSD: projects/jailconf/usr.sbin/jail/config.c 214649 2010-11-01 21:37:28Z jamie $");
383,421d382
< * Check syntax of internal parameters.
< */
< int
< check_intparams(struct cfjail *j)
< {
< struct cfparam *p;
< const char *val;
< char *ep;
< int error;
<
< error = 0;
< TAILQ_FOREACH(p, &j->params, tq) {
< if (!STAILQ_EMPTY(&p->val) &&
< (p->flags & (PF_BOOL | PF_INT))) {
< val = STAILQ_LAST(&p->val, cfstring, tq)->s;
< if (p->flags & PF_BOOL) {
< if (strcasecmp(val, "false") &&
< strcasecmp(val, "true") &&
< ((void)strtol(val, &ep, 10), *ep)) {
< jail_warnx(j,
< "%s: unknown boolean value \"%s\"",
< p->name, val);
< error = -1;
< }
< } else {
< (void)strtol(val, &ep, 10);
< if (ep == val || *ep) {
< jail_warnx(j,
< "%s: non-integer value \"%s\"",
< p->name, val);
< error = -1;
< }
< }
< }
< }
< return error;
< }
<
< /*
461c422,423
< * Look up extra IP addresses from the hostname and save interface and netmask.
---
> * Check syntax and values of internal parameters. Set some internal
> * parameters based on the values of others.
464c426
< ip_params(struct cfjail *j)
---
> check_intparams(struct cfjail *j)
467c429,431
< struct addrinfo hints, *ai0, *ai;
---
> struct addrinfo hints;
> struct addrinfo *ai0, *ai;
> struct cfparam *p;
468a433
> const char *hostname, *val;
470d434
< const char *hostname;
472c436
< int error, ip4ok, defif, prefix;
---
> int error, gicode, ip4ok, defif, prefix;
481a446,471
> /* Check format of boolan and integer values. */
> TAILQ_FOREACH(p, &j->params, tq) {
> if (!STAILQ_EMPTY(&p->val) &&
> (p->flags & (PF_BOOL | PF_INT))) {
> val = STAILQ_LAST(&p->val, cfstring, tq)->s;
> if (p->flags & PF_BOOL) {
> if (strcasecmp(val, "false") &&
> strcasecmp(val, "true") &&
> ((void)strtol(val, &ep, 10), *ep)) {
> jail_warnx(j,
> "%s: unknown boolean value \"%s\"",
> p->name, val);
> error = -1;
> }
> } else {
> (void)strtol(val, &ep, 10);
> if (ep == val || *ep) {
> jail_warnx(j,
> "%s: non-integer value \"%s\"",
> p->name, val);
> error = -1;
> }
> }
> }
> }
>
486c476,478
< if (bool_param(j->intparams[IP_IP_HOSTNAME]) &&
---
> if (((j->flags & JF_OP_MASK) != JF_STOP ||
> j->intparams[IP_INTERFACE] != NULL) &&
> bool_param(j->intparams[IP_IP_HOSTNAME]) &&
514,515c506,507
< error = getaddrinfo(hostname, NULL, &hints, &ai0);
< if (error != 0) {
---
> gicode = getaddrinfo(hostname, NULL, &hints, &ai0);
> if (gicode != 0) {
517c509
< gai_strerror(error));
---
> gai_strerror(gicode));
557a550
>