Skip to content

Commit 20cbab8

Browse files
committed
pam_openrc: respect PAM_SILENT
1 parent c5b2a0c commit 20cbab8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/pam_openrc/pam_openrc.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "einfo.h"
1414

1515
static int
16-
exec_openrc(pam_handle_t *pamh, bool opening)
16+
exec_openrc(pam_handle_t *pamh, bool opening, bool quiet)
1717
{
1818
char *svc_name, *pam_lock, *logins, *script = NULL;
1919
const char *username = NULL, *session = NULL;
@@ -29,6 +29,11 @@ exec_openrc(pam_handle_t *pamh, bool opening)
2929

3030
setenv("EINFO_LOG", "pam_openrc", true);
3131

32+
if (quiet) {
33+
setenv("EINFO_QUIET", "yes", true);
34+
setenv("EERROR_QUIET", "yes", true);
35+
}
36+
3237
if (pam_get_item(pamh, PAM_SERVICE, (const void **)&session) != PAM_SUCCESS) {
3338
elog(LOG_ERR, "Failed to get PAM_SERVICE");
3439
return PAM_SESSION_ERR;
@@ -127,15 +132,14 @@ exec_openrc(pam_handle_t *pamh, bool opening)
127132
PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags, int argc, const char **argv) {
128133
(void) argc;
129134
(void) argv;
130-
(void) flags;
131135

132-
return exec_openrc(pamh, true);
136+
return exec_openrc(pamh, true, flags & PAM_SILENT);
133137
}
134138

135139
PAM_EXTERN int pam_sm_close_session(pam_handle_t *pamh, int flags, int argc, const char **argv) {
136140
(void) argc;
137141
(void) argv;
138142
(void) flags;
139143

140-
return exec_openrc(pamh, false);
144+
return exec_openrc(pamh, false, flags & PAM_SILENT);
141145
}

0 commit comments

Comments
 (0)