Bug 27773

Summary: su enhancement
Product: [Retired] Red Hat Linux Reporter: e
Component: sh-utilsAssignee: Bernhard Rosenkraenzer <bero>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: low Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-01-25 00:36:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
su ruser patch none

Description e 2001-02-15 11:23:55 UTC
Please apply this small patch to su to set PAM_RUSER.
Compiled and tested.

BTW pam_listfile core dumps if an argument passed to it does not contain
'=' .


--- sh-utils-2.0/src/su.c.old	Thu Feb 15 04:08:25 2001
+++ sh-utils-2.0/src/su.c	Thu Feb 15 04:08:35 2001
@@ -317,6 +317,8 @@
 correct_password (const struct passwd *pw)
 {
 #ifdef USE_PAM
+  struct passwd *caller;
+
   /* root always succeeds; this isn't an authentication question (no
    * extra privs are being granted) so it shouldn't authenticate with PAM.
    * However, we want to create the pam_handle so that proper credentials
@@ -331,6 +333,11 @@
 	exit(1);
   }

+  caller = getpwuid(getuid());
+  if (caller != NULL && caller->pw_name != NULL) {
+
retval = pam_set_item(pamh, PAM_RUSER, caller->pw_name);
+
PAM_BAIL_P;
+  }

   retval = pam_authenticate(pamh, 0);
   PAM_BAIL_P;

Comment 1 e 2001-02-15 11:26:01 UTC
Created attachment 10081 [details]
su ruser patch

Comment 2 Bernhard Rosenkraenzer 2002-01-25 00:36:23 UTC
Thanks, added in 2.0.11-8.

Comment 3 Bernhard Rosenkraenzer 2002-02-21 13:19:47 UTC
Oops, forgot to close the bug after fixing it.