require usernames and passwords to be UTF-8 encoded

- Learn to support UTF-8 characters where it was not supported for usernames and
  passwords (but for netrc).
- Fix the types in the code for both py2 and py3: we now expect unicode for
  usernames and passwords.

Unicode (UTF-8) is required only for variables with non-ASCII characters.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht
2016-06-16 19:51:41 +02:00
parent 092264c8e7
commit 08e17de7e2
3 changed files with 40 additions and 22 deletions

View File

@ -590,9 +590,16 @@ type = IMAP
# "getcredentials" that parses a file "filename" and returns the account
# details for "hostname".
#
#
#remotehosteval = getcredentials("filename", "hostname", "hostname")
#
# The returned value must be int type.
#remoteporteval = getcredentials("filename", "hostname", "port")
#
# The returned value must be unicode type.
#remoteusereval = getcredentials("filename", "hostname", "user")
#
# The returned value must be unicode type.
#remotepasseval = getcredentials("filename", "hostname", "passwd")
@ -742,9 +749,9 @@ remotehost = examplehost
# This option stands in the [Repository RemoteExample] section.
#
# Specify the remote user name.
# Specify the remote user name. Must be unicode.
#
remoteuser = username
remoteuser = u"username"
# This option stands in the [Repository RemoteExample] section.
@ -760,7 +767,9 @@ remoteuser = username
# mechanism, so consider using auth_mechanisms to prioritize PLAIN
# or even make it the only mechanism to be tried.
#
#remote_identity = authzuser
# Must be unicode type.
#
#remote_identity = u"authzuser"
# This option stands in the [Repository RemoteExample] section.
@ -842,11 +851,11 @@ remoteuser = username
#
# 2. The remote password stored in this file with the remotepass
# option. Any '%' needs to be encoded as '%%'. Example:
# remotepass = mypassword
#remotepass = u"mypassword"
#
# 3. The remote password stored as a single line in an external
# file, which is referenced by the remotefile option. Example:
# remotepassfile = ~/Password.IMAP.Account1
#remotepassfile = ~/Password.IMAP.Account1
#
# 4. With a preauth tunnel. With this method, you invoke an external
# program that is guaranteed *NOT* to ask for a password, but rather
@ -855,7 +864,7 @@ remoteuser = username
# NOT specify a user or password (if you do, they'll be ignored.)
# Instead, you specify a preauthtunnel, as this example illustrates
# for Courier IMAP on Debian:
# preauthtunnel = ssh -q imaphost '/usr/bin/imapd ./Maildir'
#preauthtunnel = ssh -q imaphost '/usr/bin/imapd ./Maildir'
#
# 5. If you are using Kerberos and have the Python Kerberos package
# installed, you should not specify a remotepass. If the user has a
@ -865,9 +874,9 @@ remoteuser = username
# 6. Using arbitrary python code. With this method, you invoke a
# function from your pythonfile. To use this method assign the name
# of the function to the variable 'remotepasseval'. Example:
# remotepasseval = get_password("imap.example.net")
#remotepasseval = get_password("imap.example.net")
# You can also query for the username:
# remoteusereval = get_username("imap.example.net")
#remoteusereval = get_username("imap.example.net")
# This method can be used to design more elaborate setups, e.g. by
# querying the gnome-keyring via its python bindings.
@ -1186,7 +1195,9 @@ type = Gmail
#
# Specify the Gmail user name. This is the only mandatory parameter.
#
remoteuser = username@gmail.com
# Must be unicode type.
#
remoteuser = u"username@gmail.com"
# This option stands in the [Repository GmailExample] section.