Fix mod-blacklist (really, all of SAR) not working on BSDs.
authorMichael Poole <mdpoole@troilus.org>
Tue, 11 Aug 2009 03:53:19 +0000 (23:53 -0400)
committerMichael Poole <mdpoole@troilus.org>
Tue, 11 Aug 2009 03:53:19 +0000 (23:53 -0400)
Fixes SF bug #2817939, reported by sky5.

src/sar.c (ipv4_pton): Set the sockaddr length field when it exists.
  (ipv6_pton): Likewise.

src/sar.c

index 4b150017e79bd661c52c1533d587e7a456d1d0b7..0618ed48779058bba3b1955e67bcb59cebb03938 100644 (file)
--- a/src/sar.c
+++ b/src/sar.c
@@ -1669,6 +1669,9 @@ ipv4_pton(struct sockaddr *sa, UNUSED_ARG(unsigned int socklen), unsigned int *b
     if (!pos)
         return 0;
     sa->sa_family = AF_INET;
+#if defined(HAVE_SOCKADDR_SA_LEN)
+    sa->sa_len = sizeof(struct sockaddr_in);
+#endif
     return pos;
 }
 
@@ -1902,6 +1905,9 @@ ipv6_pton(struct sockaddr *sa, UNUSED_ARG(unsigned int socklen), unsigned int *b
             sin6->sin6_addr.s6_addr[cpos + jj] = 0;
     }
     sa->sa_family = AF_INET6;
+#if defined(HAVE_SOCKADDR_SA_LEN)
+    sa->sa_len = sizeof(struct sockaddr_in6);
+#endif
     return pos;
 }