Mercurial > hg > nginx
diff src/mail/ngx_mail_smtp_handler.c @ 9235:d7fd0acdea64
Mail: handling of pipelined commands which cross buffer boundary.
Previously, pipelined commands which cross buffer boundary were rejected
as too long, even if the command itself was short enough to be handled
within the client buffer.
Fix is to move non-processed commands to the start of the buffer after
the previous command is fully processed.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sat, 30 Mar 2024 05:05:31 +0300 |
parents | c690a902bfec |
children |
line wrap: on
line diff
--- a/src/mail/ngx_mail_smtp_handler.c +++ b/src/mail/ngx_mail_smtp_handler.c @@ -430,6 +430,7 @@ ngx_mail_smtp_create_buffer(ngx_mail_ses void ngx_mail_smtp_auth_state(ngx_event_t *rev) { + size_t n; ngx_int_t rc; ngx_connection_t *c; ngx_mail_session_t *s; @@ -577,6 +578,12 @@ ngx_mail_smtp_auth_state(ngx_event_t *re if (s->buffer->pos == s->buffer->last) { s->buffer->pos = s->buffer->start; s->buffer->last = s->buffer->start; + + } else { + n = s->buffer->last - s->buffer->pos; + ngx_memmove(s->buffer->start, s->buffer->pos, n); + s->buffer->pos = s->buffer->start; + s->buffer->last = s->buffer->start + n; } if (s->state) {