fixed socket wrapper to determine family from the right structure
authorAndrew Tridgell <tridge@samba.org>
Tue, 9 Jun 2009 03:33:09 +0000 (13:33 +1000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 9 Jun 2009 03:33:09 +0000 (13:33 +1000)
In convert_in_un_remote() the socket family can be accessed either as
si->family or inaddr->sa_family. We were using the si->family to
determine how to cast the inaddr structure, but if si->family !=
inaddr->sa_family then we will incorrectly be casting a in6 structure
as in4 or vice-versa.

lib/socket_wrapper/socket_wrapper.c

index 071060c86432105c38554ab4719594f1fe43c022..8563400dbd48d6acf678c210f25f8886d9a19ec1 100644 (file)
@@ -348,7 +348,7 @@ static int convert_in_un_remote(struct socket_info *si, const struct sockaddr *i
 
        if (bcast) *bcast = 0;
 
-       switch (si->family) {
+       switch (inaddr->sa_family) {
        case AF_INET: {
                const struct sockaddr_in *in = 
                    (const struct sockaddr_in *)inaddr;