config.c (235789) | config.c (239601) |
---|---|
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 235789 2012-05-22 16:33:10Z bapt $"); | 28__FBSDID("$FreeBSD: head/usr.sbin/jail/config.c 239601 2012-08-23 01:43:01Z 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> --- 555 unchanged lines hidden (view full) --- 592 prefix = strtol(cs + 1, &ep, 10); 593 if (*ep == '.' 594 ? inet_pton(AF_INET, cs + 1, &addr4) != 1 595 : *ep || prefix < 0 || prefix > 32) { 596 jail_warnx(j, 597 "ip4.addr: bad netmask \"%s\"", cs); 598 error = -1; 599 } | 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> --- 555 unchanged lines hidden (view full) --- 592 prefix = strtol(cs + 1, &ep, 10); 593 if (*ep == '.' 594 ? inet_pton(AF_INET, cs + 1, &addr4) != 1 595 : *ep || prefix < 0 || prefix > 32) { 596 jail_warnx(j, 597 "ip4.addr: bad netmask \"%s\"", cs); 598 error = -1; 599 } |
600 *cs = '\0'; 601 s->len = cs - s->s + 1; | 600 s->len = cs - s->s; |
602 } 603 } 604 } 605#endif 606#ifdef INET6 607 if (j->intparams[KP_IP6_ADDR] != NULL) { 608 TAILQ_FOREACH(s, &j->intparams[KP_IP6_ADDR]->val, tq) { 609 cs = strchr(s->s, '|'); --- 6 unchanged lines hidden (view full) --- 616 if ((cs = strchr(s->s, '/'))) { 617 prefix = strtol(cs + 1, &ep, 10); 618 if (*ep || prefix < 0 || prefix > 128) { 619 jail_warnx(j, 620 "ip6.addr: bad prefixlen \"%s\"", 621 cs); 622 error = -1; 623 } | 601 } 602 } 603 } 604#endif 605#ifdef INET6 606 if (j->intparams[KP_IP6_ADDR] != NULL) { 607 TAILQ_FOREACH(s, &j->intparams[KP_IP6_ADDR]->val, tq) { 608 cs = strchr(s->s, '|'); --- 6 unchanged lines hidden (view full) --- 615 if ((cs = strchr(s->s, '/'))) { 616 prefix = strtol(cs + 1, &ep, 10); 617 if (*ep || prefix < 0 || prefix > 128) { 618 jail_warnx(j, 619 "ip6.addr: bad prefixlen \"%s\"", 620 cs); 621 error = -1; 622 } |
624 *cs = '\0'; 625 s->len = cs - s->s + 1; | 623 s->len = cs - s->s; |
626 } 627 } 628 } 629#endif 630#endif 631 632 /* 633 * Read mount.fstab file(s), and treat each line as its own mount --- 75 unchanged lines hidden (view full) --- 709 * jailparam_import will then convert back into arrays. 710 */ 711 vallen = 0; 712 TAILQ_FOREACH(s, &p->val, tq) 713 vallen += s->len + 1; 714 value = alloca(vallen); 715 cs = value; 716 TAILQ_FOREACH_SAFE(s, &p->val, tq, ts) { | 624 } 625 } 626 } 627#endif 628#endif 629 630 /* 631 * Read mount.fstab file(s), and treat each line as its own mount --- 75 unchanged lines hidden (view full) --- 707 * jailparam_import will then convert back into arrays. 708 */ 709 vallen = 0; 710 TAILQ_FOREACH(s, &p->val, tq) 711 vallen += s->len + 1; 712 value = alloca(vallen); 713 cs = value; 714 TAILQ_FOREACH_SAFE(s, &p->val, tq, ts) { |
717 strcpy(cs, s->s); | 715 memcpy(cs, s->s, s->len); |
718 if (ts != NULL) { 719 cs += s->len + 1; 720 cs[-1] = ','; 721 } 722 } 723 } 724 if (jailparam_import(jp, value) < 0) { 725 error = -1; --- 108 unchanged lines hidden --- | 716 if (ts != NULL) { 717 cs += s->len + 1; 718 cs[-1] = ','; 719 } 720 } 721 } 722 if (jailparam_import(jp, value) < 0) { 723 error = -1; --- 108 unchanged lines hidden --- |