Bug 720966

Summary: The interactive mode of rhn-channel doesn't handle entered user name correctly
Product: Red Hat Enterprise Linux 5 Reporter: Radek Bíba <rbiba>
Component: rhn-client-toolsAssignee: Tomas Lestach <tlestach>
Status: CLOSED ERRATA QA Contact: Jiří Mikulka <jmikulka>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.7CC: jhutar, jmikulka, mminar, roy.keene, slukasik, tlestach
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhn-client-tools-0.4.20-63 Doc Type: Bug Fix
Doc Text:
Cause: Username not stripped. Consequence: Authentication fails, when entering username and password interactively. Result: Authentication succeeds, when entering correct credentials interactively.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-21 06:30:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Radek Bíba 2011-07-13 11:10:51 UTC
Description of problem:
rhn-channel is now able to accept user name and/or password interactively (bug 641029). However, when both the user name and the password are entered interactively, rhn-channel fails to alter the channel subscription. Even though I'm absolutely sure that I'm entering the right data.

Version-Release number of selected component (if applicable):
rhn-client-tools-0.4.20-56.el5

How reproducible:
Always

Steps to Reproduce:
e.g., # rhn-channel -r -c rhel-i386-server-5-sts
Username:
(not copied here)
Password:
Error validating data at server:

Error Message:
    Invalid username/password combination
Error Class Code: 2
Error Class Info:
     Invalid username and password combination.

Additional info:
The problem is here in the script:
    62      if not OPTIONS.user and not OPTIONS.list:
    63          print("Username: ")
    64          OPTIONS.user = sys.stdin.readline()

First of all, the prompt should stay on the same line, but that's not fatal. What makes rhn-channel fail is the fact that readline() keeps the new line character and sends the entered user name and the new line to RHN. The code should read:

if not OPTIONS.user and not OPTIONS.list:
    print "Username: ",
    OPTIONS.user = sys.stdin.readline().rstrip('\n')

Comment 1 Tomas Lestach 2011-10-05 09:54:36 UTC
Fixed within Bug 567901.

spacewalk.git: bb748540104fc834ead706bb6c4ac45659b6cd98

Comment 4 Tomas Lestach 2011-10-25 12:15:07 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause:
Username not stripped.
Consequence:
Authentication fails, when entering username and password interactively.
Result:
Authentication succeeds, when entering correct credentials interactively.

Comment 7 errata-xmlrpc 2012-02-21 06:30:19 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-2012-0250.html

Comment 8 Radek Bíba 2012-04-27 08:35:22 UTC
*** Bug 773102 has been marked as a duplicate of this bug. ***