diff options
author | jamie <jamie@FreeBSD.org> | 2016-01-21 04:37:16 +0000 |
---|---|---|
committer | jamie <jamie@FreeBSD.org> | 2016-01-21 04:37:16 +0000 |
commit | edc9e0e402414ef2f54058cbe73a30a47e4ac6bd (patch) | |
tree | d366d0c09387d39eca8a7bb1254a49492040c066 /usr.sbin | |
parent | ad88a89c7950729640aaf6edf3e70a5aad90663c (diff) | |
download | FreeBSD-src-edc9e0e402414ef2f54058cbe73a30a47e4ac6bd.zip FreeBSD-src-edc9e0e402414ef2f54058cbe73a30a47e4ac6bd.tar.gz |
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
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/jail/command.c | 1 | ||||
-rw-r--r-- | usr.sbin/jail/config.c | 21 |
2 files changed, 4 insertions, 18 deletions
diff --git a/usr.sbin/jail/command.c b/usr.sbin/jail/command.c index a170b30..805251f 100644 --- a/usr.sbin/jail/command.c +++ b/usr.sbin/jail/command.c @@ -878,6 +878,7 @@ get_user_info(struct cfjail *j, const char *username, { const struct passwd *pwd; + errno = 0; *pwdp = pwd = username ? getpwnam(username) : getpwuid(getuid()); if (pwd == NULL) { if (errno) diff --git a/usr.sbin/jail/config.c b/usr.sbin/jail/config.c index 87b8ef9..cb06bac 100644 --- a/usr.sbin/jail/config.c +++ b/usr.sbin/jail/config.c @@ -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; } |