Mercurial > hg > nginx-mail
diff src/mail/ngx_mail_proxy_module.c @ 410:cd9cb7a3ff9e
Merge with nginx 0.7.8.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 11 Aug 2008 22:07:06 +0400 |
parents | 52b28d322d76 984bb0b1399b |
children | 375518f786db |
line wrap: on
line diff
--- a/src/mail/ngx_mail_proxy_module.c +++ b/src/mail/ngx_mail_proxy_module.c @@ -172,6 +172,8 @@ ngx_mail_proxy_init(ngx_mail_session_t * return; } + s->out.len = 0; + switch (s->protocol) { case NGX_MAIL_POP3_PROTOCOL: @@ -252,7 +254,7 @@ ngx_mail_proxy_pop3_handler(ngx_event_t s->connection->log->action = "sending user name to upstream"; line.len = sizeof("USER ") - 1 + s->login.len + 2; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return; @@ -271,7 +273,7 @@ ngx_mail_proxy_pop3_handler(ngx_event_t s->connection->log->action = "sending password to upstream"; line.len = sizeof("PASS ") - 1 + s->passwd.len + 2; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return; @@ -368,7 +370,7 @@ ngx_mail_proxy_imap_handler(ngx_event_t line.len = s->tag.len + sizeof("LOGIN ") - 1 + 1 + NGX_SIZE_T_LEN + 1 + 2; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return; @@ -387,7 +389,7 @@ ngx_mail_proxy_imap_handler(ngx_event_t s->connection->log->action = "sending user name to upstream"; line.len = s->login.len + 1 + 1 + NGX_SIZE_T_LEN + 1 + 2; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return; @@ -407,7 +409,7 @@ ngx_mail_proxy_imap_handler(ngx_event_t s->connection->log->action = "sending password to upstream"; line.len = s->passwd.len + 2; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return; @@ -504,7 +506,7 @@ ngx_mail_proxy_smtp_handler(ngx_event_t cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module); line.len = sizeof("HELO ") - 1 + cscf->server_name.len + 2; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return; @@ -531,12 +533,12 @@ ngx_mail_proxy_smtp_handler(ngx_event_t s->connection->log->action = "sending XCLIENT to upstream"; - line.len = sizeof("XCLIENT PROTO=SMTP HELO= ADDR= LOGIN= " - "NAME=[UNAVAILABLE]" CRLF) - 1 + line.len = sizeof("XCLIENT PROTO=SMTP HELO= ADDR= LOGIN= NAME=" + CRLF) - 1 + s->esmtp + s->smtp_helo.len - + s->connection->addr_text.len + s->login.len; + + s->connection->addr_text.len + s->login.len + s->host.len; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return; @@ -544,11 +546,11 @@ ngx_mail_proxy_smtp_handler(ngx_event_t line.len = ngx_sprintf(line.data, "XCLIENT PROTO=%sSMTP%s%V ADDR=%V%s%V " - "NAME=[UNAVAILABLE]" CRLF, + "NAME=%V" CRLF, (s->esmtp ? "E" : ""), (s->smtp_helo.len ? " HELO=" : ""), &s->smtp_helo, &s->connection->addr_text, - (s->login.len ? " LOGIN=" : ""), &s->login) + (s->login.len ? " LOGIN=" : ""), &s->login, &s->host) - line.data; s->mail_state = s->auth_method == NGX_MAIL_AUTH_NONE ? @@ -564,7 +566,7 @@ ngx_mail_proxy_smtp_handler(ngx_event_t s->connection->log->action = "sending MAIL FROM to upstream"; line.len = s->smtp_from.len + sizeof(CRLF) - 1; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return; @@ -584,7 +586,7 @@ ngx_mail_proxy_smtp_handler(ngx_event_t s->connection->log->action = "sending RCPT TO to upstream"; line.len = s->smtp_to.len + sizeof(CRLF) - 1; - line.data = ngx_palloc(c->pool, line.len); + line.data = ngx_pnalloc(c->pool, line.len); if (line.data == NULL) { ngx_mail_proxy_internal_server_error(s); return;