]> git.pld-linux.org Git - packages/pam.git/blame - pam-exec-failok.patch
- updated to 1.5.3
[packages/pam.git] / pam-exec-failok.patch
CommitLineData
587b47b5
MK
1diff -urNp -x '*.orig' Linux-PAM-1.4.0.org/modules/pam_exec/pam_exec.8.xml Linux-PAM-1.4.0/modules/pam_exec/pam_exec.8.xml
2--- Linux-PAM-1.4.0.org/modules/pam_exec/pam_exec.8.xml 2020-06-08 12:17:27.000000000 +0200
3+++ Linux-PAM-1.4.0/modules/pam_exec/pam_exec.8.xml 2021-03-21 13:20:06.503594925 +0100
4@@ -34,6 +34,9 @@
5 stdout
d2e58812 6 </arg>
9dcddb52 7 <arg choice="opt" rep="norepeat">
d2e58812
JR
8+ failok
9+ </arg>
9dcddb52 10+ <arg choice="opt" rep="norepeat">
d2e58812
JR
11 log=<replaceable>file</replaceable>
12 </arg>
9dcddb52 13 <arg choice="opt" rep="norepeat">
587b47b5
MK
14@@ -172,6 +175,18 @@
15 </para>
d2e58812
JR
16 </listitem>
17 </varlistentry>
587b47b5 18+
d2e58812
JR
19+ <varlistentry>
20+ <term>
21+ <option>failok</option>
22+ </term>
23+ <listitem>
24+ <para>
25+ Return success regardles of the exit code returned
26+ by the command.
27+ </para>
28+ </listitem>
29+ </varlistentry>
587b47b5 30
d2e58812
JR
31 </variablelist>
32
587b47b5
MK
33diff -urNp -x '*.orig' Linux-PAM-1.4.0.org/modules/pam_exec/pam_exec.c Linux-PAM-1.4.0/modules/pam_exec/pam_exec.c
34--- Linux-PAM-1.4.0.org/modules/pam_exec/pam_exec.c 2020-06-08 12:17:27.000000000 +0200
35+++ Linux-PAM-1.4.0/modules/pam_exec/pam_exec.c 2021-03-21 13:20:06.504594925 +0100
36@@ -93,6 +93,7 @@ call_exec (const char *pam_type, pam_han
d2e58812 37 int call_setuid = 0;
43fce6dd 38 int quiet = 0;
9dcddb52 39 int quiet_log = 0;
d2e58812 40+ int fail_ok = 0;
57fed07b 41 int expose_authtok = 0;
587b47b5 42 int use_stdout = 0;
d2e58812 43 int optargc;
587b47b5 44@@ -135,6 +136,8 @@ call_exec (const char *pam_type, pam_han
9dcddb52 45 quiet_log = 1;
57fed07b
JR
46 else if (strcasecmp (argv[optargc], "expose_authtok") == 0)
47 expose_authtok = 1;
d2e58812
JR
48+ else if (strcasecmp (argv[optargc], "failok") == 0)
49+ fail_ok = 1;
50 else
51 break; /* Unknown option, assume program to execute. */
52 }
587b47b5 53@@ -271,7 +274,7 @@ call_exec (const char *pam_type, pam_han
9dcddb52 54 if (!quiet_log)
d2e58812
JR
55 pam_syslog (pamh, LOG_ERR, "%s failed: exit code %d",
56 argv[optargc], WEXITSTATUS(status));
43fce6dd
JR
57- if (!quiet)
58+ if (!quiet && !fail_ok)
59 pam_error (pamh, _("%s failed: exit code %d"),
60 argv[optargc], WEXITSTATUS(status));
d2e58812 61 }
587b47b5 62@@ -280,7 +283,7 @@ call_exec (const char *pam_type, pam_han
d2e58812
JR
63 pam_syslog (pamh, LOG_ERR, "%s failed: caught signal %d%s",
64 argv[optargc], WTERMSIG(status),
65 WCOREDUMP(status) ? " (core dumped)" : "");
43fce6dd
JR
66- if (!quiet)
67+ if (!quiet && !fail_ok)
68 pam_error (pamh, _("%s failed: caught signal %d%s"),
69 argv[optargc], WTERMSIG(status),
70 WCOREDUMP(status) ? " (core dumped)" : "");
587b47b5 71@@ -289,11 +292,14 @@ call_exec (const char *pam_type, pam_han
9dcddb52 72 if (!quiet_log)
d2e58812
JR
73 pam_syslog (pamh, LOG_ERR, "%s failed: unknown status 0x%x",
74 argv[optargc], status);
43fce6dd
JR
75- if (!quiet)
76+ if (!quiet && !fail_ok)
77 pam_error (pamh, _("%s failed: unknown status 0x%x"),
78 argv[optargc], status);
d2e58812
JR
79 }
80- return PAM_SYSTEM_ERR;
43fce6dd 81+ if (!fail_ok)
d2e58812
JR
82+ return PAM_SYSTEM_ERR;
83+ else
84+ return PAM_SUCCESS;
85 }
86 return PAM_SUCCESS;
87 }
This page took 0.146332 seconds and 4 git commands to generate.