OfflineIMAP / offlineimap

Read/sync your IMAP mailboxes (python2) [LEGACY: move to offlineimap3]
http://www.offlineimap.org
Other
1.78k stars 360 forks source link

Login with IMAP-Password with special chars impossible #650

Open sholl opened 4 years ago

sholl commented 4 years ago

General informations

Configuration file offlineimaprc

[general]
accounts = foo

[Account foo]
localrepository = Local
remoterepository = Remote

[Repository Local]
type = Maildir
localfolders = /backups/foo/Mailbox_backup_foo

[Repository Remote]
type = IMAP
remotehost = mail.foo.com
remoteuser = foo@foo.com
# Whether or not to use SSL.
#
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remoteport = 993

# requires this file chmoded to 600
remotepass = "7635gdhzwDswcC4&?%a$;K^z|=h"

The above password is not real, but you can reproduce this issue with that one.

Logs

imaplib2 v2.101 (bundled), Python v2.7.16, OpenSSL 1.1.1d  10 Sep 2019                                                                
Account sync stephan:
 *** Processing account foo                                                                                                       
 Establishing connection to mail.foo.com:993 (Remote)
 ERROR: While attempting to sync account 'foo'                                                                                    
  '%' must be followed by '%' or '(', found: '%a$;K^z|=h"'
 *** Finished account 'foo' in 0:00                                                                                               
ERROR: Exceptions occurred during the run!
ERROR: While attempting to sync account 'foo'                                                                                     
  '%' must be followed by '%' or '(', found: '%a$;K^z|=h"

Steps to reproduce the error

nicolas33 commented 4 years ago

That's what is said in the error message. The '%' character must be preceded by another '%':

remotepass = "7635gdhzwDswcC4&?%%a$;K^z|=h"

chris001 commented 4 years ago

We should use the raw value of remotepass by doing this:

 ConfigParser.get(section, option[, raw[, vars]])
Get an option value for the named section. ........

All the '%' interpolations are expanded in the return values, unless the raw argument is true

nicolas33 commented 4 years ago

We should use the raw value of remotepass by doing this:

I agree but this is the legacy way of working. I disagree to change this behaviour in order to not hurt the current users.

chris001 commented 4 years ago

We should use the raw value of remotepass by doing this:

I agree but this is the legacy way of working. I disagree to change this behaviour in order to not hurt the current users.

OK, we could add the breaking change for plaintext passwords (no longer requiring double % characters to represent one % character, by using raw value of remotepass), could be held off until the next major version number, ie 8.0.0, in line with "SemVer" (semantic versioning), which allows breaking changes when the major version number increments.

nicolas33 commented 4 years ago

Sure. We are far from a v8.0.0, though.