Bug 507347 - Can not use password with accent characters
Summary: Can not use password with accent characters
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Spacewalk
Classification: Community
Component: Clients
Version: 0.6
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: space16
TreeView+ depends on / blocked
 
Reported: 2009-06-22 13:02 UTC by Miroslav Suchý
Modified: 2011-08-08 09:00 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-08-08 09:00:45 UTC
Embargoed:


Attachments (Terms of Use)
Accept unicode characters (6.37 KB, patch)
2011-08-08 09:00 UTC, Miroslav Suchý
no flags Details | Diff

Description Miroslav Suchý 2009-06-22 13:02:34 UTC
Description of problem:
I could not rhn_register system if my password contains international characters. However I can create user with such password and login to webui without problem.

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

How reproducible:
always

Steps to Reproduce:
1. create user foobar with password: ščřžýáí
2. run rhn_register on client machine
3. login as foobar with password ščřžýáí
  
Actual results:
Traceback and rhn_register fail

Expected results:
no problems

Additional info:
Exception reported from xen30.englab.brq.redhat.com
Time: Mon Jun 22 17:06:16 2009
Exception type exceptions.UnicodeEncodeError
Exception while handling function registration.available_eus_channels
Request object information:
URI: /XMLRPC
Remote Host: vmware113.englab.brq.redhat.com
Server Name: xen30.englab.brq.redhat.com:443
Headers passed in:
	Accept-Encoding: identity, identity
	Content-Length: 430
	Host: xen30.englab.brq.redhat.com:443
	X-RHN-IP-Path: 10.34.34.158
	X-RHN-Proxy-Auth: 1000010101::1245682390.16:21600.0:dOWgDm2WO91A8O8o2wbR0g==:vmware113.englab.brq.redhat.com
	X-RHN-Proxy-Version: 5.3.0
	content-type: text/xml
	user-agent: rhn.rpclib.py/$Revision: 102540 $
	x-client-version: 1
	x-info: RPC Processor (C) Red Hat, Inc (version 102540)
	x-rhn-client-capability: packages.verifyAll(1)=1,caneatCheese(1)=1,packages.extended_profile(1)=1,reboot.reboot(1)=1,packages.verify(1)=1,packages.runTransaction(1)=1,packages.rollBack(1)=1
	x-rhn-transport-capability: follow-redirects=2
	x-transport-info: Extended Capabilities Transport (C) Red Hat, Inc (version 102540)
	x-up2date-version: 0.4.17-8.el5
Extra information about this error:
Response sent back to the caller:
While running 'registration.available_eus_channels': caught
exceptions.UnicodeEncodeError : 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)



Exception Handler Information
Traceback (most recent call last):
  File "/usr/share/rhn/server/apacheRequest.py", line 120, in call_function
    response = apply(func, params)
  File "/usr/share/rhn/server/handlers/xmlrpc/registration.py", line 1332, in available_eus_channels
    if not user.check_password(password):
  File "/usr/share/rhn/server/rhnUser.py", line 114, in check_password
    return check_password(password, good_pwd, old_pwd)
  File "/usr/share/rhn/server/rhnUser.py", line 714, in check_password
    key = str(key)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)

Local variables by frame
Frame check_password in /usr/share/rhn/server/rhnUser.py at line 714
	                 key = <type 'unicode'> <ERROR WHILE PRINTING VALUE>
	  encrypted_password = <type 'int'> 1
	                pwd2 = <type 'str'> None
	                pwd1 = <type 'str'> $1$XPax4Br8$zzU.rOOlW5V7om/I0ddfI0

Frame check_password in /usr/share/rhn/server/rhnUser.py at line 114
	            password = <type 'unicode'> <ERROR WHILE PRINTING VALUE>
	            good_pwd = <type 'str'> $1$XPax4Br8$zzU.rOOlW5V7om/I0ddfI0
	             old_pwd = <type 'str'> None
	                self = <type 'instance'> <server.rhnUser.User instance at 0xb338a38c>

