Ticket was cloned from Red Hat Bugzilla (product Fedora): Bug 1906495
Description of problem: Adding a new user, through the webUI, where the first or last name contains a non-english character fails with the error: "gecos: value #0 invalid per syntax: Invalid syntax." These should either be replaced by non-accented versions, or removed if no good replacement exist. Version-Release number of selected component (if applicable): Fedora 33, ipa-server 4.8.10 How reproducible: Steps to Reproduce: 1. Add a user where first or last name contains a non-english character Actual results: Receives error: "gecos: value #0 invalid per syntax: Invalid syntax." Expected results: The user to be successfully added. Additional info:
Metadata Update from @pcech: - Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=1906495
As a workaround, entering a proper ASCII GECOS in the WebUI, or through the command-line options, should work.
We can do a poor man's cleanup by de-normalizing the string to NFKD form and the filtering out non-ASCII chars:
>>> name = "François Cami" >>> ''.join(c for c in unicodedata.normalize("NFKD", name) if c.isascii()) 'Francois Cami'
The Python package https://pypi.org/project/Unidecode/ is a more elaborate solution that will also handle non-Western languages like Chinese and Japanese.
>>> from unidecode import unidecode >>> unidecode("北亰") 'Bei Jing '
Metadata Update from @fcami: - Issue assigned to fcami
There is no need. FreeIPA ships with a schema that defines GECOS syntax as 1.3.6.1.4.1.1466.115.121.1.26 which is IA5String (e.g. 7-bit ASCII of sorts). More recent RFC2307Bis schemas define GECOS syntax as 1.3.6.1.4.1.1466.115.121.1.15 e.g. UTF-8 which seems to imply anything using GECOS is supposed to handle UTF-8 strings gracefully.
Within FreeIPA, the GECOS is generated then base64-encoded:
gecos:: 5YyXIOS6sA==
I've tested using the WebUI (web browser == chromium on F32) and the ipa CLI, both work properly. Getent is able to work too:
[root@ipa0 ~]# getent passwd fcami fcami:*:1643400006:1643400006:北 亰:/home/fcami:/bin/sh
I am wondering what kind of browser the OP was using and which encoding it was set to. But this is clearly not a bug. Closing.
Metadata Update from @fcami: - Issue close_status updated to: worksforme - Issue status updated to: Closed (was: Open)
Login to comment on this ticket.