Bug 1065423

Summary: -sesh replaces /path/to/myshell with /path/to-myshell instead of -myshell
Product: [Fedora] Fedora Reporter: Filip Krska <fkrska>
Component: sudoAssignee: Daniel Kopeček <dkopecek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 20CC: dkopecek, kzak
Target Milestone: ---Keywords: EasyFix, Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sudo-1.8.12-1.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1065415 Environment:
Last Closed: 2015-02-23 23:24:45 UTC Type: Bug
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
sesh loginshell argv[0] replacement patch fkrska: review?

Description Filip Krska 2014-02-14 16:04:59 UTC
Created attachment 863324 [details]
sesh loginshell argv[0] replacement patch

Reproduces in sudo-1.8.8-1.fc20.x86_64 as well

+++ This bug was initially created as a clone of Bug #1065415 +++

Description of problem:

/usr/libexec/sesh if called as -sesh by sudo executes the login shell with wrongly replaced argv[0]. The last "/" is replaced with "-", but the rest of the path remains intact. I expect login shell should be called as "-shell", not "/bin-shell".

This can cause unexpected behaviour e.g. in case /bin/zsh which thinks it was called as /bin-zsh, thus runs in sh emulation mode because bin-zsh starts with "b".

Version-Release number of selected component (if applicable):

sudo-1.8.6p3-12.el6.x86_64

How reproducible:

Always

Steps to Reproduce:
1. add

%wheel	ALL=(ALL) ROLE=unconfined_r TYPE=unconfined_t NOPASSWD: ALL

to sudoers (this triggers sesh, without selinux context specified sesh isn't involved)

2. # chsh -s /bin/zsh

3. # usermod -G wheel zshuser

4. [zshuser@rhel6]~% sudo -i

Actual results:

only

#

prompt is shown, no zsh specific rc scripts are sourced in sh emulation mode
 
In strace we see:

execve("/bin/zsh", ["/bin-zsh"], ...

Expected results:

[root@rhel62]~# 

prompt is shown, zsh is launched without emulation

In strace we see:

execve("/bin/zsh", ["-zsh"], ...

Additional info:

Reproduces in sudo-1.8.8-1.fc20.x86_64 as well

Patch attached

Comment 1 Fedora Update System 2014-09-30 15:20:54 UTC
sudo-1.8.11-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/sudo-1.8.11-1.fc20

Comment 2 Fedora Update System 2014-10-01 04:22:23 UTC
Package sudo-1.8.11-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing sudo-1.8.11-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-11928/sudo-1.8.11-1.fc20
then log in and leave karma (feedback).

Comment 3 Fedora Update System 2014-11-03 14:27:15 UTC
sudo-1.8.11p2-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/sudo-1.8.11p2-1.fc20

Comment 4 Fedora Update System 2015-02-18 10:20:19 UTC
sudo-1.8.12-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/sudo-1.8.12-1.fc20

Comment 5 Fedora Update System 2015-02-23 23:24:45 UTC
sudo-1.8.12-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.