Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jan 2016 04:37:16 +0000 (UTC)
From:      Jamie Gritton <jamie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r294484 - stable/10/usr.sbin/jail
Message-ID:  <201601210437.u0L4bGxX065657@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jamie
Date: Thu Jan 21 04:37:16 2016
New Revision: 294484
URL: https://svnweb.freebsd.org/changeset/base/294484

Log:
  MFC r294183:
  
    Clear errno before calling getpw*.
  
  MFC r294196:
  
    Don't bother checking an ip[46].addr netmask/prefixlen.  This is already
    handled by ifconfig, and it was doing it wrong when the paramater included
    extra ifconfig options.
  
  PR:		205926

Modified:
  stable/10/usr.sbin/jail/command.c
  stable/10/usr.sbin/jail/config.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/jail/command.c
==============================================================================
--- stable/10/usr.sbin/jail/command.c	Thu Jan 21 03:05:03 2016	(r294483)
+++ stable/10/usr.sbin/jail/command.c	Thu Jan 21 04:37:16 2016	(r294484)
@@ -878,6 +878,7 @@ get_user_info(struct cfjail *j, const ch
 {
 	const struct passwd *pwd;
 
+	errno = 0;
 	*pwdp = pwd = username ? getpwnam(username) : getpwuid(getuid());
 	if (pwd == NULL) {
 		if (errno)

Modified: stable/10/usr.sbin/jail/config.c
==============================================================================
--- stable/10/usr.sbin/jail/config.c	Thu Jan 21 03:05:03 2016	(r294483)
+++ stable/10/usr.sbin/jail/config.c	Thu Jan 21 04:37:16 2016	(r294484)
@@ -454,7 +454,7 @@ check_intparams(struct cfjail *j)
 	struct addrinfo hints;
 	struct addrinfo *ai0, *ai;
 	const char *hostname;
-	int gicode, defif, prefix;
+	int gicode, defif;
 #endif
 #ifdef INET
 	struct in_addr addr4;
@@ -597,15 +597,7 @@ check_intparams(struct cfjail *j)
 				strcpy(s->s, cs + 1);
 				s->len -= cs + 1 - s->s;
 			}
-			if ((cs = strchr(s->s, '/'))) {
-				prefix = strtol(cs + 1, &ep, 10);
-				if (*ep == '.'
-				    ? inet_pton(AF_INET, cs + 1, &addr4) != 1
-				    : *ep || prefix < 0 || prefix > 32) {
-					jail_warnx(j,
-					    "ip4.addr: bad netmask \"%s\"", cs);
-					error = -1;	
-				}
+			if ((cs = strchr(s->s, '/')) != NULL) {
 				*cs = '\0';
 				s->len = cs - s->s;
 			}
@@ -626,14 +618,7 @@ check_intparams(struct cfjail *j)
 				strcpy(s->s, cs + 1);
 				s->len -= cs + 1 - s->s;
 			}
-			if ((cs = strchr(s->s, '/'))) {
-				prefix = strtol(cs + 1, &ep, 10);
-				if (*ep || prefix < 0 || prefix > 128) {
-					jail_warnx(j,
-					    "ip6.addr: bad prefixlen \"%s\"",
-					    cs);
-					error = -1;	
-				}
+			if ((cs = strchr(s->s, '/')) != NULL) {
 				*cs = '\0';
 				s->len = cs - s->s;
 			}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601210437.u0L4bGxX065657>