]> git.ipfire.org Git - thirdparty/util-linux.git/commit
su: suppress PAM info messages for -c or non-login sessions
authorKarel Zak <kzak@redhat.com>
Tue, 27 Aug 2013 09:23:54 +0000 (11:23 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 27 Aug 2013 09:49:13 +0000 (11:49 +0200)
commitfb4edda749e4c81e9ce713a017240ded8f521d07
tree3b2b2f7aea21429db131526750e627a97a8d3549
parent03d00d495f3b505d9cae967c629fb38aca301e01
su: suppress PAM info messages for -c or non-login sessions

The 'Last login:' messages from PAM lastlogin module is unexpected
for non-login sessions or when -c <command> executed.

For example:

  $ su - -c id
  Last login: Wed Jul 24 08:36:28 CEST 2013 from dhcp-25-161.brq.redhat.com on pts/18
  uid=0(root) gid=0(root) skupiny=0(root)

this makes 'su' useless in scripts.

This patch suppress all PAM_TEXT_INFO messages for -c and for
non-login session ('-' is not specified) after pam_authenticate() and
pam_acct_mgmt().

Note that the new PAM conversation function checks the first message
in the msg[] array only. It seems good enough as PAM internally uses
pam_info() function that does not use multiple messages for one conv
call.

References: https://bugzilla.redhat.com/show_bug.cgi?id=987787
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/su-common.c