Added some defines for the various exclude-function arg literals.
[rsync/rsync.git] / access.c
index aec633a..b05059f 100644 (file)
--- a/access.c
+++ b/access.c
@@ -51,7 +51,8 @@ static void make_mask(char *mask, int plen, int addrlen) {
 
        if (w)
                memset(mask, 0xff, w);
-       mask[w] = 0xff & (0xff<<(8-b));
+       if (w < addrlen)
+               mask[w] = 0xff & (0xff<<(8-b));
        if (w+1 < addrlen)
                memset(mask+w+1, 0, addrlen-w-1);
 
@@ -81,7 +82,9 @@ static int match_address(char *addr, char *tok)
        memset(&hints, 0, sizeof(hints));
        hints.ai_family = PF_UNSPEC;
        hints.ai_socktype = SOCK_STREAM;
+#ifdef AI_NUMERICHOST
        hints.ai_flags = AI_NUMERICHOST;
+#endif
 
        gai = getaddrinfo(addr, NULL, &hints, &resa);
        if (gai) return 0;
@@ -119,6 +122,8 @@ static int match_address(char *addr, char *tok)
                a = (char *)&sin6a->sin6_addr;
                t = (char *)&sin6t->sin6_addr;
 
+               addrlen = 16;
+
 #ifdef HAVE_SOCKADDR_IN6_SCOPE_ID
                if (sin6t->sin6_scope_id &&
                    sin6a->sin6_scope_id != sin6t->sin6_scope_id) {
@@ -127,10 +132,6 @@ static int match_address(char *addr, char *tok)
                }
 #endif
 
-               a = (char *)&sin6a->sin6_addr;
-               t = (char *)&sin6t->sin6_addr;
-               addrlen = 16;
-
                break;
            }
 #endif