Mercurial > hg > nginx-mail
comparison src/mail/ngx_mail_proxy_module.c @ 484:c78a94ba4ae1
Merge with 0.7.34.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 11 Feb 2009 17:10:59 +0300 |
parents | 96428109ec3b 33394d1255b0 |
children | 9773720b845e |
comparison
equal
deleted
inserted
replaced
481:abbf48179d76 | 484:c78a94ba4ae1 |
---|---|
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: |
775 } | 803 } |
776 break; | 804 break; |
777 | 805 |
778 case ngx_smtp_xclient: | 806 case ngx_smtp_xclient: |
779 case ngx_smtp_xclient_from: | 807 case ngx_smtp_xclient_from: |
808 case ngx_smtp_xclient_helo: | |
780 if (p[0] == '2' && (p[1] == '2' || p[1] == '5') && p[2] == '0') { | 809 if (p[0] == '2' && (p[1] == '2' || p[1] == '5') && p[2] == '0') { |
781 return NGX_OK; | 810 return NGX_OK; |
782 } | 811 } |
783 break; | 812 break; |
784 | 813 |