[pam] be tolerant to corrupted opasswd file
Tomáš Mráz
tmraz at fedoraproject.org
Thu Jul 17 14:52:17 UTC 2014
commit e157a48461f495d0da76fd5b27ee6ab7f9610b3b
Author: Tomas Mraz <tmraz at fedoraproject.org>
Date: Thu Jul 17 16:52:34 2014 +0200
be tolerant to corrupted opasswd file
pam-1.1.8-opasswd-tolerant.patch | 50 ++++++++++++++++++++++++++++++++++++++
pam.spec | 7 ++++-
2 files changed, 56 insertions(+), 1 deletions(-)
---
diff --git a/pam-1.1.8-opasswd-tolerant.patch b/pam-1.1.8-opasswd-tolerant.patch
new file mode 100644
index 0000000..fb9b198
--- /dev/null
+++ b/pam-1.1.8-opasswd-tolerant.patch
@@ -0,0 +1,50 @@
+diff --git a/modules/pam_pwhistory/opasswd.c b/modules/pam_pwhistory/opasswd.c
+index 836d713..c36628e 100644
+--- a/modules/pam_pwhistory/opasswd.c
++++ b/modules/pam_pwhistory/opasswd.c
+@@ -82,10 +82,15 @@ parse_entry (char *line, opwd *data)
+ {
+ const char delimiters[] = ":";
+ char *endptr;
++ char *count;
+
+ data->user = strsep (&line, delimiters);
+ data->uid = strsep (&line, delimiters);
+- data->count = strtol (strsep (&line, delimiters), &endptr, 10);
++ count = strsep (&line, delimiters);
++ if (data->user == NULL || data->uid == NULL || count == NULL)
++ return 1;
++
++ data->count = strtol (count, &endptr, 10);
+ if (endptr != NULL && *endptr != '\0')
+ return 1;
+
+diff --git a/modules/pam_unix/passverify.c b/modules/pam_unix/passverify.c
+index 4840bb2..7f7bc49 100644
+--- a/modules/pam_unix/passverify.c
++++ b/modules/pam_unix/passverify.c
+@@ -639,11 +639,23 @@ save_old_password(pam_handle_t *pamh, const char *forwho, const char *oldpass,
+ continue;
+ buf[strlen(buf) - 1] = '\0';
+ s_luser = strtok_r(buf, ":", &sptr);
++ if (s_luser == NULL) {
++ found = 0;
++ continue;
++ }
+ s_uid = strtok_r(NULL, ":", &sptr);
++ if (s_uid == NULL) {
++ found = 0;
++ continue;
++ }
+ s_npas = strtok_r(NULL, ":", &sptr);
++ if (s_npas == NULL) {
++ found = 0;
++ continue;
++ }
+ s_pas = strtok_r(NULL, ":", &sptr);
+ npas = strtol(s_npas, NULL, 10) + 1;
+- while (npas > howmany) {
++ while (npas > howmany && s_pas != NULL) {
+ s_pas = strpbrk(s_pas, ",");
+ if (s_pas != NULL)
+ s_pas++;
diff --git a/pam.spec b/pam.spec
index 6cfb3d0..6a1a40d 100644
--- a/pam.spec
+++ b/pam.spec
@@ -3,7 +3,7 @@
Summary: An extensible library which provides authentication for applications
Name: pam
Version: 1.1.8
-Release: 12%{?dist}
+Release: 13%{?dist}
# The library is BSD licensed with option to relicense as GPLv2+
# - this option is redundant as the BSD license allows that anyway.
# pam_timestamp, pam_loginuid, and pam_console modules are GPLv2+.
@@ -48,6 +48,7 @@ Patch34: pam-1.1.8-canonicalize-username.patch
Patch35: pam-1.1.8-cve-2013-7041.patch
Patch36: pam-1.1.8-cve-2014-2583.patch
Patch37: pam-1.1.8-loginuid-container.patch
+Patch38: pam-1.1.8-opasswd-tolerant.patch
%define _pamlibdir %{_libdir}
%define _moduledir %{_libdir}/security
@@ -129,6 +130,7 @@ mv pam-redhat-%{pam_redhat_version}/* modules
%patch35 -p1 -b .case
%patch36 -p1 -b .timestamp-ruser
%patch37 -p1 -b .container
+%patch38 -p1 -b .opasswd-tolerant
%build
autoreconf -i
@@ -377,6 +379,9 @@ fi
%doc doc/adg/*.txt doc/adg/html
%changelog
+* Thu Jul 16 2014 Tomáš Mráz <tmraz at redhat.com> 1.1.8-13
+- be tolerant to corrupted opasswd file
+
* Fri Jun 06 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.1.8-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
More information about the scm-commits
mailing list