diff options
author | phk <phk@FreeBSD.org> | 1994-09-15 02:06:59 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1994-09-15 02:06:59 +0000 |
commit | f82deafeb9f89d0d6c55b31251f0b7300c2c2ad6 (patch) | |
tree | ade2146a41409a0e042eb752bcd94478158a9689 | |
parent | dd8c9a470d538086248009c1b112c3e4465e2bf5 (diff) | |
download | FreeBSD-src-f82deafeb9f89d0d6c55b31251f0b7300c2c2ad6.zip FreeBSD-src-f82deafeb9f89d0d6c55b31251f0b7300c2c2ad6.tar.gz |
Fixed a bug where mount_nfs would core-dump if used with IP# directly.
Also moved some KERBEROS related stuff inside the #ifdef.
Should we always try to do a reverse lookup (IP#->name) ?
It has som merit, but is probably against the tradition or huh ?
-rw-r--r-- | sbin/mount_nfs/mount_nfs.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index cbb3ddb..cd4234b 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -423,18 +423,20 @@ getnfsargs(spec, nfsargsp) warnx("bad net address %s", hostp); return (0); } - if ((nfsargsp->flags & NFSMNT_KERB) && - (hp = gethostbyaddr((char *)&saddr.sin_addr.s_addr, + } else if ((hp = gethostbyname(hostp)) != NULL) { + bcopy(hp->h_addr, (caddr_t)&saddr.sin_addr, hp->h_length); + } else { + warnx("can't get net id for host"); + return (0); + } +#ifdef KERBEROS + if ((nfsargsp->flags & NFSMNT_KERB)) { + if ((hp = gethostbyaddr((char *)&saddr.sin_addr.s_addr, sizeof (u_long), AF_INET)) == (struct hostent *)0) { warnx("can't reverse resolve net address"); return (0); } - } else if ((hp = gethostbyname(hostp)) == NULL) { - warnx("can't get net id for host"); - return (0); - } -#ifdef KERBEROS - if (nfsargsp->flags & NFSMNT_KERB) { + bcopy(hp->h_addr, (caddr_t)&saddr.sin_addr, hp->h_length); strncpy(inst, hp->h_name, INST_SZ); inst[INST_SZ - 1] = '\0'; if (cp = strchr(inst, '.')) @@ -442,7 +444,6 @@ getnfsargs(spec, nfsargsp) } #endif /* KERBEROS */ - bcopy(hp->h_addr, (caddr_t)&saddr.sin_addr, hp->h_length); nfhret.stat = EACCES; /* Mark not yet successful */ while (retrycnt > 0) { saddr.sin_family = AF_INET; |