Bug 7602 - User or group lookup in Web Admin fails on non-UTF-8 systems
Summary: User or group lookup in Web Admin fails on non-UTF-8 systems
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Web Administration (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.13.0
Assignee: Samuel Mannehed
URL:
Keywords: ossman_tester, prosaic
Depends on:
Blocks:
 
Reported: 2020-12-07 11:21 CET by Samuel Mannehed
Modified: 2020-12-09 12:59 CET (History)
0 users

See Also:
Acceptance Criteria:


Attachments

Description Samuel Mannehed cendio 2020-12-07 11:21:26 CET
Usernames or group-names containing non-UTF-8 characters will always report "Could not look up user/group" in Web Admin's user or group lookup.

 * If a user or group is created on a Latin-1 system, the name will include Latin-1 characters.
 * When attempting to use Web Admin's user or group lookup, the data provided in the web form will be encoded with UTF-8 and sent to the server.
 * Web Admin will then pass this UTF-8 data to Python 2's pwd.getpwnam() and grp.getgrnam() which, in turn, will attempt use the system's locale to interpret the characters. This of course fails.

Things to note:

 * The command "useradd" normally only accepts ASCII
 * If you connect using SSH, your locale will most of the time be brought along. That means if you SSH from a UTF-8 machine to a Latin-1 machine, you will get UTF-8.
 * GNOME terminal has a bug which causes it to always run in UTF-8.
Comment 1 Samuel Mannehed cendio 2020-12-07 11:29:53 CET
This is now fixed since Web Admin now runs in Python 3. This means that Web Admin automatically decodes the UTF-8 data from the browser to Unicode. Python 3's grp.getgrnam() and pwd.getpwnam() will then use these Unicode strings instead, which can without issue be encoded to whatever locale the system is using, if needed.

Tested using build 6679 on Ubuntu 20.04 with Latin-1 locale.
Comment 2 Pierre Ossman cendio 2020-12-09 12:59:55 CET
Works well. Could reproduce the issue on Ubuntu 18.04 with ISO 8859-15 and ThinLinc 4.12.0. After an upgrade to a nightly build it works fine. Also tested ASCII lookups, as well as failed lookups.

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