Frame available_eus_channels in /usr/share/rhn/server/handlers/xmlrpc/registration.py at line 1332
	            username = <type 'str'> foobar
	             version = <type 'str'> 5Server
	                self = <type 'instance'> <server.handlers.xmlrpc.registration.Registration instance at 0xb338a3ec>
	               other = <type 'NoneType'> None
	                user = <type 'instance'> <server.rhnUser.User instance at 0xb338a38c>
	             release = <type 'str'> 5.2.0.4
	            password = <type 'unicode'> <ERROR WHILE PRINTING VALUE>
	                arch = <type 'str'> i686-redhat-linux

Frame call_function in /usr/share/rhn/server/apacheRequest.py at line 135
	               fault = <type 'int'> 1
	                self = <type 'instance'> <server.apacheRequest.apachePOST instance at 0xb3380aac>
	              e_type = <type 'classobj'> exceptions.UnicodeEncodeError
	              method = <type 'unicode'> registration.available_eus_channels
	              params = <type 'tuple'> ('foobar', u'\u0161\u010d\u0159\u017e\xfd\xe1\xed', 'i686-redhat-linux', '5Server', '5.2.0.4')
	      force_rollback = <type 'int'> 1
	                func = <type 'instancemethod'> <bound method Registration.available_eus_channels of <server.handlers.xmlrpc.registration.Registration instance at 0xb338a3ec>>
	             e_value = <type 'instance'> 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)
	            response = <type 'instance'> <Fault 1: u"While running 'registration.available_eus_channels': caught\nexceptions.UnicodeEncodeError : 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)\n">

Frame process in /usr/share/rhn/server/apacheRequest.py at line 473
	                  fd = <type 'instance'> <cStringIO.StringO object at 0xb3380a20>
	               _body = <type 'str'> <?xml version='1.0'?>
<methodCall>
<methodName>registration.available_eus_channels</methodName>
<params>
<param>
<value><string>foobar</string></value>
</param>
<param>
<value><string>ščřžýáí</string></value>
</param>
<param>
<value><string>i686-redhat-linux</string></value>
</param>
<param>
<value><string>5Server</string></value>
</param>
<param>
<value><string>5.2.0.4</string></value>
</param>
</params>
</methodCall>

	              params = <type 'tuple'> ('foobar', u'\u0161\u010d\u0159\u017e\xfd\xe1\xed', 'i686-redhat-linux', '5Server', '5.2.0.4')
	              method = <type 'unicode'> registration.available_eus_channels
	                self = <type 'instance'> <server.apacheRequest.apachePOST instance at 0xb3380aac>

Frame handler in /usr/share/rhn/server/apacheHandler.py at line 198
	                   h = <type 'instance'> <__builtin__.OracleCursor on <cx_Oracle.Connection to rhnsat@rhnsat>>
	                self = <type 'instance'> <server.apacheHandler.apacheHandler instance at 0xb7c560ac>
	                 req = <type 'mp_request'> <mp_request object at 0xb7ef3d2c>
	                 ret = <type 'int'> 1
	     templateStrings = <type 'dict'> {'email_account_info': '\nAccount Information:\n  Your RHN login:         <login />\n  Your RHN email address: <email-address />', 'email_footer': '--the Red Hat Network Team', 'hostname': 'xen30.englab.brq.redhat.com'}
	                 row = <type 'NoneType'> None

Frame __call__ in /usr/share/rhn/server/apacheServer.py at line 58
	                self = <type 'instance'> <server.apacheServer.HandlerWrap instance at 0xb7cf2acc>
	                 req = <type 'mp_request'> <mp_request object at 0xb7ef3d2c>
	                   f = <type 'instancemethod'> <bound method apacheHandler.handler of <server.apacheHandler.apacheHandler instance at 0xb7c560ac>>

