#6762 ipa vault-add throws UnicodeDecodeError
Closed: worksforme Opened by akasurde.

[root@bender ipa-replica-promotion]# ipa vault-add
Vault name: 日本刀
ipa: ERROR: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ipalib/cli.py", line 1351, in run
    sys.exit(api.Backend.cli.run(argv))
  File "/usr/lib/python2.7/site-packages/ipalib/cli.py", line 1109, in run
    kw = self.process_keyword_arguments(cmd, kw)
  File "/usr/lib/python2.7/site-packages/ipalib/cli.py", line 1089, in process_keyword_arguments
    self.prompt_interactively(cmd, kw)
  File "/usr/lib/python2.7/site-packages/ipalib/cli.py", line 1263, in prompt_interactively
    kw=kw)
  File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 617, in prompt_param
    raw = self.Backend.textui.prompt(label, default, optional=optional)
  File "/usr/lib/python2.7/site-packages/ipalib/cli.py", line 564, in prompt
    return self.prompt_helper(prompt, label)
  File "/usr/lib/python2.7/site-packages/ipalib/cli.py", line 543, in prompt_helper
    return self.decode(prompt_func(self.encode(prompt)))
  File "/usr/lib/python2.7/site-packages/ipalib/cli.py", line 141, in decode
    return value.decode(encoding)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)
ipa: ERROR: an internal error has occurred

What is output of locale?

non-ascii vault names should be rejected (freeipa-server-4.4.3-1.fc25.x86_64 with en utf-8 locale)

ipa vault-add
Vault name: 日本刀
New password: 
Verify password: 
ipa: ERROR: invalid 'name': may only include letters, numbers, _, ., and -
$ ipa vault-add 日本刀
New password: 
Verify password: 
ipa: ERROR: invalid 'name': may only include letters, numbers, _, ., and -

Output of locale

LANG=en_US.UTF-8
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

IPA server version

# rpm -qa ipa-server
ipa-server-4.4.90-201703122305.el7.x86_64

I cannot reproduce the issue with 4.5.0:

$ rpm -qa freeipa-server
freeipa-server-4.5.0-0.fc25.x86_64
$ ipa vault-add
Vault name: 日本刀
New password: 
Verify password: 
ipa: ERROR: invalid 'name': may only include letters, numbers, _, ., and -

Closing, cannot be reproduced.

Metadata Update from @pvoborni:
- Issue close_status updated to: worksforme
- Issue status updated to: Closed (was: Open)

Metadata