diff options
author | bz <bz@FreeBSD.org> | 2006-12-12 12:17:58 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2006-12-12 12:17:58 +0000 |
commit | 297206ec2ac5b34686aaf531476b1b737df9bbd7 (patch) | |
tree | 262eb78fb028423e6796d76401691a45b39b496a /sys/nfsserver | |
parent | dc3e4a0741ba505defdc796a954461de7aa856e3 (diff) | |
download | FreeBSD-src-297206ec2ac5b34686aaf531476b1b737df9bbd7.zip FreeBSD-src-297206ec2ac5b34686aaf531476b1b737df9bbd7.tar.gz |
MFp4: 92972, 98913 + one more change
In ip6_sprintf no longer use and return one of eight static buffers
for printing/logging ipv6 addresses.
The caller now has to hand in a sufficiently large buffer as first
argument.
Diffstat (limited to 'sys/nfsserver')
-rw-r--r-- | sys/nfsserver/nfs_syscalls.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/sys/nfsserver/nfs_syscalls.c b/sys/nfsserver/nfs_syscalls.c index 4d6391e..5b551f0 100644 --- a/sys/nfsserver/nfs_syscalls.c +++ b/sys/nfsserver/nfs_syscalls.c @@ -430,27 +430,31 @@ nfssvc_nfsd(struct thread *td) port = ntohs(sin->sin_port); if (port >= IPPORT_RESERVED && nd->nd_procnum != NFSPROC_NULL) { -#if defined(INET6) && defined(KLD_MODULE) - /* do not use ip6_sprintf: the nfs module should work without INET6 */ - char b6[INET6_ADDRSTRLEN]; -#define ip6_sprintf(a) \ - (sprintf(b6, "%x:%x:%x:%x:%x:%x:%x:%x", \ +#ifdef INET6 + char b6[INET6_ADDRSTRLEN]; +#if defined(KLD_MODULE) + /* Do not use ip6_sprintf: the nfs module should work without INET6. */ +#define ip6_sprintf(buf, a) \ + (sprintf((buf), "%x:%x:%x:%x:%x:%x:%x:%x", \ (a)->s6_addr16[0], (a)->s6_addr16[1], \ (a)->s6_addr16[2], (a)->s6_addr16[3], \ (a)->s6_addr16[4], (a)->s6_addr16[5], \ (a)->s6_addr16[6], (a)->s6_addr16[7]), \ - b6) + (buf)) +#endif #endif nd->nd_procnum = NFSPROC_NOOP; nd->nd_repstat = (NFSERR_AUTHERR | AUTH_TOOWEAK); cacherep = RC_DOIT; printf("NFS request from unprivileged port (%s:%d)\n", #ifdef INET6 - sin->sin_family == AF_INET6 ? - ip6_sprintf(&satosin6(sin)->sin6_addr) : + sin->sin_family == AF_INET6 ? + ip6_sprintf(b6, &satosin6(sin)->sin6_addr) : +#if defined(KLD_MODULE) #undef ip6_sprintf #endif - inet_ntoa(sin->sin_addr), port); +#endif + inet_ntoa(sin->sin_addr), port); } } |