Frame HandlerDispatch in /usr/lib/python2.4/site-packages/mod_python/apache.py at line 299
	                 req = <type 'mp_request'> <mp_request object at 0xb7ef3d2c>
	              config = <type 'mp_table'> {'PythonInterpreter': 'rhn.server', 'PythonPath': 'sys.path+['/usr/share/rhn']'}
	                self = <type 'instance'> <mod_python.apache.CallBack instance at 0xb7f0176c>
	              object = <type 'instance'> <server.apacheServer.HandlerWrap instance at 0xb7cf2acc>
	                   l = <type 'list'> ['server.apacheServer', 'Handler']
	              module = <type 'module'> <module 'server.apacheServer' from '/usr/share/rhn/server/apacheServer.pyc'>
	               hlist = <type 'mp_hlist'> {'handler:'server.apacheServer::Handler','directory':'/XMLRPC/','silent':0}
	          object_str = <type 'str'> Handler
	               debug = <type 'int'> 0
	         module_name = <type 'str'> server.apacheServer
	          pathstring = <type 'str'> sys.path+['/usr/share/rhn']
	              result = <type 'int'> 500


Environment for PID=6569 on exception:
LANG = C
NLS_LANG = english.AL32UTF8
ORACLE_HOME = /opt/oracle
PATH = /sbin:/usr/sbin:/bin:/usr/bin
PERL_BADFREE = 0
PWD = /
SHLVL = 2
TERM = xterm
_ = /usr/sbin/httpd

Comment 1 Clifford Perry 2009-07-27 20:34:03 UTC
2+ yrs ago in Satellite we did an audit and clearly defined the allowed set of chars and then made sure that command line client tools, webui, API and backend python stacks all had the same regex. I assume then that something, somewhere changed over time, I expect the command line client tool is correct in this case and Spacewalk needs reviewing.

Space07 bug to me.

Comment 2 Jan Pazdziora 2010-05-05 06:30:34 UTC
Taking.

Comment 3 Jan Pazdziora 2010-05-05 06:31:26 UTC
With Spacewalk 1.0, the traceback is a little bit different:

Exception Handler Information
Traceback (most recent call last):
  File "/usr/share/rhn/server/apacheServer.py", line 58, in __call__
    ret = f(req)
  File "/usr/share/rhn/server/apacheHandler.py", line 198, in handler
    ret = self._req_processor.process()
  File "/usr/share/rhn/server/apacheRequest.py", line 473, in process
    return self.call_function(method, params)
  File "/usr/share/rhn/server/apacheRequest.py", line 143, in call_function
    response = f.getxml()
  File "/usr/share/rhn/common/rhnException.py", line 429, in getxml
    s.write(_("Error Message:\n    %s\n") % string.strip(self.text))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0159' in position 48: ordinal not in range(128)

Local variables by frame
Frame getxml in /usr/share/rhn/common/rhnException.py at line 429
	   templateOverrides = <type 'dict'> {'email_account_info': '\nAccount Information:\n  Your Spacewalk login:         <login />\n  Your Spacewalk email address: <email-address />', 'email_footer': '--the Spacewalk Team', 'hostname': 'vmware145.englab.brq.redhat.com'}
	                   s = <type 'cStringIO.StringO'> <cStringIO.StringO object at 0xb7a93c20>
	                self = <type 'instance'> (15, u"password contains character `\u0159'", 'The username contains invalid characters.')
	               label = <type 'str'> hostname

Frame call_function in /usr/share/rhn/server/apacheRequest.py at line 143
	                   f = <type 'instance'> (15, u"password contains character `\u0159'", 'The username contains invalid characters.')
	                self = <type 'instance'> <server.apacheRequest.apachePOST instance at 0xb7c1116c>
	      force_rollback = <type 'int'> 1
	              params = <type 'tuple'> ('krizala', u'k\u0159\xed\u017eala')
	                func = <type 'instancemethod'> <bound method Registration.reserve_user of <server.handlers.xmlrpc.registration.Registration instance at 0xb7a93ccc>>
	              method = <type 'unicode'> registration.reserve_user

Frame process in /usr/share/rhn/server/apacheRequest.py at line 473
	                  fd = <type 'instance'> <cStringIO.StringO object at 0xb7a93be0>
	               _body = <type 'str'> <?xml version='1.0'?>
<methodCall>
<methodName>registration.reserve_user</methodName>
<params>
<param>
<value><string>krizala</string></value>
</param>
<param>
<value><string>křížala</string></value>
</param>
</params>
</methodCall>

	              params = <type 'tuple'> ('krizala', u'k\u0159\xed\u017eala')
	              method = <type 'unicode'> registration.reserve_user
	                self = <type 'instance'> <server.apacheRequest.apachePOST instance at 0xb7c1116c>

Frame handler in /usr/share/rhn/server/apacheHandler.py at line 202
	                   h = <type 'instance'> <__builtin__.OracleCursor on <cx_Oracle.Connection to spacewalk@xe>>
	                self = <type 'instance'> <server.apacheHandler.apacheHandler instance at 0xb7c1396c>
	                 req = <type 'mp_request'> <mp_request object at 0xb7e95d2c>
	                 ret = <type 'int'> 0
	     templateStrings = <type 'dict'> {'email_account_info': '\nAccount Information:\n  Your Spacewalk login:         <login />\n  Your Spacewalk email address: <email-address />', 'email_footer': '--the Spacewalk Team', 'hostname': 'vmware145.englab.brq.redhat.com'}
	                 row = <type 'NoneType'> None

Frame __call__ in /usr/share/rhn/server/apacheServer.py at line 63
	                self = <type 'instance'> <server.apacheServer.HandlerWrap instance at 0xb7cc8e8c>
	                 req = <type 'mp_request'> <mp_request object at 0xb7e95d2c>
	                   f = <type 'instancemethod'> <bound method apacheHandler.handler of <server.apacheHandler.apacheHandler instance at 0xb7c1396c>>

Frame HandlerDispatch in /usr/lib/python2.4/site-packages/mod_python/apache.py at line 299
	                 req = <type 'mp_request'> <mp_request object at 0xb7e95d2c>
	              config = <type 'mp_table'> {'PythonInterpreter': 'rhn.server', 'PythonPath': 'sys.path+['/usr/share/rhn']'}
	                self = <type 'instance'> <mod_python.apache.CallBack instance at 0xb7ea32ac>
	              object = <type 'instance'> <server.apacheServer.HandlerWrap instance at 0xb7cc8e8c>
	                   l = <type 'list'> ['server.apacheServer', 'Handler']
	              module = <type 'module'> <module 'server.apacheServer' from '/usr/share/rhn/server/apacheServer.pyc'>
	               hlist = <type 'mp_hlist'> {'handler:'server.apacheServer::Handler','directory':'/XMLRPC/','silent':0}
	          object_str = <type 'str'> Handler
	               debug = <type 'int'> 0
	         module_name = <type 'str'> server.apacheServer
	          pathstring = <type 'str'> sys.path+['/usr/share/rhn']
	              result = <type 'int'> 500


Environment for PID=18373 on exception:
LANG = C
NLS_LANG = english.AL32UTF8
ORACLE_HOME = /opt/oracle
PATH = /sbin:/usr/sbin:/bin:/usr/bin
PERL_BADFREE = 0
PWD = /
SHLVL = 2
TERM = xterm
_ = /usr/sbin/httpd

Comment 4 Jan Pazdziora 2010-11-19 16:05:28 UTC
Mass-moving to space13.

Comment 5 Miroslav Suchý 2011-04-11 07:34:04 UTC
We did not have time for this one during Spacewalk 1.4 time frame. Mass moving to Spacewalk 1.5.

Comment 6 Miroslav Suchý 2011-04-11 07:37:25 UTC
We did not have time for this one during Spacewalk 1.4 time frame. Mass moving to Spacewalk 1.5.

Comment 7 Jan Pazdziora 2011-07-20 11:52:39 UTC
Aligning under space16.

Comment 8 Miroslav Suchý 2011-08-08 09:00:19 UTC
Created attachment 517140 [details]
Accept unicode characters

I spent some time on this. And I have patch which accept unicode passwords for rhnreg_ks. But the trouble is that it works only for non encrypted passwords.

In
code/src/com/redhat/rhn/domain/user/legacy/UserImpl.java
we encrypt it using MD5Crypt which convert the string to bytes and create hash.
On the other hand in backend we verify password using crypt.crypt(key, salt)
and this function does not produce the same output on unicode strings.

If somebody want to finish it, be my guest, but I would say it is not worth the time.


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