# HG changeset patch # User Rob Mueller # Date 1715756760 -10800 # Node ID 46ecad404a296042c0088e699f275a92758e5ab9 # Parent c15c26c99727c60fbb4ba9cf4dcec1aa3e60cb5d Mail: reset imap tag to empty after authentication attempt. We need to reset the imap tag to empty after an authentication attempt completes, otherwise if the next line parsed is incomplete with no tag (e.g. empty line) then we use the "tag" from the previous buffer which is now definitely wrong and has been partially overwritten with the most recently read data (e.g. CRLF). An example before this patch: S: * OK IMAP4 ready C: foobar login a b S: foobar NO Incorrect username or password. C: S: S: obar BAD invalid command Then with this patch: S: * OK IMAP4 ready C: foobar login a b S: foobar NO Incorrect username or password. C: S: * BAD invalid command diff --git a/src/mail/ngx_mail_auth_http_module.c b/src/mail/ngx_mail_auth_http_module.c --- a/src/mail/ngx_mail_auth_http_module.c +++ b/src/mail/ngx_mail_auth_http_module.c @@ -883,6 +883,7 @@ ngx_mail_auth_sleep_handler(ngx_event_t s->mail_state = 0; s->auth_method = NGX_MAIL_AUTH_PLAIN; + s->tag.len = 0; c->log->action = "in auth state";