summaryrefslogtreecommitdiff
path: root/modules/pam_exec/pam_exec.c
diff options
context:
space:
mode:
authorPatrick Schleizer <adrelanos@whonix.org>2021-03-01 14:07:10 +0000
committerTomáš Mráz <tm@t8m.info>2021-06-10 15:54:43 +0200
commitbd76c538ef4747912733458a5d9e645424ea93fb (patch)
tree077889869098132312c4dbf81695949744a6d683 /modules/pam_exec/pam_exec.c
parentd62120ed7cfa99dec0e66e562f20fb32987c5980 (diff)
pam_exec: implement quiet_log option
* modules/pam_exec/pam_exec.c (call_exec): Implement quiet_log option. * modules/pam_exec/pam_exec.8.xml: Document it. Resolves: https://github.com/linux-pam/linux-pam/issues/334
Diffstat (limited to 'modules/pam_exec/pam_exec.c')
-rw-r--r--modules/pam_exec/pam_exec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/pam_exec/pam_exec.c b/modules/pam_exec/pam_exec.c
index 5ca85ab3..05dec167 100644
--- a/modules/pam_exec/pam_exec.c
+++ b/modules/pam_exec/pam_exec.c
@@ -93,6 +93,7 @@ call_exec (const char *pam_type, pam_handle_t *pamh,
int debug = 0;
int call_setuid = 0;
int quiet = 0;
+ int quiet_log = 0;
int expose_authtok = 0;
int use_stdout = 0;
int optargc;
@@ -133,6 +134,8 @@ call_exec (const char *pam_type, pam_handle_t *pamh,
call_setuid = 1;
else if (strcasecmp (argv[optargc], "quiet") == 0)
quiet = 1;
+ else if (strcasecmp (argv[optargc], "quiet_log") == 0)
+ quiet_log = 1;
else if (strcasecmp (argv[optargc], "expose_authtok") == 0)
expose_authtok = 1;
else
@@ -269,6 +272,7 @@ call_exec (const char *pam_type, pam_handle_t *pamh,
{
if (WIFEXITED(status))
{
+ if (!quiet_log)
pam_syslog (pamh, LOG_ERR, "%s failed: exit code %d",
argv[optargc], WEXITSTATUS(status));
if (!quiet)
@@ -277,6 +281,7 @@ call_exec (const char *pam_type, pam_handle_t *pamh,
}
else if (WIFSIGNALED(status))
{
+ if (!quiet_log)
pam_syslog (pamh, LOG_ERR, "%s failed: caught signal %d%s",
argv[optargc], WTERMSIG(status),
WCOREDUMP(status) ? " (core dumped)" : "");
@@ -287,6 +292,7 @@ call_exec (const char *pam_type, pam_handle_t *pamh,
}
else
{
+ if (!quiet_log)
pam_syslog (pamh, LOG_ERR, "%s failed: unknown status 0x%x",
argv[optargc], status);
if (!quiet)