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;
                        }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to