Bug 2076819

Summary: [RHEL 9 Beta] newusers command does not suggest to use --badnames when special characters are present in the file & when --badnames is not provided
Product: Red Hat Enterprise Linux 9 Reporter: Abdul Rehman Quadri <aquadri>
Component: shadow-utilsAssignee: Iker Pedrosa <ipedrosa>
Status: CLOSED ERRATA QA Contact: Anuj Borah <aborah>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.0CC: aborah, aboscatt, cww, pbrezina
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
URL: http//
Whiteboard:
Fixed In Version: shadow-utils-4.9-6.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 08:15:11 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:
Bug Depends On:    
Bug Blocks: 2010412    

Description Abdul Rehman Quadri 2022-04-20 01:49:53 UTC
Description of problem:
The newusers command reads a file and uses this information to update a set of existing users or to create new users. Until now it was not allowed to use any special characters in the username/groupname except a few. But with this release, we have a new option called --badnames that allows us to use special symbols in the usernames/groupnames.

When we execute the newusers command on a file that has special characters in the user/group name, the command fails with an error but there is no suggestion provided to use "--badnames".


Version-Release number of selected component (if applicable):
shadow-utils-4.9-3.el9.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Login as superuser or privileged user
2. Create a file as per the valid syntax for e.g: a file “batchusers” with the following users data:
users@1:users@1:1010:1010:Users 1:/home/users1:/bin/bash
users@2:users@2:1011:1011:Users 2:/home/users2:/bin/bash
3. Execute the command: # newusers batchusers

4. Execute command: # newusers --badnames batchusers

Actual results:
1. The result of step 3 is:
newusers: invalid user name 'users@1'
newusers: line 1: can't create user
newusers: invalid user name 'users@2'
newusers: line 2: can't create user

2. The execution of step 4 results in adding users successfully.

Expected results:
It would be helpful if Step 3 gives a suggestion to use "--badnames" along with the error messages.

Additional info:

Comment 1 Iker Pedrosa 2022-05-09 06:46:44 UTC
master:
    Suggest badname if name has special characters - 0593b330d8413e9694b5d6783bb90974c9b141c5
    po: update translation files - b62d02f38f2c38d1a944629c07d3cb021c93d521
    man: correct "badname" option - edf5ea79740c328b71f7840fd598c403cea33df8
    src: correct "badname" option - 45d674621918664c8736f94f862e86bddf4c3fd4

Comment 10 errata-xmlrpc 2023-05-09 08:15:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (shadow-utils bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2467