Application of patch submitted by cnehren for Issue 356, with
generalization.
This commit is contained in:
parent
932adf5ed2
commit
aa4a92a541
1 changed files with 12 additions and 1 deletions
|
@ -1299,7 +1299,7 @@ public class ImapStore extends Store {
|
|||
try {
|
||||
// TODO eventually we need to add additional authentication
|
||||
// options such as SASL
|
||||
executeSimpleCommand("LOGIN \"" + mUsername + "\" \"" + mPassword + "\"", true);
|
||||
executeSimpleCommand("LOGIN \"" + escapeString(mUsername) + "\" \"" + escapeString(mPassword) + "\"", true);
|
||||
authSuccess = true;
|
||||
} catch (ImapException ie) {
|
||||
throw new AuthenticationFailedException(ie.getAlertText(), ie);
|
||||
|
@ -1380,6 +1380,17 @@ public class ImapStore extends Store {
|
|||
throw ioe;
|
||||
}
|
||||
}
|
||||
|
||||
private String escapeString(String in)
|
||||
{
|
||||
if (in == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String out = in.replaceAll("\\\\", "\\\\\\\\");
|
||||
out = out.replaceAll("\"", "\\\\\"");
|
||||
return out;
|
||||
}
|
||||
|
||||
public String sendCommand(String command, boolean sensitive)
|
||||
throws MessagingException, IOException {
|
||||
|
|
Loading…
Reference in a new issue