comparison src/mail/ngx_mail_proxy_module.c @ 444:33394d1255b0 NGINX_0_7_34

nginx 0.7.34 *) Feature: the "off" parameter of the "if_modified_since" directive. *) Feature: now nginx sends an HELO/EHLO command after a XCLIENT command. Thanks to Maxim Dounin. *) Feature: Microsoft specific "AUTH LOGIN with User Name" mode support in mail proxy server. Thanks to Maxim Dounin. *) Bugfix: in a redirect rewrite directive original arguments were concatenated with new arguments by an "?" rather than an "&"; the bug had appeared in 0.1.18. Thanks to Maxim Dounin. *) Bugfix: nginx could not be built on AIX.
author Igor Sysoev <http://sysoev.ru>
date Tue, 10 Feb 2009 00:00:00 +0300
parents ce4f9ff90bfa
children f39b9e29530d
comparison
equal deleted inserted replaced
443:28335b730750 444:33394d1255b0
537 ngx_log_debug0(NGX_LOG_DEBUG_MAIL, rev->log, 0, 537 ngx_log_debug0(NGX_LOG_DEBUG_MAIL, rev->log, 0,
538 "mail proxy send xclient"); 538 "mail proxy send xclient");
539 539
540 s->connection->log->action = "sending XCLIENT to upstream"; 540 s->connection->log->action = "sending XCLIENT to upstream";
541 541
542 line.len = sizeof("XCLIENT PROTO=SMTP HELO= ADDR= LOGIN= NAME=" 542 line.len = sizeof("XCLIENT ADDR= LOGIN= NAME="
543 CRLF) - 1 543 CRLF) - 1
544 + s->esmtp + s->smtp_helo.len
545 + s->connection->addr_text.len + s->login.len + s->host.len; 544 + s->connection->addr_text.len + s->login.len + s->host.len;
546 545
547 line.data = ngx_pnalloc(c->pool, line.len); 546 line.data = ngx_pnalloc(c->pool, line.len);
548 if (line.data == NULL) { 547 if (line.data == NULL) {
549 ngx_mail_proxy_internal_server_error(s); 548 ngx_mail_proxy_internal_server_error(s);
550 return; 549 return;
551 } 550 }
552 551
553 line.len = ngx_sprintf(line.data, 552 line.len = ngx_sprintf(line.data,
554 "XCLIENT PROTO=%sSMTP%s%V ADDR=%V%s%V NAME=%V" CRLF, 553 "XCLIENT ADDR=%V%s%V NAME=%V" CRLF,
555 (s->esmtp ? "E" : ""),
556 (s->smtp_helo.len ? " HELO=" : ""), &s->smtp_helo,
557 &s->connection->addr_text, 554 &s->connection->addr_text,
558 (s->login.len ? " LOGIN=" : ""), &s->login, &s->host) 555 (s->login.len ? " LOGIN=" : ""), &s->login, &s->host)
559 - line.data; 556 - line.data;
560 557
558 if (s->smtp_helo.len) {
559 s->mail_state = ngx_smtp_xclient_helo;
560
561 } else if (s->auth_method == NGX_MAIL_AUTH_NONE) {
562 s->mail_state = ngx_smtp_xclient_from;
563
564 } else {
565 s->mail_state = ngx_smtp_xclient;
566 }
567
568 break;
569
570 case ngx_smtp_xclient_helo:
571 ngx_log_debug0(NGX_LOG_DEBUG_MAIL, rev->log, 0,
572 "mail proxy send client ehlo");
573
574 s->connection->log->action = "sending client HELO/EHLO to upstream";
575
576 line.len = sizeof("HELO " CRLF) - 1 + s->smtp_helo.len;
577
578 line.data = ngx_pnalloc(c->pool, line.len);
579 if (line.data == NULL) {
580 ngx_mail_proxy_internal_server_error(s);
581 return;
582 }
583
584 line.len = ngx_sprintf(line.data,
585 ((s->esmtp) ? "EHLO %V" CRLF : "HELO %V" CRLF),
586 &s->smtp_helo)
587 - line.data;
588
561 s->mail_state = (s->auth_method == NGX_MAIL_AUTH_NONE) ? 589 s->mail_state = (s->auth_method == NGX_MAIL_AUTH_NONE) ?
562 ngx_smtp_xclient_from : ngx_smtp_xclient; 590 ngx_smtp_helo_from : ngx_smtp_helo;
563 591
564 break; 592 break;
565 593
566 case ngx_smtp_helo_from: 594 case ngx_smtp_helo_from:
567 case ngx_smtp_xclient_from: 595 case ngx_smtp_xclient_from:
770 } 798 }
771 break; 799 break;
772 800
773 case ngx_smtp_xclient: 801 case ngx_smtp_xclient:
774 case ngx_smtp_xclient_from: 802 case ngx_smtp_xclient_from:
803 case ngx_smtp_xclient_helo:
775 if (p[0] == '2' && (p[1] == '2' || p[1] == '5') && p[2] == '0') { 804 if (p[0] == '2' && (p[1] == '2' || p[1] == '5') && p[2] == '0') {
776 return NGX_OK; 805 return NGX_OK;
777 } 806 }
778 break; 807 break;
779 808