SOURCES: pam-exec-failok.patch (NEW) - add failok option to pam_ex...

baggins baggins at pld-linux.org
Sat Feb 10 21:17:46 CET 2007


Author: baggins                      Date: Sat Feb 10 20:17:46 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- add failok option to pam_exec to ignore exit code from command

---- Files affected:
SOURCES:
   pam-exec-failok.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/pam-exec-failok.patch
diff -u /dev/null SOURCES/pam-exec-failok.patch:1.1
--- /dev/null	Sat Feb 10 21:17:46 2007
+++ SOURCES/pam-exec-failok.patch	Sat Feb 10 21:17:41 2007
@@ -0,0 +1,91 @@
+--- Linux-PAM-0.99.7.1/modules/pam_exec/pam_exec.8.xml~	2006-06-09 18:44:06.000000000 +0200
++++ Linux-PAM-0.99.7.1/modules/pam_exec/pam_exec.8.xml	2007-02-09 22:35:07.000000000 +0100
+@@ -25,6 +25,9 @@
+         seteuid
+       </arg>
+       <arg choice="opt">
++        failok
++      </arg>
++      <arg choice="opt">
+         log=<replaceable>file</replaceable>
+       </arg>
+       <arg choice="plain">
+@@ -90,6 +93,18 @@
+           </listitem>
+         </varlistentry>
+ 
++        <varlistentry>
++          <term>
++            <option>failok</option>
++          </term>
++          <listitem>
++            <para>
++              Return success regardles of the exit code returned
++              by the command.
++            </para>
++          </listitem>
++        </varlistentry>
++
+       </variablelist>
+ 
+     </para>
+--- Linux-PAM-0.99.7.1/modules/pam_exec/pam_exec.c.orig	2007-02-09 22:30:39.000000000 +0100
++++ Linux-PAM-0.99.7.1/modules/pam_exec/pam_exec.c	2007-02-09 22:37:07.000000000 +0100
+@@ -64,6 +64,7 @@
+ {
+   int debug = 0;
+   int call_setuid = 0;
++  int fail_ok = 0;
+   int optargc;
+   const char *logfile = NULL;
+   pid_t pid;
+@@ -85,6 +86,8 @@
+ 	logfile = &argv[optargc][4];
+       else if (strcasecmp (argv[optargc], "seteuid") == 0)
+ 	call_setuid = 1;
++      else if (strcasecmp (argv[optargc], "failok") == 0)
++	fail_ok = 1;
+       else
+ 	break; /* Unknown option, assume program to execute. */
+     }
+@@ -115,26 +118,32 @@
+ 	    {
+ 	      pam_syslog (pamh, LOG_ERR, "%s failed: exit code %d",
+ 			  argv[optargc], WEXITSTATUS(status));
+-	      pam_error (pamh, _("%s failed: exit code %d"),
+-			 argv[optargc], WEXITSTATUS(status));
++	      if (fail_ok == 0)
++	          pam_error (pamh, _("%s failed: exit code %d"),
++			     argv[optargc], WEXITSTATUS(status));
+ 	    }
+ 	  else if (WIFSIGNALED(status))
+ 	    {
+ 	      pam_syslog (pamh, LOG_ERR, "%s failed: caught signal %d%s",
+ 			  argv[optargc], WTERMSIG(status),
+ 			  WCOREDUMP(status) ? " (core dumped)" : "");
+-	      pam_error (pamh, _("%s failed: caught signal %d%s"),
+-			 argv[optargc], WTERMSIG(status),
+-			 WCOREDUMP(status) ? " (core dumped)" : "");
++	      if (fail_ok == 0)
++	          pam_error (pamh, _("%s failed: caught signal %d%s"),
++			     argv[optargc], WTERMSIG(status),
++			     WCOREDUMP(status) ? " (core dumped)" : "");
+ 	    }
+ 	  else
+ 	    {
+ 	      pam_syslog (pamh, LOG_ERR, "%s failed: unknown status 0x%x",
+ 			  argv[optargc], status);
+-	      pam_error (pamh, _("%s failed: unknown status 0x%x"),
+-			 argv[optargc], status);
++	      if (fail_ok == 0)
++	          pam_error (pamh, _("%s failed: unknown status 0x%x"),
++			     argv[optargc], status);
+ 	    }
+-	  return PAM_SYSTEM_ERR;
++	  if (fail_ok == 0)
++	    return PAM_SYSTEM_ERR;
++	  else
++	    return PAM_SUCCESS;
+ 	}
+       return PAM_SUCCESS;
+     }
================================================================


More information about the pld-cvs-commit mailing list