Relevant BUGIDs: 419631
authorAndrew G. Morgan <morgan@kernel.org>
Tue, 1 May 2001 04:15:33 +0000 (04:15 +0000)
committerAndrew G. Morgan <morgan@kernel.org>
Tue, 1 May 2001 04:15:33 +0000 (04:15 +0000)
Purpose of commit: bugfix

Commit summary:
---------------
Bring the module in to line with its documentation. The README refers
to a trailing '.' on IP addresses.

CHANGELOG
modules/pam_access/pam_access.c

index fab1986379d275854c14f014c11402d9aa90111b..3fd8227556ccb2939117d428c501be6a31fd6a60 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -49,6 +49,8 @@ bug report - outstanding bugs are listed here:
 0.76: please submit patches for this section with actual code/doc
       patches!
 
+* pam_access fixes - looks out for trailing '.' - from Carlo Marcelo
+  Arenas Belon (Bug 419631 - agmorgan)
 * don't zero out password strings during pam_unix's password changing
   function (Bug 419803 - vorlon)
 * propagate some definitions to the _pam_aconf.h file - from David Lee
index 87ad708d81ed3f85e452bd7e7cd3801e50500085..33bf767fdf06d61470ab7ee5c72e0209c04ccfd8 100644 (file)
@@ -345,8 +345,9 @@ static int from_match(char *tok, struct login_info *item)
            by "string" starts from "tok".
                                1998/01/27  Andrey V. Savochkin <saw@msu.ru>
          */
+
         struct hostent *h;
-        char hn[3+1+3+1+3+1+3+1];
+        char hn[3+1+3+1+3+1+3+1+1];
         int r;
 
         h = gethostbyname(string);
@@ -356,9 +357,9 @@ static int from_match(char *tok, struct login_info *item)
            return (NO);
         if (h->h_length != 4)
            return (NO); /* only IPv4 addresses (SAW) */
-        r = snprintf(hn, sizeof(hn), "%u.%u.%u.%u",
-                (unsigned char)h->h_addr[0], (unsigned char)h->h_addr[1],
-                (unsigned char)h->h_addr[2], (unsigned char)h->h_addr[3]);
+        r = snprintf(hn, sizeof(hn), "%u.%u.%u.%u.",
+                    (unsigned char)h->h_addr[0], (unsigned char)h->h_addr[1],
+                    (unsigned char)h->h_addr[2], (unsigned char)h->h_addr[3]);
         if (r < 0 || r >= sizeof(hn))
            return (NO);
         if (!strncmp(tok, hn, tok_len))