Accept the whole range of pids

This commit is contained in:
Jakub Jelen 2021-09-15 10:55:44 +02:00
parent 6fbd096010
commit 0dc485821a
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From 3508ad2704103e863fca8c45ecda25021850befc Mon Sep 17 00:00:00 2001
From: Jakub Jelen <jjelen@redhat.com>
Date: Thu, 24 Jun 2021 10:24:31 +0200
Subject: [PATCH] Accept whole range of supported pids
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
---
src/pam_wrapper.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index 6801d7b..efa7cbb 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -791,14 +791,20 @@ static void pwrap_clean_stale_dirs(const char *dir)
buf[sizeof(buf) - 1] = '\0';
tmp = strtol(buf, NULL, 10);
- if (tmp == 0 || tmp > 0xFFFF || errno == ERANGE) {
+ if (tmp == 0 || errno == ERANGE) {
PWRAP_LOG(PWRAP_LOG_ERROR,
"Failed to parse pid, buf=%s",
buf);
return;
}
- pid = (pid_t)(tmp & 0xFFFF);
+ pid = (pid_t)tmp;
+ /* Check if we are out of pid_t range on this system */
+ if ((long)pid != tmp) {
+ PWRAP_LOG(PWRAP_LOG_ERROR,
+ "pid out of range: %ld", tmp);
+ return;
+ }
rc = kill(pid, 0);
if (rc == -1) {
--
GitLab

View File

@ -1,6 +1,6 @@
Name: pam_wrapper
Version: 1.1.3
Release: 8%{?dist}
Release: 9%{?dist}
Summary: A tool to test PAM applications and PAM modules
License: GPLv3+
@ -9,6 +9,7 @@ Url: http://cwrap.org/
Source0: https://ftp.samba.org/pub/cwrap/%{name}-%{version}.tar.gz
Source1: https://ftp.samba.org/pub/cwrap/%{name}-%{version}.tar.gz.asc
Source2: pam_wrapper.keyring
Patch1: pam_wrapper-1.1.3-pid.patch
BuildRequires: gcc
BuildRequires: gnupg2
@ -138,6 +139,9 @@ gpgv2 --quiet --keyring %{SOURCE2} %{SOURCE1} %{SOURCE0}
%{python3_sitearch}/pypamtest.so
%changelog
* Wed Sep 15 2021 Jakub Jelen <jjelen@redhat.com> - 1.1.3-9
- Fix PID range as reported in #1881377
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.3-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild