IMAP: fix: backslash in password quoted string #378
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello Mickaël,
i recently noticed, that a backslash special character as part of my password was not accepted when accessing the exchange server through davmail's imap interface.
according to tshark, the password was transported from the imap client to davmail as a quoted string, approximately like so:
LOGIN "username" "foo\\bar"
.My reading of RFC3501 (IMAP version 4 rev 1) is, that after tokenizing and unquoting this would give a password value of
foo\bar
with a single backslash character (which is the correct password in this example). However, davmail did not correctly unquote the password string token and used thusfoo\\bar
(with two backslash characters) as password when communicating with the exchange server resulting in failed login.I used RFC3501 as reference (and not RFC 9051), because davmail announces
IMAP4REV1
(and not IMAP4rev2) in ImapConnection.java capability response code.My analysis of the davmail source code resulted in the following changes:
For a detailed description, see the commit message and code-comments.
Best regards,
Max