RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 719378 - White space in user name causes error
Summary: White space in user name causes error
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.2
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Bryan Kearney
QA Contact: J.C. Molet
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel62
TreeView+ depends on / blocked
 
Reported: 2011-07-06 16:06 UTC by J.C. Molet
Modified: 2011-12-06 17:22 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-06 17:22:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1695 0 normal SHIPPED_LIVE subscription-manager bug fix and enhancement update 2011-12-06 01:23:29 UTC
Red Hat Product Errata RHBA-2011:1696 0 normal SHIPPED_LIVE python-rhsm bug fix update 2011-12-06 00:49:52 UTC

Description J.C. Molet 2011-07-06 16:06:17 UTC
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):
subscription-manager-gnome-0.96.2-1.git.29.636d925.el6.x86_64
subscription-manager-firstboot-0.96.2-1.git.29.636d925.el6.x86_64
python-rhsm-0.96.5-1.git.17.8214a01.el6.noarch
subscription-manager-0.96.2-1.git.29.636d925.el6.x86_64

How reproducible:
always

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
    self.validateResponse(result)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 222, in validateResponse
    raise NetworkException(response['status'])
NetworkException


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 19:03:03 UTC
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 14:22:07 UTC
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 16:55:13 UTC
try 5de26be1a1e7edaa321313fa595e0bc8c06db4dc in master.

Comment 5 J.C. Molet 2011-07-25 17:47:44 UTC
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 19:20:03 UTC
The second fix required a change in python-rhsm. Fixed in master of that package at:

b811552066ead8c7175d7389be13aa81d63e54fd

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

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

Rpm's used:

subscription-manager-0.96.5-1.git.5.4303921.el6.x86_64
subscription-manager-firstboot-0.96.5-1.git.5.4303921.el6.x86_64
subscription-manager-gnome-0.96.5-1.git.5.4303921.el6.x86_64

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

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

http://rhn.redhat.com/errata/RHBA-2011-1695.html


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