Deleted Added
full compact
config.c (234712) config.c (234988)
1/*-
2 * Copyright (c) 2011 James Gritton
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2011 James Gritton
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/usr.sbin/jail/config.c 234712 2012-04-26 17:36:05Z jamie $");
28__FBSDID("$FreeBSD: head/usr.sbin/jail/config.c 234988 2012-05-03 21:39:23Z jamie $");
29
30#include <sys/types.h>
31#include <sys/errno.h>
32#include <sys/socket.h>
33#include <sys/sysctl.h>
34
35#include <arpa/inet.h>
36#include <netinet/in.h>

--- 286 unchanged lines hidden (view full) ---

323 nv->name = strdup(v->name);
324 nv->pos = v->pos;
325 STAILQ_INSERT_TAIL(&ns->vars, nv, tq);
326 }
327 TAILQ_INSERT_TAIL(&nss, ns, tq);
328 }
329 } else {
330 flags = PF_APPEND;
29
30#include <sys/types.h>
31#include <sys/errno.h>
32#include <sys/socket.h>
33#include <sys/sysctl.h>
34
35#include <arpa/inet.h>
36#include <netinet/in.h>

--- 286 unchanged lines hidden (view full) ---

323 nv->name = strdup(v->name);
324 nv->pos = v->pos;
325 STAILQ_INSERT_TAIL(&ns->vars, nv, tq);
326 }
327 TAILQ_INSERT_TAIL(&nss, ns, tq);
328 }
329 } else {
330 flags = PF_APPEND;
331 if (ipnum != 0) {
331 if (ipnum != IP__NULL) {
332 name = intparams[ipnum].name;
333 flags |= intparams[ipnum].flags;
334 } else if ((cs = strchr(value, '='))) {
335 tname = alloca(cs - value + 1);
336 strlcpy(tname, value, cs - value + 1);
337 name = tname;
338 value = cs + 1;
339 } else {

--- 5 unchanged lines hidden (view full) ---

345 ns->s = estrdup(value);
346 ns->len = strlen(value);
347 STAILQ_INIT(&ns->vars);
348 TAILQ_INSERT_TAIL(&nss, ns, tq);
349 }
350 }
351
352 /* See if this parameter has already been added. */
332 name = intparams[ipnum].name;
333 flags |= intparams[ipnum].flags;
334 } else if ((cs = strchr(value, '='))) {
335 tname = alloca(cs - value + 1);
336 strlcpy(tname, value, cs - value + 1);
337 name = tname;
338 value = cs + 1;
339 } else {

--- 5 unchanged lines hidden (view full) ---

345 ns->s = estrdup(value);
346 ns->len = strlen(value);
347 STAILQ_INIT(&ns->vars);
348 TAILQ_INSERT_TAIL(&nss, ns, tq);
349 }
350 }
351
352 /* See if this parameter has already been added. */
353 if (ipnum != 0)
353 if (ipnum != IP__NULL)
354 dp = j->intparams[ipnum];
355 else
356 TAILQ_FOREACH(dp, &j->params, tq)
357 if (!(dp->flags & PF_CONV) && equalopts(dp->name, name))
358 break;
359 if (dp != NULL) {
360 /* Found it - append or replace. */
361 if (strcmp(dp->name, name)) {

--- 8 unchanged lines hidden (view full) ---

370 /* Not found - add it. */
371 np = emalloc(sizeof(struct cfparam));
372 np->name = estrdup(name);
373 TAILQ_INIT(&np->val);
374 TAILQ_CONCAT(&np->val, &nss, tq);
375 np->flags = flags;
376 np->gen = 0;
377 TAILQ_INSERT_TAIL(&j->params, np, tq);
354 dp = j->intparams[ipnum];
355 else
356 TAILQ_FOREACH(dp, &j->params, tq)
357 if (!(dp->flags & PF_CONV) && equalopts(dp->name, name))
358 break;
359 if (dp != NULL) {
360 /* Found it - append or replace. */
361 if (strcmp(dp->name, name)) {

--- 8 unchanged lines hidden (view full) ---

370 /* Not found - add it. */
371 np = emalloc(sizeof(struct cfparam));
372 np->name = estrdup(name);
373 TAILQ_INIT(&np->val);
374 TAILQ_CONCAT(&np->val, &nss, tq);
375 np->flags = flags;
376 np->gen = 0;
377 TAILQ_INSERT_TAIL(&j->params, np, tq);
378 if (ipnum != 0)
378 if (ipnum != IP__NULL)
379 j->intparams[ipnum] = np;
380 else
379 j->intparams[ipnum] = np;
380 else
381 for (ipnum = 1; ipnum < IP_NPARAM; ipnum++)
381 for (ipnum = IP__NULL + 1; ipnum < IP_NPARAM; ipnum++)
382 if (!(intparams[ipnum].flags & PF_CONV) &&
383 equalopts(name, intparams[ipnum].name)) {
384 j->intparams[ipnum] = np;
385 np->flags |= intparams[ipnum].flags;
386 break;
387 }
388 }
389}

--- 442 unchanged lines hidden ---
382 if (!(intparams[ipnum].flags & PF_CONV) &&
383 equalopts(name, intparams[ipnum].name)) {
384 j->intparams[ipnum] = np;
385 np->flags |= intparams[ipnum].flags;
386 break;
387 }
388 }
389}

--- 442 unchanged lines hidden ---