summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Kang <kai.kang@windriver.com>2013-04-17 17:00:25 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-04-17 11:41:30 +0100
commitc1ac96dde194e326d98fb9a82ed002ce2e03c2ea (patch)
tree3601e51e1a547bb2b50d44a49436bb66b687f28b
parent8593ead5ef187cac98629c256fb8623c6307d067 (diff)
downloadpoky-c1ac96dde194e326d98fb9a82ed002ce2e03c2ea.tar.gz
libpam: backport patches from upstream
Backport patches from linux-pam git repo to fix test case tst-pam_pwhistory1 failure. [YOCTO #4107] (From OE-Core rev: 65e4a9f050ae588ec794808315a206d94ca7a861) Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/pam/libpam/add-checks-for-crypt-returning-NULL.patch63
-rw-r--r--meta/recipes-extended/pam/libpam/reflect-the-enforce_for_root-semantics-change-in-pam.patch35
-rw-r--r--meta/recipes-extended/pam/libpam_1.1.6.bb2
3 files changed, 100 insertions, 0 deletions
diff --git a/meta/recipes-extended/pam/libpam/add-checks-for-crypt-returning-NULL.patch b/meta/recipes-extended/pam/libpam/add-checks-for-crypt-returning-NULL.patch
new file mode 100644
index 0000000000..d364cea97e
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/add-checks-for-crypt-returning-NULL.patch
@@ -0,0 +1,63 @@
1Backport from linux-pam git repo.
2
3[YOCTO #4107]
4
5Upstream-Status: Backport
6
7Signed-off-by: Kang Kai <kai.kang@windriver.com>
8
9From 8dc056c1c8bc7acb66c4decc49add2c3a24e6310 Mon Sep 17 00:00:00 2001
10From: Tomas Mraz <tmraz@fedoraproject.org>
11Date: Fri, 8 Feb 2013 15:04:26 +0100
12Subject: [PATCH] Add checks for crypt() returning NULL.
13
14modules/pam_pwhistory/opasswd.c (compare_password): Add check for crypt() NULL return.
15modules/pam_unix/bigcrypt.c (bigcrypt): Likewise.
16---
17 modules/pam_pwhistory/opasswd.c | 2 +-
18 modules/pam_unix/bigcrypt.c | 9 +++++++++
19 2 files changed, 10 insertions(+), 1 deletions(-)
20
21diff --git a/modules/pam_pwhistory/opasswd.c b/modules/pam_pwhistory/opasswd.c
22index 274fdb9..836d713 100644
23--- a/modules/pam_pwhistory/opasswd.c
24+++ b/modules/pam_pwhistory/opasswd.c
25@@ -108,7 +108,7 @@ compare_password(const char *newpass, const char *oldpass)
26 outval = crypt (newpass, oldpass);
27 #endif
28
29- return strcmp(outval, oldpass) == 0;
30+ return outval != NULL && strcmp(outval, oldpass) == 0;
31 }
32
33 /* Check, if the new password is already in the opasswd file. */
34diff --git a/modules/pam_unix/bigcrypt.c b/modules/pam_unix/bigcrypt.c
35index e10d1c5..e1d57a0 100644
36--- a/modules/pam_unix/bigcrypt.c
37+++ b/modules/pam_unix/bigcrypt.c
38@@ -109,6 +109,10 @@ char *bigcrypt(const char *key, const char *salt)
39 #else
40 tmp_ptr = crypt(plaintext_ptr, salt); /* libc crypt() */
41 #endif
42+ if (tmp_ptr == NULL) {
43+ free(dec_c2_cryptbuf);
44+ return NULL;
45+ }
46 /* and place in the static area */
47 strncpy(cipher_ptr, tmp_ptr, 13);
48 cipher_ptr += ESEGMENT_SIZE + SALT_SIZE;
49@@ -130,6 +134,11 @@ char *bigcrypt(const char *key, const char *salt)
50 #else
51 tmp_ptr = crypt(plaintext_ptr, salt_ptr);
52 #endif
53+ if (tmp_ptr == NULL) {
54+ _pam_overwrite(dec_c2_cryptbuf);
55+ free(dec_c2_cryptbuf);
56+ return NULL;
57+ }
58
59 /* skip the salt for seg!=0 */
60 strncpy(cipher_ptr, (tmp_ptr + SALT_SIZE), ESEGMENT_SIZE);
61--
621.7.5.4
63
diff --git a/meta/recipes-extended/pam/libpam/reflect-the-enforce_for_root-semantics-change-in-pam.patch b/meta/recipes-extended/pam/libpam/reflect-the-enforce_for_root-semantics-change-in-pam.patch
new file mode 100644
index 0000000000..c13535ecc2
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/reflect-the-enforce_for_root-semantics-change-in-pam.patch
@@ -0,0 +1,35 @@
1Backport from linux-pam git repo.
2
3[YOCTO #4107]
4
5Upstream-Status: Backport
6
7Signed-off-by: Kang Kai <kai.kang@windriver.com>
8
9From bd07ad3adc626f842a4391d256541883426fd389 Mon Sep 17 00:00:00 2001
10From: Tomas Mraz <tmraz@fedoraproject.org>
11Date: Tue, 13 Nov 2012 09:19:05 +0100
12Subject: [PATCH] Reflect the enforce_for_root semantics change in
13 pam_pwhistory xtest.
14
15xtests/tst-pam_pwhistory1.pamd: Use enforce_for_root as the test is
16running with real uid == 0.
17---
18 xtests/tst-pam_pwhistory1.pamd | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21diff --git a/xtests/tst-pam_pwhistory1.pamd b/xtests/tst-pam_pwhistory1.pamd
22index 68e1b94..d60db7c 100644
23--- a/xtests/tst-pam_pwhistory1.pamd
24+++ b/xtests/tst-pam_pwhistory1.pamd
25@@ -1,6 +1,6 @@
26 #%PAM-1.0
27 auth required pam_permit.so
28 account required pam_permit.so
29-password required pam_pwhistory.so remember=10 retry=1
30+password required pam_pwhistory.so remember=10 retry=1 enforce_for_root
31 password required pam_unix.so use_authtok md5
32 session required pam_permit.so
33--
341.7.11.7
35
diff --git a/meta/recipes-extended/pam/libpam_1.1.6.bb b/meta/recipes-extended/pam/libpam_1.1.6.bb
index 9a49c50f60..c355634478 100644
--- a/meta/recipes-extended/pam/libpam_1.1.6.bb
+++ b/meta/recipes-extended/pam/libpam_1.1.6.bb
@@ -15,6 +15,8 @@ SRC_URI = "http://linux-pam.org/library/Linux-PAM-${PV}.tar.bz2 \
15 file://libpam-xtests.patch \ 15 file://libpam-xtests.patch \
16 file://destdirfix.patch \ 16 file://destdirfix.patch \
17 file://fixsepbuild.patch \ 17 file://fixsepbuild.patch \
18 file://reflect-the-enforce_for_root-semantics-change-in-pam.patch \
19 file://add-checks-for-crypt-returning-NULL.patch \
18 " 20 "
19SRC_URI[md5sum] = "7b73e58b7ce79ffa321d408de06db2c4" 21SRC_URI[md5sum] = "7b73e58b7ce79ffa321d408de06db2c4"
20SRC_URI[sha256sum] = "bab887d6280f47fc3963df3b95735a27a16f0f663636163ddf3acab5f1149fc2" 22SRC_URI[sha256sum] = "bab887d6280f47fc3963df3b95735a27a16f0f663636163ddf3acab5f1149fc2"