1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-12 12:35:04 -05:00

Application of patch submitted by cnehren for Issue 356, with

generalization.
This commit is contained in:
Daniel Applebaum 2009-04-11 15:24:22 +00:00
parent 932adf5ed2
commit aa4a92a541

View File

@ -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);
@ -1381,6 +1381,17 @@ public class ImapStore extends Store {
}
}
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 {
try {