1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-14 11:42:23 -05:00

SMTP: allow lower case commands

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@797 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-10-28 15:16:57 +00:00
parent 73bc2636a9
commit af479f53c6

View File

@ -80,21 +80,21 @@ public class SmtpConnection extends AbstractConnection {
} else if ("QUIT".equalsIgnoreCase(command)) { } else if ("QUIT".equalsIgnoreCase(command)) {
sendClient("221 Closing connection"); sendClient("221 Closing connection");
break; break;
} else if ("EHLO".equals(command)) { } else if ("EHLO".equalsIgnoreCase(command)) {
sendClient("250-" + tokens.nextToken()); sendClient("250-" + tokens.nextToken());
// inform server that AUTH is supported // inform server that AUTH is supported
// actually it is mandatory (only way to get credentials) // actually it is mandatory (only way to get credentials)
sendClient("250-AUTH LOGIN PLAIN"); sendClient("250-AUTH LOGIN PLAIN");
sendClient("250 Hello"); sendClient("250 Hello");
} else if ("HELO".equals(command)) { } else if ("HELO".equalsIgnoreCase(command)) {
sendClient("250 Hello"); sendClient("250 Hello");
} else if ("AUTH".equals(command)) { } else if ("AUTH".equalsIgnoreCase(command)) {
if (tokens.hasMoreElements()) { if (tokens.hasMoreElements()) {
String authType = tokens.nextToken(); String authType = tokens.nextToken();
if ("PLAIN".equals(authType) && tokens.hasMoreElements()) { if ("PLAIN".equalsIgnoreCase(authType) && tokens.hasMoreElements()) {
decodeCredentials(tokens.nextToken()); decodeCredentials(tokens.nextToken());
authenticate(); authenticate();
} else if ("LOGIN".equals(authType)) { } else if ("LOGIN".equalsIgnoreCase(authType)) {
sendClient("334 " + base64Encode("Username:")); sendClient("334 " + base64Encode("Username:"));
state = State.LOGIN; state = State.LOGIN;
} else { } else {
@ -103,7 +103,7 @@ public class SmtpConnection extends AbstractConnection {
} else { } else {
sendClient("451 Error : authentication type not specified"); sendClient("451 Error : authentication type not specified");
} }
} else if ("MAIL".equals(command)) { } else if ("MAIL".equalsIgnoreCase(command)) {
if (state == State.AUTHENTICATED) { if (state == State.AUTHENTICATED) {
state = State.STARTMAIL; state = State.STARTMAIL;
recipients.clear(); recipients.clear();
@ -112,7 +112,7 @@ public class SmtpConnection extends AbstractConnection {
state = State.INITIAL; state = State.INITIAL;
sendClient("503 Bad sequence of commands"); sendClient("503 Bad sequence of commands");
} }
} else if ("RCPT".equals(command)) { } else if ("RCPT".equalsIgnoreCase(command)) {
if (state == State.STARTMAIL || state == State.RECIPIENT) { if (state == State.STARTMAIL || state == State.RECIPIENT) {
if (line.startsWith("RCPT TO:")) { if (line.startsWith("RCPT TO:")) {
state = State.RECIPIENT; state = State.RECIPIENT;
@ -131,7 +131,7 @@ public class SmtpConnection extends AbstractConnection {
state = State.AUTHENTICATED; state = State.AUTHENTICATED;
sendClient("503 Bad sequence of commands"); sendClient("503 Bad sequence of commands");
} }
} else if ("DATA".equals(command)) { } else if ("DATA".equalsIgnoreCase(command)) {
if (state == State.RECIPIENT) { if (state == State.RECIPIENT) {
state = State.MAILDATA; state = State.MAILDATA;
sendClient("354 Start mail input; end with <CRLF>.<CRLF>"); sendClient("354 Start mail input; end with <CRLF>.<CRLF>");