Mercurial > hg > nginx-mail
diff src/mail/ngx_mail_auth_http_module.c @ 467:d67e93e97b4a
Merge with nginx 0.7.30.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sun, 11 Jan 2009 17:17:57 +0300 |
parents | cd9cb7a3ff9e dac47e9ef0d5 |
children | 9773720b845e |
line wrap: on
line diff
--- a/src/mail/ngx_mail_auth_http_module.c +++ b/src/mail/ngx_mail_auth_http_module.c @@ -40,7 +40,6 @@ struct ngx_mail_auth_http_ctx_s { ngx_mail_auth_http_handler_pt handler; ngx_uint_t state; - ngx_uint_t hash; /* no needed ? */ u_char *header_name_start; u_char *header_name_end; @@ -269,7 +268,7 @@ ngx_mail_auth_http_write_handler(ngx_eve ngx_del_timer(wev); } - if (ngx_handle_write_event(wev, 0) == NGX_ERROR) { + if (ngx_handle_write_event(wev, 0) != NGX_OK) { ngx_close_connection(c); ngx_destroy_pool(ctx->pool); ngx_mail_session_internal_server_error(s); @@ -895,7 +894,7 @@ ngx_mail_auth_sleep_handler(ngx_event_t return; } - if (ngx_handle_read_event(rev, 0) == NGX_ERROR) { + if (ngx_handle_read_event(rev, 0) != NGX_OK) { ngx_mail_close_connection(c); } @@ -903,7 +902,7 @@ ngx_mail_auth_sleep_handler(ngx_event_t } if (rev->active) { - if (ngx_handle_read_event(rev, 0) == NGX_ERROR) { + if (ngx_handle_read_event(rev, 0) != NGX_OK) { ngx_mail_close_connection(c); } } @@ -915,7 +914,6 @@ ngx_mail_auth_http_parse_header_line(ngx ngx_mail_auth_http_ctx_t *ctx) { u_char c, ch, *p; - ngx_uint_t hash; enum { sw_start = 0, sw_name, @@ -927,7 +925,6 @@ ngx_mail_auth_http_parse_header_line(ngx } state; state = ctx->state; - hash = ctx->hash; for (p = ctx->response->pos; p < ctx->response->last; p++) { ch = *p; @@ -951,12 +948,10 @@ ngx_mail_auth_http_parse_header_line(ngx c = (u_char) (ch | 0x20); if (c >= 'a' && c <= 'z') { - hash = c; break; } if (ch >= '0' && ch <= '9') { - hash = ch; break; } @@ -968,7 +963,6 @@ ngx_mail_auth_http_parse_header_line(ngx case sw_name: c = (u_char) (ch | 0x20); if (c >= 'a' && c <= 'z') { - hash += c; break; } @@ -979,12 +973,10 @@ ngx_mail_auth_http_parse_header_line(ngx } if (ch == '-') { - hash += ch; break; } if (ch >= '0' && ch <= '9') { - hash += ch; break; } @@ -1081,7 +1073,6 @@ ngx_mail_auth_http_parse_header_line(ngx ctx->response->pos = p; ctx->state = state; - ctx->hash = hash; return NGX_AGAIN; @@ -1089,7 +1080,6 @@ done: ctx->response->pos = p + 1; ctx->state = sw_start; - ctx->hash = hash; return NGX_OK; @@ -1112,7 +1102,7 @@ ngx_mail_auth_http_block_read(ngx_event_ ngx_log_debug0(NGX_LOG_DEBUG_MAIL, rev->log, 0, "mail auth http block read"); - if (ngx_handle_read_event(rev, 0) == NGX_ERROR) { + if (ngx_handle_read_event(rev, 0) != NGX_OK) { c = rev->data; s = c->data; @@ -1166,6 +1156,7 @@ ngx_mail_auth_http_create_request(ngx_ma + sizeof(CRLF) - 1 + sizeof("Client-IP: ") - 1 + s->connection->addr_text.len + sizeof(CRLF) - 1 + + sizeof("Client-Host: ") - 1 + s->host.len + sizeof(CRLF) - 1 + sizeof("Auth-SMTP-Helo: ") - 1 + s->smtp_helo.len + sizeof("Auth-SMTP-From: ") - 1 + s->smtp_from.len + sizeof("Auth-SMTP-To: ") - 1 + s->smtp_to.len @@ -1220,12 +1211,19 @@ ngx_mail_auth_http_create_request(ngx_ma b->last = ngx_cpymem(b->last, "Client-IP: ", sizeof("Client-IP: ") - 1); b->last = ngx_copy(b->last, s->connection->addr_text.data, - s->connection->addr_text.len); + s->connection->addr_text.len); *b->last++ = CR; *b->last++ = LF; + if (s->host.len) { + b->last = ngx_cpymem(b->last, "Client-Host: ", + sizeof("Client-Host: ") - 1); + b->last = ngx_copy(b->last, s->host.data, s->host.len); + *b->last++ = CR; *b->last++ = LF; + } + if (s->auth_method == NGX_MAIL_AUTH_NONE) { - /* HELO / MAIL FROM / RCPT TO can't contain CRLF, no need to escape */ + /* HELO, MAIL FROM, and RCPT TO can't contain CRLF, no need to escape */ b->last = ngx_cpymem(b->last, "Auth-SMTP-Helo: ", sizeof("Auth-SMTP-Helo: ") - 1);