Bug 1023166 - Trim trailing whitespace from username when registering through CLI
Trim trailing whitespace from username when registering through CLI
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Bryan Kearney
John Sefler
:
Depends On:
Blocks: rhsm-rhel70
  Show dependency treegraph
 
Reported: 2013-10-24 15:08 EDT by Matt Reid
Modified: 2014-06-17 20:28 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 09:29:14 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Matt Reid 2013-10-24 15:08:29 EDT
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 08:23:02 EDT
commit 8f7e7cd7f085605796e703f6a1a4e82984da2fe9
Author: Bryan Kearney <bkearney@redhat.com>
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 14:20:27 EST
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 09:29:14 EDT
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.

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