Bug 2125904

Summary: unable to change shells using sudo lchsh
Product: [Fedora] Fedora Reporter: grumpey0
Component: libuserAssignee: Tomas Halman <thalman>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 37CC: jhrozek, thalman
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libuser-0.63-13.fc38 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-09-23 18:17:58 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:

Description grumpey0 2022-09-11 17:38:24 UTC
Description of problem:
Unable to change shells using lchsh

Version-Release number of selected component (if applicable):
0.63-12.fc37

How reproducible:
Every time.

Steps to Reproduce:
1. sudo lchsh username
2.
3.

Actual results:
[grumpey@grumpey0 ~]$ sudo lchsh grumpey
[sudo] password for grumpey: 
Changing shell for ��)\.
User @�I��U does not exist.

Expected results:
Being prompted to change shell for user

Comment 1 grumpey0 2022-09-13 01:20:47 UTC
- This looks likes it is related to: https://bugzilla.redhat.com/show_bug.cgi?id=2100287

With popt-1.19~rc1-4
sudo lid grumpey
/etc/login.defs does not exist

sudo luseradd grumpey2
Error creating group `/etc/login.defs': name contains invalid char `/'

Downgrading from popt-1.19~rc1-4.fc37.x86_64 to popt-1.19~rc1-3.fc37.x86_64 appears to make things work.

Comment 2 Tomas Halman 2022-09-22 15:08:31 UTC
The popt context is freed too early and pointers to parameters are used later. Older popt library actually leaked memory so it worked.

Looking at the code I can confirm that this is bug in libuser and how it uses popt. Probably moving the poptFreeContext(popt) to the end of
the main() will solve the issue. The bug affects more libuser's utilities, not just lchsh.

Tomas

Comment 3 Fedora Update System 2022-09-23 18:16:08 UTC
FEDORA-2022-358fda7efe has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2022-358fda7efe

Comment 4 Fedora Update System 2022-09-23 18:17:58 UTC
FEDORA-2022-358fda7efe has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.