cdown / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
531551
diff -up util-linux-2.23.2/login-utils/su-common.c.kzak util-linux-2.23.2/login-utils/su-common.c
531551
--- util-linux-2.23.2/login-utils/su-common.c.kzak	2013-07-30 10:39:26.223738407 +0200
531551
+++ util-linux-2.23.2/login-utils/su-common.c	2013-09-09 09:32:05.497238691 +0200
531551
@@ -111,6 +111,9 @@ static int same_session = 0;
531551
 /* SU_MODE_{RUNUSER,SU} */
531551
 static int su_mode;
531551
531551
+/* Don't print PAM info messages (Last login, etc.). */
531551
+static int suppress_pam_info;
531551
+
531551
 static bool _pam_session_opened;
531551
 static bool _pam_cred_established;
531551
 static sig_atomic_t volatile caught_signal = false;
531551
@@ -208,10 +211,23 @@ static void log_btmp(struct passwd const
531551
	updwtmp(_PATH_BTMP, &ut);
531551
 }
531551
531551
+
531551
+static int su_pam_conv(int num_msg, const struct pam_message **msg,
531551
+                       struct pam_response **resp, void *appdata_ptr)
531551
+{
531551
+	if (suppress_pam_info
531551
+	    && num_msg == 1
531551
+	    && msg
531551
+	    && msg[0]->msg_style == PAM_TEXT_INFO)
531551
+		return PAM_SUCCESS;
531551
+
531551
+	return misc_conv(num_msg, msg, resp, appdata_ptr);
531551
+}
531551
+
531551
 static struct pam_conv conv =
531551
 {
531551
-  misc_conv,
531551
-  NULL
531551
+	su_pam_conv,
531551
+	NULL
531551
 };
531551
531551
 static void
531551
@@ -902,6 +918,9 @@ su_main (int argc, char **argv, int mode
531551
531551
   init_groups (pw, groups, num_supp_groups);
531551
531551
+  if (!simulate_login || command)
531551
+    suppress_pam_info = 1;		/* don't print PAM info messages */
531551
+
531551
   create_watching_parent ();
531551
   /* Now we're in the child.  */