Skip to content

Commit

Permalink
Merge pull request #5073 from elliefm/v311/3826-error-message-0-fix
Browse files Browse the repository at this point in the history
lmtpengine: don't rely on error_message(0) for success string
  • Loading branch information
elliefm authored Oct 10, 2024
2 parents c0ebb2a + 081e815 commit 81e8708
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion imap/lmtpengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ static struct saslprops_t saslprops = SASLPROPS_INITIALIZER;

static void send_lmtp_error(struct protstream *pout, int r, strarray_t *resp)
{
const char *text = error_message(r);
int code;

if (resp) {
Expand All @@ -146,6 +147,8 @@ static void send_lmtp_error(struct protstream *pout, int r, strarray_t *resp)

switch (r) {
case 0:
/* n.b. can't rely on error_message(0) to produce a success string */
text = "Success";
code = LMTP_OK;
break;

Expand Down Expand Up @@ -224,7 +227,7 @@ static void send_lmtp_error(struct protstream *pout, int r, strarray_t *resp)
break;
}

prot_printf(pout, error_message(code), error_message(r), session_id());
prot_printf(pout, error_message(code), text, session_id());
prot_puts(pout, "\r\n");
}

Expand Down

0 comments on commit 81e8708

Please sign in to comment.