Bug 4316 - VSM should not crash if a username is seen which cannot be encoded in the current locale
Summary: VSM should not crash if a username is seen which cannot be encoded in the cur...
Status: NEW
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: VSM Server (show other bugs)
Version: 3.4.0
Hardware: PC Unknown
: P2 Normal
Target Milestone: LowPrio
Assignee: Bugzilla mail exporter
URL:
Keywords:
: 5926 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-05-30 10:49 CEST by Peter Åstrand
Modified: 2022-01-03 16:26 CET (History)
1 user (show)

See Also:
Acceptance Criteria:


Attachments

Description Peter Åstrand cendio 2012-05-30 10:49:32 CEST
From bug 4246, comment #12:

Also, non-ascii usernames does not work on RHEL6 now. Traceback from vsmserver:

2012-05-29 20:32:47 ERROR vsmserver: Unhandled XMLRPC exception: <type
'exceptions.UnicodeEncodeError'> 'ascii' codec can't encode character u'\xe5'
in position 0: ordinal not in range(128) Traceback (most recent call last):
  File "/opt/thinlinc/modules/thinlinc/vsm/async.py", line 112, in iii11
    obj . handle_read_event ( )
  File "/usr/lib64/python2.6/asyncore.py", line 428, in handle_read_event
    self.handle_read()
  File "/usr/lib64/python2.6/asynchat.py", line 140, in handle_read
    self.found_terminator()
  File "/opt/thinlinc/modules/thinlinc/vsm/xmlrpc.py", line 526, in
found_terminator
    self . handle_request ( )
  File "/opt/thinlinc/modules/thinlinc/vsm/xmlrpc.py", line 540, in
handle_request
    self . handle_method ( )
  File "/opt/thinlinc/modules/thinlinc/vsm/vsmserverchannel.py", line 109, in
handle_method
    self . params )
  File "/opt/thinlinc/modules/thinlinc/vsm/handler_getpublicsessioninfo.py",
line 16, in handle
    IiII1IiiIiI1 = pwd . getpwnam ( IiII1IiiIiI1 ) . pw_name
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe5' in position 0:
ordinal not in range(128)

If I fix this, I get the same in vsmagent:

2012-05-29 20:01:57 INFO vsmagent: VSM Agent version 3.4.0 build 3508 started
2012-05-29 20:01:57 INFO vsmagent: My public hostname is 10.47.252.218
2012-05-29 20:01:57 WARNING vsmagent: Couldn't lookup host rhel6base
2012-05-29 20:32:04 ERROR vsmagent: Unhandled XMLRPC exception: <type
'exceptions.UnicodeEncodeError'> 'ascii' codec can't encode character u'\xe5'
in position 0: ordinal not in range(128) Traceback (most recent call last):
  File "/opt/thinlinc/modules/thinlinc/vsm/async.py", line 112, in iii11
    obj . handle_read_event ( )
  File "/usr/lib64/python2.6/asyncore.py", line 428, in handle_read_event
    self.handle_read()
  File "/usr/lib64/python2.6/asynchat.py", line 140, in handle_read
    self.found_terminator()
  File "/opt/thinlinc/modules/thinlinc/vsm/xmlrpc.py", line 526, in
found_terminator
    self . handle_request ( )
  File "/opt/thinlinc/modules/thinlinc/vsm/xmlrpc.py", line 540, in
handle_request
    self . handle_method ( )
  File "/opt/thinlinc/modules/thinlinc/vsm/vsmagentchannel.py", line 103, in
handle_method
    self . params )
  File "/opt/thinlinc/modules/thinlinc/vsm/handler_reqsession.py", line 52, in
handle
    self . check_old_client ( )
  File "/opt/thinlinc/modules/thinlinc/vsm/handler_reqsession.py", line 64, in
check_old_client
    self . check_valid_user ( )
  File "/opt/thinlinc/modules/thinlinc/vsm/handler_reqsession.py", line 69, in
check_valid_user
    self . pwent = pwd . getpwnam ( locale_encode ( self . username ) )
  File "/opt/thinlinc/modules/thinlinc/ctccommon.py", line 345, in
locale_encode
    return s . encode ( O00O0oOO00O00 )
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe5' in position 0:
ordinal not in range(128)

Although the problem here was that VSM was started with the wrong locale, it shouldn't crash anyway, but instead give a sane error message.
Comment 1 Pierre Ossman cendio 2022-01-03 16:17:07 CET
Unsure if this is relevant anymore. With the switch to Python 3 the decoding is done by the system library, not us. Will have to test exactly what it does for this scenario though.
Comment 2 Pierre Ossman cendio 2022-01-03 16:26:01 CET
*** Bug 5926 has been marked as a duplicate of this bug. ***

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