summaryrefslogtreecommitdiffstats
path: root/source/lib/system.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-02 10:25:34 -0700
committerJeremy Allison <jra@samba.org>2007-11-02 10:25:34 -0700
commit4d7badb0c44f287034f58d9a412e662c0fbecdc9 (patch)
tree239df453bcf68e68d1146809a68f997675b95ba7 /source/lib/system.c
parent8c73e19f51d6e3f520cf44dd22f9b9584d4b460f (diff)
downloadsamba-4d7badb0c44f287034f58d9a412e662c0fbecdc9.tar.gz
samba-4d7badb0c44f287034f58d9a412e662c0fbecdc9.tar.xz
samba-4d7badb0c44f287034f58d9a412e662c0fbecdc9.zip
Fix Solaris by ensuring we use the IPv4 or IPv6 length
in any getnameinfo calls. Jeremy
Diffstat (limited to 'source/lib/system.c')
-rw-r--r--source/lib/system.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/lib/system.c b/source/lib/system.c
index 604228233cd..fe4e700176c 100644
--- a/source/lib/system.c
+++ b/source/lib/system.c
@@ -2545,3 +2545,27 @@ int sys_getpeereid( int s, uid_t *uid)
return -1;
#endif
}
+
+int sys_getnameinfo(const struct sockaddr *psa,
+ socklen_t salen,
+ char *host,
+ size_t hostlen,
+ char *service,
+ size_t servlen,
+ int flags)
+{
+ /*
+ * For Solaris we must make sure salen is the
+ * correct length for the incoming sa_family.
+ */
+
+ if (salen == sizeof(struct sockaddr_storage)) {
+ salen = sizeof(struct sockaddr_in);
+#if defined(HAVE_IPV6)
+ if (psa->sa_family == AF_INET6) {
+ salen = sizeof(struct sockaddr_in6);
+ }
+#endif
+ }
+ return getnameinfo(psa, salen, host, hostlen, service, servlen, flags);
+}