comparison src/mail/ngx_mail_auth_http_module.c @ 9274:46ecad404a29

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
author Rob Mueller <robm@fastmailteam.com>
date Wed, 15 May 2024 10:06:00 +0300
parents 13d0c1d26d47
children 4538c1ffb0f8
comparison
equal deleted inserted replaced
9273:c15c26c99727 9274:46ecad404a29
881 881
882 rev->handler = cscf->protocol->auth_state; 882 rev->handler = cscf->protocol->auth_state;
883 883
884 s->mail_state = 0; 884 s->mail_state = 0;
885 s->auth_method = NGX_MAIL_AUTH_PLAIN; 885 s->auth_method = NGX_MAIL_AUTH_PLAIN;
886 s->tag.len = 0;
886 887
887 c->log->action = "in auth state"; 888 c->log->action = "in auth state";
888 889
889 ngx_mail_send(c->write); 890 ngx_mail_send(c->write);
890 891