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 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 } |
600 s->len = cs - s->s; |
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 } |
623 s->len = cs - s->s; |
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) { |
715 memcpy(cs, s->s, s->len); |
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 --- |