RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 879215 - Differences between 'su' version give different results
Summary: Differences between 'su' version give different results
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: coreutils
Version: 6.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Ondrej Vasik
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-11-22 11:00 UTC by Yaniv Bronhaim
Modified: 2013-12-17 20:14 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-12-17 20:14:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Yaniv Bronhaim 2012-11-22 11:00:40 UTC
Description of problem:
when running the following script:
# !/bin/sh

func() {
su user > /dev/null 2>&1 << EOF
echo >> /tmp/b
EOF
}

if func; then
   echo "access"
else
   echo "no access"
fi 

We get different results with coreutils 8.15-8 (which shipped with fedora 17 and return right results) and coreutils 8.4 (rhel6.3 version that returns always 0)

How reproducible:
Run the script above.
  
Actual results:
over rhel6.3 (coreutils 8.4) the result of func is always "access" without any dependency of the file permissions

Expected results:
if the file is not accessible by user the script prints no access, and the other way around.

Additional info:
Ondrej Vasik said that it might be related to the sync with PAM support in the later versions.

Comment 2 Ondrej Vasik 2012-11-22 11:19:20 UTC
Adding Ondra Oprala to CC.
Ondra, can you please take a look on this issue and check what is causing the difference?

Comment 3 Yaniv Bronhaim 2012-11-26 15:06:04 UTC
Some additional info:
1. You have to run that script as root to get actual results, Otherwise the su fails all the time and you get "no access".
2. Your user that you su to must have default shell. Again, the su part fails without it.

If you set both, you get the results I mentioned above.

Comment 4 Ondrej Oprala 2012-11-28 13:10:22 UTC
Thanks to Yaniv, who kindly allowed me access to his machine, I found out that it really is caused by PAM in combination with a user created by the vdsm package, with an unusual home directory path. To be more precise, the su utility doesn't really allow access to the restricted file, it's just an attempt to close the PAM session that fails, changing su's execution path before it can check for the forked shell's return value and returning it's default retval of 0, causing the script to output "access".

I should now be able to reproduce it on my machine and look at it more thoroughly.

Comment 5 Ondrej Vasik 2012-11-28 13:18:22 UTC
Adding Tomas Mraz to CC, as he as PAM specialist may have some insight what's causing this behaviour.

Comment 6 Tomas Mraz 2012-11-28 13:50:33 UTC
Does really only pam_close_session() fail? Or also other PAM calls?

Comment 7 Yaniv Bronhaim 2013-04-30 12:37:36 UTC
I honestly don't know, all I know about this scenario is what I described. Maybe Ondrej can answer that after his investigation.

Comment 9 Ondrej Oprala 2013-07-26 14:16:05 UTC
I'm afraid I wasn't able to reproduce the same behaviour on my machine, even after all the steps from Comment 4. I would probably have to dig in the affected machine again.

Comment 10 Dan Kenigsberg 2013-12-17 14:54:25 UTC
Why was the NAK reason changed to "Reporducer"? I believe a reproducer appears in comment 0.

Comment 11 Ondrej Vasik 2013-12-17 16:07:40 UTC
Based on comment#9 and comment#4, it requires some specific machine to reproduce the issue. Comment#0 was not enough.

Comment 12 Dan Kenigsberg 2013-12-17 17:56:47 UTC
So sorry.

Comment 13 Yaniv Bronhaim 2013-12-17 20:05:18 UTC
it works with coreutils-8.4-19, can close it as CURRENTRELEASE imo

Comment 14 Ondrej Vasik 2013-12-17 20:14:20 UTC
Ok, let's close it, feel free to reopen if it does reoccur - thanks.


Note You need to log in before you can comment on or make changes to this bug.