]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs:
authorThorsten Kukuk <kukuk@thkukuk.de>
Mon, 8 Oct 2007 15:05:36 +0000 (15:05 +0000)
committerThorsten Kukuk <kukuk@thkukuk.de>
Mon, 8 Oct 2007 15:05:36 +0000 (15:05 +0000)
Purpose of commit: bugfix

Commit summary:
---------------

2007-10-08  Thorsten Kukuk  <kukuk@thkukuk.de>

        * modules/pam_time/pam_time.c (is_same): Length of strings without
        wildcard needs to be the same.
        * modules/pam_group/pam_group.c (is_same): Likewise.

ChangeLog
modules/pam_group/pam_group.c
modules/pam_time/pam_time.c

index 3961807066ad9e2ee2b94026ce5edd5593d25dab..2a711e7cc719938c4865777c724133e991292f8a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-10-08  Thorsten Kukuk  <kukuk@thkukuk.de>
+
+       * modules/pam_time/pam_time.c (is_same): Length of strings without
+       wildcard needs to be the same.
+       * modules/pam_group/pam_group.c (is_same): Likewise.
+
 2007-10-01  Thorsten Kukuk  <kukuk@thkukuk.de>
 
        * xtests/tst-pam_group1.c: New test case for user compare in pam_group.
index 1dc329ef8120c00c0b3dbca1b194a9f1f9fa1d66..4a54da144efc0f54f1b86dd623a5d3e47346d4d8 100644 (file)
@@ -329,6 +329,13 @@ is_same (const pam_handle_t *pamh UNUSED,
                    return FALSE;
          }
      }
+
+     /* Ok, we know that b is a substring from A and does not contain
+       wildcards, but now the length of both strings must be the same,
+       too. */
+     if (strlen (a) != strlen(b))
+       return FALSE;
+
      return ( !len );
 }
 
index 43b716f0e147cea40481e57ef3440ff7f7e7d9eb..56b418f45c16cdd7f6216a5cb1b0da724a3b360a 100644 (file)
@@ -59,7 +59,7 @@ shift_bytes(char *mem, int from, int by)
 }
 
 static int
-read_field(pam_handle_t *pamh, int fd, char **buf, int *from, int *to)
+read_field(const pam_handle_t *pamh, int fd, char **buf, int *from, int *to)
 {
     /* is buf set ? */
 
@@ -137,6 +137,7 @@ read_field(pam_handle_t *pamh, int fd, char **buf, int *from, int *to)
            switch ((*buf)[i]) {
                int j,c;
            case '#':
+                c = 0;
                for (j=i; j < *to && (c = (*buf)[j]) != '\n'; ++j);
                if (j >= *to) {
                    (*buf)[*to = ++i] = '\0';
@@ -324,6 +325,13 @@ is_same(pam_handle_t *pamh UNUSED, const void *A, const char *b,
                    return FALSE;
          }
      }
+
+     /* Ok, we know that b is a substring from A and does not contain
+        wildcards, but now the length of both strings must be the same,
+        too. */
+     if (strlen (a) != strlen(b))
+          return FALSE;
+
      return ( !len );
 }