diff options
| author | Yi Zhao <yi.zhao@windriver.com> | 2024-07-01 22:09:38 +0800 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2024-07-09 06:02:55 -0700 |
| commit | 29621226e279f007521cadcf10b60f4407bafd6f (patch) | |
| tree | bc1bf225963626d2f9db5556612a964192aaafc5 /meta/recipes-extended | |
| parent | b0ab1c80fc5787d4eb43a443afe0979d56c930bc (diff) | |
| download | poky-29621226e279f007521cadcf10b60f4407bafd6f.tar.gz | |
libpam: fix runtime error in pam_pwhistory moudle
Backport a patch to fix runtime error in pam_pwhistory module when
selinux is enabled:
root@qemux86-64:~# passwd
passwd: System error
passwd: password unchanged
(From OE-Core rev: a985fb71e30d958dcacdcc75f5bbdd0e49f7478a)
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-extended')
| -rw-r--r-- | meta/recipes-extended/pam/libpam/0001-pam_pwhistory-fix-passing-NULL-filename-argument-to-.patch | 69 | ||||
| -rw-r--r-- | meta/recipes-extended/pam/libpam_1.5.3.bb | 1 |
2 files changed, 70 insertions, 0 deletions
diff --git a/meta/recipes-extended/pam/libpam/0001-pam_pwhistory-fix-passing-NULL-filename-argument-to-.patch b/meta/recipes-extended/pam/libpam/0001-pam_pwhistory-fix-passing-NULL-filename-argument-to-.patch new file mode 100644 index 0000000000..23d5646235 --- /dev/null +++ b/meta/recipes-extended/pam/libpam/0001-pam_pwhistory-fix-passing-NULL-filename-argument-to-.patch | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | From 80dc2d410595b5193d32f965185710df27f3984e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Md Zain Hasib <hasibm@vmware.com> | ||
| 3 | Date: Sat, 29 Jul 2023 11:01:35 +0530 | ||
| 4 | Subject: [PATCH] pam_pwhistory: fix passing NULL filename argument to | ||
| 5 | pwhistory helper | ||
| 6 | |||
| 7 | This change fixes a bug when pwhistory_helper is invoked from | ||
| 8 | pam_pwhistory with an NULL filename, pwhistory_helper receives a short | ||
| 9 | circuited argc count of 3, ignoring the rest of the arguments passed | ||
| 10 | due to filename being NULL. To resolve the issue, an empty string is | ||
| 11 | passed in case the filename is empty, which is later changed back to | ||
| 12 | NULL in pwhistory_helper so that it can be passed to opasswd to read | ||
| 13 | the default opasswd file. | ||
| 14 | |||
| 15 | * modules/pam_pwhistory/pam_pwhistory.c (run_save_helper, | ||
| 16 | run_check_helper): Replace NULL filename argument with an empty string. | ||
| 17 | * modules/pam_pwhistory/pwhistory_helper.c (main): Replace empty string | ||
| 18 | filename argument with NULL. | ||
| 19 | |||
| 20 | Fixes: 11c35109a67f ("pam_pwhistory: Enable alternate location for password history file (#396)") | ||
| 21 | Signed-off-by: Dmitry V. Levin <ldv@strace.io> | ||
| 22 | |||
| 23 | Upstream-Status: Backport | ||
| 24 | [https://github.com/linux-pam/linux-pam/commit/80dc2d410595b5193d32f965185710df27f3984e] | ||
| 25 | |||
| 26 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
| 27 | --- | ||
| 28 | modules/pam_pwhistory/pam_pwhistory.c | 4 ++-- | ||
| 29 | modules/pam_pwhistory/pwhistory_helper.c | 2 +- | ||
| 30 | 2 files changed, 3 insertions(+), 3 deletions(-) | ||
| 31 | |||
| 32 | diff --git a/modules/pam_pwhistory/pam_pwhistory.c b/modules/pam_pwhistory/pam_pwhistory.c | ||
| 33 | index 5a7fb811..98ddffce 100644 | ||
| 34 | --- a/modules/pam_pwhistory/pam_pwhistory.c | ||
| 35 | +++ b/modules/pam_pwhistory/pam_pwhistory.c | ||
| 36 | @@ -141,7 +141,7 @@ run_save_helper(pam_handle_t *pamh, const char *user, | ||
| 37 | args[0] = (char *)PWHISTORY_HELPER; | ||
| 38 | args[1] = (char *)"save"; | ||
| 39 | args[2] = (char *)user; | ||
| 40 | - args[3] = (char *)filename; | ||
| 41 | + args[3] = (char *)((filename != NULL) ? filename : ""); | ||
| 42 | DIAG_POP_IGNORE_CAST_QUAL; | ||
| 43 | if (asprintf(&args[4], "%d", howmany) < 0 || | ||
| 44 | asprintf(&args[5], "%d", debug) < 0) | ||
| 45 | @@ -228,7 +228,7 @@ run_check_helper(pam_handle_t *pamh, const char *user, | ||
| 46 | args[0] = (char *)PWHISTORY_HELPER; | ||
| 47 | args[1] = (char *)"check"; | ||
| 48 | args[2] = (char *)user; | ||
| 49 | - args[3] = (char *)filename; | ||
| 50 | + args[3] = (char *)((filename != NULL) ? filename : ""); | ||
| 51 | DIAG_POP_IGNORE_CAST_QUAL; | ||
| 52 | if (asprintf(&args[4], "%d", debug) < 0) | ||
| 53 | { | ||
| 54 | diff --git a/modules/pam_pwhistory/pwhistory_helper.c b/modules/pam_pwhistory/pwhistory_helper.c | ||
| 55 | index 469d95fa..fb9a1e31 100644 | ||
| 56 | --- a/modules/pam_pwhistory/pwhistory_helper.c | ||
| 57 | +++ b/modules/pam_pwhistory/pwhistory_helper.c | ||
| 58 | @@ -108,7 +108,7 @@ main(int argc, char *argv[]) | ||
| 59 | |||
| 60 | option = argv[1]; | ||
| 61 | user = argv[2]; | ||
| 62 | - filename = argv[3]; | ||
| 63 | + filename = (argv[3][0] != '\0') ? argv[3] : NULL; | ||
| 64 | |||
| 65 | if (strcmp(option, "check") == 0 && argc == 5) | ||
| 66 | return check_history(user, filename, argv[4]); | ||
| 67 | -- | ||
| 68 | 2.25.1 | ||
| 69 | |||
diff --git a/meta/recipes-extended/pam/libpam_1.5.3.bb b/meta/recipes-extended/pam/libpam_1.5.3.bb index 2a53bb4cc5..ef32d19f3d 100644 --- a/meta/recipes-extended/pam/libpam_1.5.3.bb +++ b/meta/recipes-extended/pam/libpam_1.5.3.bb | |||
| @@ -25,6 +25,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/Linux-PAM-${PV}.tar.xz \ | |||
| 25 | file://run-ptest \ | 25 | file://run-ptest \ |
| 26 | file://pam-volatiles.conf \ | 26 | file://pam-volatiles.conf \ |
| 27 | file://0001-pam_namespace-include-stdint-h.patch \ | 27 | file://0001-pam_namespace-include-stdint-h.patch \ |
| 28 | file://0001-pam_pwhistory-fix-passing-NULL-filename-argument-to-.patch \ | ||
| 28 | " | 29 | " |
| 29 | 30 | ||
| 30 | SRC_URI[sha256sum] = "7ac4b50feee004a9fa88f1dfd2d2fa738a82896763050cd773b3c54b0a818283" | 31 | SRC_URI[sha256sum] = "7ac4b50feee004a9fa88f1dfd2d2fa738a82896763050cd773b3c54b0a818283" |
