fix parseip() error handling in ipconfig, ppp, tftpfs and dns
This commit is contained in:
parent
48d117ed64
commit
94018b2130
4 changed files with 8 additions and 6 deletions
|
@ -1715,7 +1715,8 @@ putndb(void)
|
|||
uchar ip[IPaddrlen];
|
||||
|
||||
if((nt = ndbfindattr(t, t, "ip")) == nil
|
||||
|| parseip(ip, nt->val) < 0 || ipcmp(ip, conf.laddr) != 0){
|
||||
|| parseip(ip, nt->val) == -1
|
||||
|| ipcmp(ip, conf.laddr) != 0){
|
||||
p = seprint(p, e, "\n");
|
||||
for(nt = t; nt != nil; nt = nt->entry)
|
||||
p = seprint(p, e, "%s=%s%s", nt->attr, nt->val,
|
||||
|
@ -1837,7 +1838,7 @@ ndbconfig(void)
|
|||
ok = parseip(conf.fs+IPaddrlen*nfs++, nt->val);
|
||||
else if(nauth < sizeof(conf.auth)/IPaddrlen && strcmp(nt->attr, "auth") == 0)
|
||||
ok = parseip(conf.auth+IPaddrlen*nauth++, nt->val);
|
||||
if (!ok)
|
||||
if(ok == -1)
|
||||
fprint(2, "%s: bad %s address in ndb: %s\n", argv0,
|
||||
nt->attr, nt->val);
|
||||
}
|
||||
|
|
|
@ -2901,7 +2901,8 @@ putndb(PPP *ppp, char *net)
|
|||
uchar ip[IPaddrlen];
|
||||
|
||||
if((nt = ndbfindattr(t, t, "ip")) == nil
|
||||
|| parseip(ip, nt->val) < 0 || ipcmp(ip, ppp->local) != 0){
|
||||
|| parseip(ip, nt->val) == -1
|
||||
|| ipcmp(ip, ppp->local) != 0){
|
||||
p = seprint(p, e, "\n");
|
||||
for(nt = t; nt != nil; nt = nt->entry)
|
||||
p = seprint(p, e, "%s=%s%s", nt->attr, nt->val,
|
||||
|
|
|
@ -295,7 +295,7 @@ fsattach(Req *r)
|
|||
if(r->ifcall.aname && r->ifcall.aname[0]){
|
||||
uchar addr[IPaddrlen];
|
||||
|
||||
if(parseip(addr, r->ifcall.aname) < 0){
|
||||
if(parseip(addr, r->ifcall.aname) == -1){
|
||||
respond(r, "bad ip specified");
|
||||
return;
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ threadmain(int argc, char **argv)
|
|||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
if(parseip(ipaddr, *argv) < 0)
|
||||
if(parseip(ipaddr, *argv) == -1)
|
||||
usage();
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -80,7 +80,7 @@ addforwtarg(char *host)
|
|||
return -1;
|
||||
}
|
||||
tp = forwtarg + forwtcount;
|
||||
if (parseip(tp->addr, host) < 0) {
|
||||
if(parseip(tp->addr, host) == -1) {
|
||||
dnslog("can't parse ip %s", host);
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue