]> git.pld-linux.org Git - packages/pam.git/blob - pam-exec-failok.patch
- rel 3
[packages/pam.git] / pam-exec-failok.patch
1 --- Linux-PAM-0.99.7.1/modules/pam_exec/pam_exec.8.xml~ 2006-06-09 18:44:06.000000000 +0200
2 +++ Linux-PAM-0.99.7.1/modules/pam_exec/pam_exec.8.xml  2007-02-09 22:35:07.000000000 +0100
3 @@ -25,6 +25,9 @@
4          seteuid
5        </arg>
6        <arg choice="opt">
7 +        failok
8 +      </arg>
9 +      <arg choice="opt">
10          log=<replaceable>file</replaceable>
11        </arg>
12        <arg choice="plain">
13 @@ -90,6 +93,18 @@
14            </listitem>
15          </varlistentry>
16  
17 +        <varlistentry>
18 +          <term>
19 +            <option>failok</option>
20 +          </term>
21 +          <listitem>
22 +            <para>
23 +              Return success regardles of the exit code returned
24 +              by the command.
25 +            </para>
26 +          </listitem>
27 +        </varlistentry>
28 +
29        </variablelist>
30  
31      </para>
32 --- Linux-PAM-0.99.7.1/modules/pam_exec/pam_exec.c.orig 2007-02-09 22:30:39.000000000 +0100
33 +++ Linux-PAM-0.99.7.1/modules/pam_exec/pam_exec.c      2007-02-09 22:37:07.000000000 +0100
34 @@ -64,6 +64,7 @@
35  {
36    int debug = 0;
37    int call_setuid = 0;
38 +  int fail_ok = 0;
39    int optargc;
40    const char *logfile = NULL;
41    pid_t pid;
42 @@ -85,6 +86,8 @@
43         logfile = &argv[optargc][4];
44        else if (strcasecmp (argv[optargc], "seteuid") == 0)
45         call_setuid = 1;
46 +      else if (strcasecmp (argv[optargc], "failok") == 0)
47 +       fail_ok = 1;
48        else
49         break; /* Unknown option, assume program to execute. */
50      }
51 @@ -115,26 +118,32 @@
52             {
53               pam_syslog (pamh, LOG_ERR, "%s failed: exit code %d",
54                           argv[optargc], WEXITSTATUS(status));
55 -             pam_error (pamh, _("%s failed: exit code %d"),
56 -                        argv[optargc], WEXITSTATUS(status));
57 +             if (fail_ok == 0)
58 +                 pam_error (pamh, _("%s failed: exit code %d"),
59 +                            argv[optargc], WEXITSTATUS(status));
60             }
61           else if (WIFSIGNALED(status))
62             {
63               pam_syslog (pamh, LOG_ERR, "%s failed: caught signal %d%s",
64                           argv[optargc], WTERMSIG(status),
65                           WCOREDUMP(status) ? " (core dumped)" : "");
66 -             pam_error (pamh, _("%s failed: caught signal %d%s"),
67 -                        argv[optargc], WTERMSIG(status),
68 -                        WCOREDUMP(status) ? " (core dumped)" : "");
69 +             if (fail_ok == 0)
70 +                 pam_error (pamh, _("%s failed: caught signal %d%s"),
71 +                            argv[optargc], WTERMSIG(status),
72 +                            WCOREDUMP(status) ? " (core dumped)" : "");
73             }
74           else
75             {
76               pam_syslog (pamh, LOG_ERR, "%s failed: unknown status 0x%x",
77                           argv[optargc], status);
78 -             pam_error (pamh, _("%s failed: unknown status 0x%x"),
79 -                        argv[optargc], status);
80 +             if (fail_ok == 0)
81 +                 pam_error (pamh, _("%s failed: unknown status 0x%x"),
82 +                            argv[optargc], status);
83             }
84 -         return PAM_SYSTEM_ERR;
85 +         if (fail_ok == 0)
86 +           return PAM_SYSTEM_ERR;
87 +         else
88 +           return PAM_SUCCESS;
89         }
90        return PAM_SUCCESS;
91      }
This page took 0.068122 seconds and 3 git commands to generate.