Bug 719378 - White space in user name causes error
White space in user name causes error
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager (Show other bugs)
Unspecified Unspecified
unspecified Severity medium
: rc
: ---
Assigned To: Bryan Kearney
J.C. Molet
Depends On:
Blocks: rhsm-rhel62
  Show dependency treegraph
Reported: 2011-07-06 12:06 EDT by J.C. Molet
Modified: 2011-12-06 12:22 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-12-06 12:22:02 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description J.C. Molet 2011-07-06 12:06:17 EDT
Description of problem:
When registering with subscription manager putting white space in the user name causes an incorrect error.

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

How reproducible:

Steps to Reproduce:
1. Find a machine with subscription manager
2. Register the system with a username with white space
    - subscription-manager regigster --username="tesuser1  "
    - or add a couple of spaces in the gui dialog
    - This happens if spaces are anywhere in the register string:  before, after, or in the middle
Actual results:
2011-07-06 12:03:55,180 [INFO]  @connection.py:315 - Using basic authentication as: testuser2  
2011-07-06 12:03:55,180 [INFO]  @connection.py:336 - Connection Established: host: mgmt5.rhq.lab.eng.bos.redhat.com, port: 8443, handler: /candlepin
2011-07-06 12:03:55,180 [INFO]  @connection.py:172 - work in insecure mode ?:False
2011-07-06 12:03:55,181 [INFO]  @connection.py:176 - loading ca pem certificates from: /etc/rhsm/ca/
2011-07-06 12:03:55,181 [INFO]  @connection.py:160 - loading ca certificate '/etc/rhsm/ca/candlepin-stage.pem'
2011-07-06 12:03:55,182 [INFO]  @connection.py:160 - loading ca certificate '/etc/rhsm/ca/fakamai-cp1.pem'
2011-07-06 12:03:55,182 [INFO]  @connection.py:160 - loading ca certificate '/etc/rhsm/ca/mgmt5.pem'
2011-07-06 12:03:55,182 [INFO]  @connection.py:160 - loading ca certificate '/etc/rhsm/ca/redhat-uep.pem'
2011-07-06 12:03:55,284 [INFO]  @connection.py:205 - status code: 505
2011-07-06 12:03:55,284 [ERROR]  @connection.py:217 - No JSON object could be decoded
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 215, in validateResponse
    parsed = json.loads(response['content'])
  File "/usr/lib64/python2.6/site-packages/simplejson/__init__.py", line 307, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.6/site-packages/simplejson/decoder.py", line 335, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.6/site-packages/simplejson/decoder.py", line 353, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
2011-07-06 12:03:55,286 [ERROR]  @managercli.py:51 - Error during registration: 
2011-07-06 12:03:55,286 [ERROR]  @managercli.py:52 - 
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 492, in _do_command
    owner_key = self._determine_owner_key(admin_cp)
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 538, in _determine_owner_key
    owners = cp.getOwnerList(self.username)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 422, in getOwnerList
    return self.conn.request_get(method)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 228, in request_get
    return self._request("GET", method)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 206, in _request
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 222, in validateResponse
    raise NetworkException(response['status'])

Expected results:
You should probably get the standard "invalid credentials" error.  It could also possibly attempt to remove leading and trailing whitespace.

Additional info:
Comment 1 Bryan Kearney 2011-07-21 15:03:03 EDT
Attemnpted to recreate with latest in master, and I am guessing it has been fixed.

[root@bkearney src]# ./subscription-manager register --org admin --auto --user "    fred" --password admin
Invalid Credentials
[root@bkearney src]# ./subscription-manager register --org admin --auto --user "    admin" --password admin
Invalid Credentials
[root@bkearney src]# ./subscription-manager register --org admin --auto --user '    admin' --password admin
Invalid Credentials

[root@bkearney src]#
Comment 3 J.C. Molet 2011-07-22 10:22:07 EDT
This does work on the CLI now as expected.

For some reason though I still get the same "Network Error" on the GUI register instead of the expected "Invalid Credentials" error.
Comment 4 Bryan Kearney 2011-07-22 12:55:13 EDT
try 5de26be1a1e7edaa321313fa595e0bc8c06db4dc in master.
Comment 5 J.C. Molet 2011-07-25 13:47:44 EDT
white-space before and after the username in the GUI is now stripped so that "tesuser   " and "   testuser" both work (if user "testuser" exists).

A network error still occurs if you enter in "test user" where an invalid username message should be displayed.
Comment 6 Bryan Kearney 2011-07-29 15:20:03 EDT
The second fix required a change in python-rhsm. Fixed in master of that package at:

Comment 7 Shwetha Kallesh 2011-08-08 07:07:44 EDT
Moving the bug to verified.

It works fine now. Error message "Invalid credentials" is displayed if you enter in "test user1".

Rpm's used:

Comment 8 errata-xmlrpc 2011-12-06 12:22:02 EST
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, and where to find the updated
files, follow the link below.

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


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