Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

Added Imap Authenticate Command, more SMTP Auth Methods & Some Bugfixes #10

Merged
merged 4 commits into from
Apr 11, 2017

Conversation

DeeJayBro
Copy link
Contributor

@@ -20,7 +20,7 @@
ARGUMENT_ERROR(501, "Synatx error in parameters or arguments"),
COMMAND_NOT_IMPLEMENTED(502, "SmtpCommand not implemented"),
BAD_SEQUENCE(503, "Bad sequence of commands"),
ARGUMENT_NOT_IMPLEMENTED(504, "SmtpCommand parameter not implemented"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't change this response according to the RFC 5321

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Status Codes, 504 is for invalid command arguments, so i will change it to that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But these are the enhanced status codes, not the one that were originally defined in the SMTP protocol and the goal of the SMTP part of this project is to fully implement the SMTP protocol.

boolean breakCB = session.getCallback().callback(cache);
if (breakCB) session.setCallback(null);
cache = "";
continue;
} */
String[] split = cache.split(" ", 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to split the string only once, because we want to separate the tag from the string. And if the string was split once there are two different strings in this array, that's why it worked before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you set limit to 1, the split Function returns an ArrayList with 1 String (Split-Function). So my change is right to make it work

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry, you're right.

@@ -65,16 +65,16 @@ public void run() {
}
cache += (char) read;
if (!(cache.endsWith("\n\r") || cache.endsWith("\n"))) continue;
/* if (session.getCallback() != null) {
if (session.getCallback() != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we have to create a abstract class for both handlers, because this code is twice, but it isn't your problem. I will do this in the future. :)

} else {
authenticateUser(session, arguments[1]);
session.send(SmtpResponse.AUTH_NOT_IMPLEMENTED.create());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See SmtpResponse.java

@@ -14,7 +14,7 @@
}

public String create(String tag, String description) {
return tag + " " + text + " " + description;
return tag + " " + text + " " + description + "\r\n";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would override the send method of the Sessions within the ImapSession class, but you don't have to do this. Just update your fork and use the new method.

} else if (arguments[0].equalsIgnoreCase("LOGIN")) {
if (arguments.length == 1) {
//Username:
session.send("+ VXNlcm5hbWU6\r\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No line brakes needed. See ImapResponse.java

session.send("+ VXNlcm5hbWU6\r\n");
session.setCallback(username -> {
//Password:
session.send("+ UGFzc3dvcmQ6\r\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No line brakes needed. See ImapResponse.java


if (arguments[0].equalsIgnoreCase("PLAIN")) {
if (arguments.length == 1) {
session.send("+ \r\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No line brakes needed. See ImapResponse.java

Override the default send method of the Session to add line brakes
@lukbukkit
Copy link
Member

Thank you for your work and time! 👍

@lukbukkit lukbukkit merged commit 30af21c into LukWebsForge:master Apr 11, 2017
lukbukkit pushed a commit that referenced this pull request Apr 11, 2017
* Implemented the IMAP Authenticate Command
* Added more SMTP Authentication Methods
* Fixed Null Pointer Errors within the generation of the configuration file
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants