Bug 1023166

Summary: Trim trailing whitespace from username when registering through CLI
Product: Red Hat Enterprise Linux 7 Reporter: Matt Reid <mreid>
Component: subscription-managerAssignee: Bryan Kearney <bkearney>
Status: CLOSED CURRENTRELEASE QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: bkearney, ckozak
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 13:29:14 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: 863175    

Description Matt Reid 2013-10-24 19:08:29 UTC
Description of problem:
If you register through the GUI and accidentally include an extra space or two after the username, we handle it gracefully and trim it, allowing the user to successfully continue. While the GUI is the more important area to watch for that, due to copy/paste sometimes adding in trailing spaces, it would be nice if we did the same magic for the username on CLI registration. Currently if you input "admin " in the CLI, it will error out with Invalid Credentials, but the same "admin " is accepted as fine through the Registration Dialog in the GUI.

Should just be running the given username through a trim or something right?

Comment 3 Bryan Kearney 2013-10-30 12:23:02 UTC
commit 8f7e7cd7f085605796e703f6a1a4e82984da2fe9
Author: Bryan Kearney <bkearney>
Date:   Mon Oct 28 14:42:32 2013 -0400

    1023166: Strip leading and trailing whitespaces from all usernames and passwords provided on the cli

Comment 5 John Sefler 2013-11-07 19:20:27 UTC
Demonstration of rejected username (with trailing whitespace) credentials...

[root@jsefler-7 ~]# rpm -q subscription-manager
subscription-manager-1.10.5-1.el7.x86_64

[root@jsefler-7 ~]# subscription-manager config --server.hostname=subscription.rhn.stage.redhat.com --server.port=443 --server.prefix=/subscription
[root@jsefler-7 ~]# subscription-manager register --force --username="rhel7beta"
Password: 
The system has been registered with ID: bc800b82-9561-4c11-bbae-1139ab426c2a 
[root@jsefler-7 ~]# subscription-manager register --force --username="rhel7beta "
The system with UUID bc800b82-9561-4c11-bbae-1139ab426c2a has been unregistered
Password: 
Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html
[root@jsefler-7 ~]# 

^^ When --username="rhel7beta " has trailing whitespace, the registration is rejected.


Update subscription-manager (NOT SHOWN)


Verification that username with trailing whitespace credentials is now tolerated...

[root@jsefler-7 ~]# rpm -q subscription-manager
subscription-manager-1.10.6-1.el7.x86_64

[root@jsefler-7 ~]# subscription-manager register --force --username="rhel7beta "Password: 
The system has been registered with ID: 8fe534be-72d5-467a-9f2e-6ae7052c4332 
[root@jsefler-7 ~]# subscription-manager register --force --username=" rhel7beta"
The system with UUID 8fe534be-72d5-467a-9f2e-6ae7052c4332 has been unregistered
Password: 
The system has been registered with ID: 02f63b37-77c5-4890-9bb2-e861dd77e6aa 
[root@jsefler-7 ~]# 

VERIFIED: Specifying username with leading or trailing whitespace during registration is now tolerated.

Comment 6 Ludek Smid 2014-06-13 13:29:14 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.