Skip to content

Commit

Permalink
Improved status checking in mail.c in accordance to RFC requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
wo-rasp committed Feb 10, 2017
1 parent 0db6200 commit 4d6ba26
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions libs/pilight/core/mail.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static void read_cb(uv_poll_t *req, ssize_t *nread, char *buf) {
}
}

if(val == 501 && ch == 32) {
if( (val >= 400 && val <= 599) && ch == 32) {
array_free(&array, n);
uv_custom_close(req);
uv_custom_write(req);
Expand Down Expand Up @@ -243,20 +243,14 @@ static void read_cb(uv_poll_t *req, ssize_t *nread, char *buf) {
if(strncmp(buf, "235", 3) == 0) {
request->step = SMTP_STEP_SEND_FROM;
}
if(strncmp(buf, "451", 3) == 0) {
logprintf(LOG_NOTICE, "SMTP: protocol violation while authenticating");
if(strncmp(buf, "400", 1) == 0) {
logprintf(LOG_NOTICE, "SMTP: protocol issues - abort");
uv_custom_close(req);
uv_custom_write(req);
return;
}
if(strncmp(buf, "501", 3) == 0) {
logprintf(LOG_NOTICE, "SMTP: improperly base64 encoded user/password");
uv_custom_close(req);
uv_custom_write(req);
return;
}
if(strncmp(buf, "535", 3) == 0) {
logprintf(LOG_NOTICE, "SMTP: authentication failed: wrong user/password");
if(strncmp(buf, "500", 1) == 0) {
logprintf(LOG_NOTICE, "SMTP: neg. response - abort");
uv_custom_close(req);
uv_custom_write(req);
return;
Expand Down

0 comments on commit 4d6ba26

Please sign in to comment.