nginxtra 1.4.7.9 → 1.6.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/nginxtra +1 -1
- data/bin/nginxtra_rails +1 -1
- data/lib/nginxtra/version.rb +1 -1
- data/vendor/nginx/CHANGES +286 -19
- data/vendor/nginx/CHANGES.ru +296 -22
- data/vendor/nginx/auto/cc/clang +4 -3
- data/vendor/nginx/auto/cc/conf +23 -0
- data/vendor/nginx/auto/cc/msvc +1 -0
- data/vendor/nginx/auto/cc/name +1 -1
- data/vendor/nginx/auto/cc/owc +4 -4
- data/vendor/nginx/auto/cc/sunc +1 -1
- data/vendor/nginx/auto/endianness +2 -2
- data/vendor/nginx/auto/feature +1 -1
- data/vendor/nginx/auto/include +1 -1
- data/vendor/nginx/auto/lib/libatomic/make +3 -1
- data/vendor/nginx/auto/lib/openssl/conf +4 -0
- data/vendor/nginx/auto/lib/openssl/make +1 -1
- data/vendor/nginx/auto/lib/pcre/conf +5 -0
- data/vendor/nginx/auto/lib/pcre/make +11 -11
- data/vendor/nginx/auto/lib/pcre/makefile.bcc +4 -3
- data/vendor/nginx/auto/lib/pcre/makefile.msvc +2 -1
- data/vendor/nginx/auto/lib/pcre/makefile.owc +2 -1
- data/vendor/nginx/auto/lib/perl/make +1 -0
- data/vendor/nginx/auto/lib/test +1 -1
- data/vendor/nginx/auto/lib/zlib/make +22 -1
- data/vendor/nginx/auto/modules +8 -0
- data/vendor/nginx/auto/options +3 -0
- data/vendor/nginx/auto/os/darwin +1 -1
- data/vendor/nginx/auto/os/linux +32 -0
- data/vendor/nginx/auto/os/win32 +12 -1
- data/vendor/nginx/auto/sources +8 -2
- data/vendor/nginx/auto/types/sizeof +1 -1
- data/vendor/nginx/auto/types/typedef +1 -1
- data/vendor/nginx/auto/types/uintptr_t +1 -1
- data/vendor/nginx/auto/unix +13 -1
- data/vendor/nginx/conf/mime.types +11 -2
- data/vendor/nginx/conf/nginx.conf +3 -4
- data/vendor/nginx/contrib/README +6 -0
- data/vendor/nginx/contrib/vim/ftdetect/nginx.vim +4 -0
- data/vendor/nginx/contrib/vim/indent/nginx.vim +11 -0
- data/vendor/nginx/contrib/vim/syntax/nginx.vim +703 -0
- data/vendor/nginx/src/core/nginx.c +2 -7
- data/vendor/nginx/src/core/nginx.h +2 -2
- data/vendor/nginx/src/core/ngx_conf_file.c +8 -88
- data/vendor/nginx/src/core/ngx_conf_file.h +3 -3
- data/vendor/nginx/src/core/ngx_config.h +2 -2
- data/vendor/nginx/src/core/ngx_connection.c +100 -29
- data/vendor/nginx/src/core/ngx_connection.h +11 -0
- data/vendor/nginx/src/core/ngx_core.h +1 -0
- data/vendor/nginx/src/core/ngx_cycle.c +23 -99
- data/vendor/nginx/src/core/ngx_cycle.h +2 -0
- data/vendor/nginx/src/core/ngx_file.c +100 -8
- data/vendor/nginx/src/core/ngx_file.h +3 -0
- data/vendor/nginx/src/core/ngx_hash.c +6 -9
- data/vendor/nginx/src/core/ngx_inet.c +93 -5
- data/vendor/nginx/src/core/ngx_inet.h +4 -2
- data/vendor/nginx/src/core/ngx_list.c +1 -9
- data/vendor/nginx/src/core/ngx_log.c +132 -30
- data/vendor/nginx/src/core/ngx_log.h +5 -2
- data/vendor/nginx/src/core/ngx_open_file_cache.c +67 -1
- data/vendor/nginx/src/core/ngx_palloc.c +5 -2
- data/vendor/nginx/src/core/ngx_proxy_protocol.c +91 -0
- data/vendor/nginx/src/core/ngx_proxy_protocol.h +23 -0
- data/vendor/nginx/src/core/ngx_resolver.c +1080 -285
- data/vendor/nginx/src/core/ngx_resolver.h +33 -3
- data/vendor/nginx/src/core/ngx_slab.c +7 -2
- data/vendor/nginx/src/core/ngx_slab.h +2 -0
- data/vendor/nginx/src/core/ngx_string.c +78 -13
- data/vendor/nginx/src/core/ngx_string.h +2 -0
- data/vendor/nginx/src/event/modules/ngx_devpoll_module.c +2 -2
- data/vendor/nginx/src/event/modules/ngx_epoll_module.c +13 -5
- data/vendor/nginx/src/event/modules/ngx_select_module.c +1 -1
- data/vendor/nginx/src/event/modules/ngx_win32_select_module.c +2 -2
- data/vendor/nginx/src/event/ngx_event.c +0 -1
- data/vendor/nginx/src/event/ngx_event.h +7 -6
- data/vendor/nginx/src/event/ngx_event_accept.c +6 -4
- data/vendor/nginx/src/event/ngx_event_connect.c +2 -2
- data/vendor/nginx/src/event/ngx_event_openssl.c +304 -13
- data/vendor/nginx/src/event/ngx_event_openssl.h +20 -1
- data/vendor/nginx/src/event/ngx_event_openssl_stapling.c +35 -23
- data/vendor/nginx/src/event/ngx_event_pipe.c +15 -30
- data/vendor/nginx/src/http/modules/ngx_http_access_module.c +115 -35
- data/vendor/nginx/src/http/modules/ngx_http_auth_basic_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_auth_request_module.c +444 -0
- data/vendor/nginx/src/http/modules/ngx_http_autoindex_module.c +2 -1
- data/vendor/nginx/src/http/modules/ngx_http_charset_filter_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_dav_module.c +1 -3
- data/vendor/nginx/src/http/modules/ngx_http_fastcgi_module.c +251 -36
- data/vendor/nginx/src/http/modules/ngx_http_gunzip_filter_module.c +9 -5
- data/vendor/nginx/src/http/modules/ngx_http_gzip_filter_module.c +5 -3
- data/vendor/nginx/src/http/modules/ngx_http_gzip_static_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_headers_filter_module.c +4 -0
- data/vendor/nginx/src/http/modules/ngx_http_image_filter_module.c +8 -2
- data/vendor/nginx/src/http/modules/ngx_http_limit_req_module.c +5 -1
- data/vendor/nginx/src/http/modules/ngx_http_map_module.c +3 -3
- data/vendor/nginx/src/http/modules/ngx_http_memcached_module.c +21 -10
- data/vendor/nginx/src/http/modules/ngx_http_mp4_module.c +669 -197
- data/vendor/nginx/src/http/modules/ngx_http_proxy_module.c +93 -60
- data/vendor/nginx/src/http/modules/ngx_http_range_filter_module.c +13 -6
- data/vendor/nginx/src/http/modules/ngx_http_realip_module.c +20 -1
- data/vendor/nginx/src/http/modules/ngx_http_referer_module.c +132 -74
- data/vendor/nginx/src/http/modules/ngx_http_scgi_module.c +18 -12
- data/vendor/nginx/src/http/modules/ngx_http_ssi_filter_module.c +22 -20
- data/vendor/nginx/src/http/modules/ngx_http_ssl_module.c +121 -3
- data/vendor/nginx/src/http/modules/ngx_http_ssl_module.h +5 -0
- data/vendor/nginx/src/http/modules/ngx_http_stub_status_module.c +3 -0
- data/vendor/nginx/src/http/modules/ngx_http_sub_filter_module.c +123 -91
- data/vendor/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +29 -19
- data/vendor/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +2 -5
- data/vendor/nginx/src/http/modules/ngx_http_uwsgi_module.c +215 -19
- data/vendor/nginx/src/http/modules/ngx_http_xslt_filter_module.c +32 -6
- data/vendor/nginx/src/http/modules/perl/nginx.xs +4 -7
- data/vendor/nginx/src/http/modules/perl/ngx_http_perl_module.c +2 -2
- data/vendor/nginx/src/http/ngx_http.c +17 -7
- data/vendor/nginx/src/http/ngx_http_cache.h +4 -2
- data/vendor/nginx/src/http/ngx_http_copy_filter_module.c +4 -2
- data/vendor/nginx/src/http/ngx_http_core_module.c +63 -50
- data/vendor/nginx/src/http/ngx_http_core_module.h +5 -0
- data/vendor/nginx/src/http/ngx_http_file_cache.c +115 -3
- data/vendor/nginx/src/http/ngx_http_header_filter_module.c +9 -6
- data/vendor/nginx/src/http/ngx_http_parse.c +88 -10
- data/vendor/nginx/src/http/ngx_http_postpone_filter_module.c +2 -4
- data/vendor/nginx/src/http/ngx_http_request.c +116 -8
- data/vendor/nginx/src/http/ngx_http_request.h +5 -1
- data/vendor/nginx/src/http/ngx_http_request_body.c +7 -7
- data/vendor/nginx/src/http/ngx_http_script.c +6 -5
- data/vendor/nginx/src/http/ngx_http_spdy.c +889 -271
- data/vendor/nginx/src/http/ngx_http_spdy.h +51 -28
- data/vendor/nginx/src/http/ngx_http_spdy_filter_module.c +382 -167
- data/vendor/nginx/src/http/ngx_http_spdy_module.c +65 -8
- data/vendor/nginx/src/http/ngx_http_spdy_module.h +5 -0
- data/vendor/nginx/src/http/ngx_http_special_response.c +1 -1
- data/vendor/nginx/src/http/ngx_http_upstream.c +290 -114
- data/vendor/nginx/src/http/ngx_http_upstream.h +9 -5
- data/vendor/nginx/src/http/ngx_http_upstream_round_robin.c +32 -24
- data/vendor/nginx/src/http/ngx_http_variables.c +40 -6
- data/vendor/nginx/src/http/ngx_http_write_filter_module.c +12 -5
- data/vendor/nginx/src/mail/ngx_mail.c +4 -2
- data/vendor/nginx/src/mail/ngx_mail.h +2 -0
- data/vendor/nginx/src/mail/ngx_mail_auth_http_module.c +0 -1
- data/vendor/nginx/src/mail/ngx_mail_core_module.c +2 -1
- data/vendor/nginx/src/mail/ngx_mail_handler.c +17 -4
- data/vendor/nginx/src/mail/ngx_mail_parse.c +32 -2
- data/vendor/nginx/src/mail/ngx_mail_proxy_module.c +54 -7
- data/vendor/nginx/src/mail/ngx_mail_smtp_handler.c +50 -78
- data/vendor/nginx/src/mail/ngx_mail_ssl_module.c +48 -11
- data/vendor/nginx/src/mail/ngx_mail_ssl_module.h +3 -0
- data/vendor/nginx/src/os/unix/ngx_channel.c +3 -1
- data/vendor/nginx/src/os/unix/ngx_darwin_config.h +1 -0
- data/vendor/nginx/src/os/unix/ngx_darwin_init.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_darwin_sendfile_chain.c +14 -16
- data/vendor/nginx/src/os/unix/ngx_errno.h +3 -0
- data/vendor/nginx/src/os/unix/ngx_files.h +10 -16
- data/vendor/nginx/src/os/unix/ngx_freebsd_config.h +6 -0
- data/vendor/nginx/src/os/unix/ngx_freebsd_init.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.h +2 -2
- data/vendor/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +17 -19
- data/vendor/nginx/src/os/unix/ngx_linux_config.h +8 -2
- data/vendor/nginx/src/os/unix/ngx_linux_sendfile_chain.c +20 -22
- data/vendor/nginx/src/os/unix/ngx_posix_config.h +1 -0
- data/vendor/nginx/src/os/unix/ngx_process.c +5 -0
- data/vendor/nginx/src/os/unix/ngx_process_cycle.c +15 -3
- data/vendor/nginx/src/os/unix/ngx_readv_chain.c +2 -1
- data/vendor/nginx/src/os/unix/ngx_recv.c +4 -1
- data/vendor/nginx/src/os/unix/ngx_solaris_config.h +1 -0
- data/vendor/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +14 -16
- metadata +8 -2
@@ -542,17 +542,40 @@ ngx_mail_proxy_smtp_handler(ngx_event_t *rev)
|
|
542
542
|
CRLF) - 1
|
543
543
|
+ s->connection->addr_text.len + s->login.len + s->host.len;
|
544
544
|
|
545
|
+
#if (NGX_HAVE_INET6)
|
546
|
+
if (s->connection->sockaddr->sa_family == AF_INET6) {
|
547
|
+
line.len += sizeof("IPV6:") - 1;
|
548
|
+
}
|
549
|
+
#endif
|
550
|
+
|
545
551
|
line.data = ngx_pnalloc(c->pool, line.len);
|
546
552
|
if (line.data == NULL) {
|
547
553
|
ngx_mail_proxy_internal_server_error(s);
|
548
554
|
return;
|
549
555
|
}
|
550
556
|
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
557
|
+
p = ngx_cpymem(line.data, "XCLIENT ADDR=", sizeof("XCLIENT ADDR=") - 1);
|
558
|
+
|
559
|
+
#if (NGX_HAVE_INET6)
|
560
|
+
if (s->connection->sockaddr->sa_family == AF_INET6) {
|
561
|
+
p = ngx_cpymem(p, "IPV6:", sizeof("IPV6:") - 1);
|
562
|
+
}
|
563
|
+
#endif
|
564
|
+
|
565
|
+
p = ngx_copy(p, s->connection->addr_text.data,
|
566
|
+
s->connection->addr_text.len);
|
567
|
+
|
568
|
+
if (s->login.len) {
|
569
|
+
p = ngx_cpymem(p, " LOGIN=", sizeof(" LOGIN=") - 1);
|
570
|
+
p = ngx_copy(p, s->login.data, s->login.len);
|
571
|
+
}
|
572
|
+
|
573
|
+
p = ngx_cpymem(p, " NAME=", sizeof(" NAME=") - 1);
|
574
|
+
p = ngx_copy(p, s->host.data, s->host.len);
|
575
|
+
|
576
|
+
*p++ = CR; *p++ = LF;
|
577
|
+
|
578
|
+
line.len = p - line.data;
|
556
579
|
|
557
580
|
if (s->smtp_helo.len) {
|
558
581
|
s->mail_state = ngx_smtp_xclient_helo;
|
@@ -657,7 +680,12 @@ ngx_mail_proxy_smtp_handler(ngx_event_t *rev)
|
|
657
680
|
c->log->action = NULL;
|
658
681
|
ngx_log_error(NGX_LOG_INFO, c->log, 0, "client logged in");
|
659
682
|
|
660
|
-
|
683
|
+
if (s->buffer->pos == s->buffer->last) {
|
684
|
+
ngx_mail_proxy_handler(s->connection->write);
|
685
|
+
|
686
|
+
} else {
|
687
|
+
ngx_mail_proxy_handler(c->write);
|
688
|
+
}
|
661
689
|
|
662
690
|
return;
|
663
691
|
|
@@ -702,7 +730,7 @@ ngx_mail_proxy_dummy_handler(ngx_event_t *wev)
|
|
702
730
|
static ngx_int_t
|
703
731
|
ngx_mail_proxy_read_response(ngx_mail_session_t *s, ngx_uint_t state)
|
704
732
|
{
|
705
|
-
u_char *p;
|
733
|
+
u_char *p, *m;
|
706
734
|
ssize_t n;
|
707
735
|
ngx_buf_t *b;
|
708
736
|
ngx_mail_proxy_conf_t *pcf;
|
@@ -779,6 +807,25 @@ ngx_mail_proxy_read_response(ngx_mail_session_t *s, ngx_uint_t state)
|
|
779
807
|
break;
|
780
808
|
|
781
809
|
default: /* NGX_MAIL_SMTP_PROTOCOL */
|
810
|
+
|
811
|
+
if (p[3] == '-') {
|
812
|
+
/* multiline reply, check if we got last line */
|
813
|
+
|
814
|
+
m = b->last - (sizeof(CRLF "200" CRLF) - 1);
|
815
|
+
|
816
|
+
while (m > p) {
|
817
|
+
if (m[0] == CR && m[1] == LF) {
|
818
|
+
break;
|
819
|
+
}
|
820
|
+
|
821
|
+
m--;
|
822
|
+
}
|
823
|
+
|
824
|
+
if (m <= p || m[5] == '-') {
|
825
|
+
return NGX_AGAIN;
|
826
|
+
}
|
827
|
+
}
|
828
|
+
|
782
829
|
switch (state) {
|
783
830
|
|
784
831
|
case ngx_smtp_start:
|
@@ -55,7 +55,6 @@ static ngx_str_t smtp_tempunavail = ngx_string("[TEMPUNAVAIL]");
|
|
55
55
|
void
|
56
56
|
ngx_mail_smtp_init_session(ngx_mail_session_t *s, ngx_connection_t *c)
|
57
57
|
{
|
58
|
-
struct sockaddr_in *sin;
|
59
58
|
ngx_resolver_ctx_t *ctx;
|
60
59
|
ngx_mail_core_srv_conf_t *cscf;
|
61
60
|
|
@@ -67,11 +66,13 @@ ngx_mail_smtp_init_session(ngx_mail_session_t *s, ngx_connection_t *c)
|
|
67
66
|
return;
|
68
67
|
}
|
69
68
|
|
70
|
-
|
69
|
+
#if (NGX_HAVE_UNIX_DOMAIN)
|
70
|
+
if (c->sockaddr->sa_family == AF_UNIX) {
|
71
71
|
s->host = smtp_tempunavail;
|
72
72
|
ngx_mail_smtp_greeting(s, c);
|
73
73
|
return;
|
74
74
|
}
|
75
|
+
#endif
|
75
76
|
|
76
77
|
c->log->action = "in resolving client address";
|
77
78
|
|
@@ -81,11 +82,8 @@ ngx_mail_smtp_init_session(ngx_mail_session_t *s, ngx_connection_t *c)
|
|
81
82
|
return;
|
82
83
|
}
|
83
84
|
|
84
|
-
|
85
|
-
|
86
|
-
sin = (struct sockaddr_in *) c->sockaddr;
|
87
|
-
|
88
|
-
ctx->addr = sin->sin_addr.s_addr;
|
85
|
+
ctx->addr.sockaddr = c->sockaddr;
|
86
|
+
ctx->addr.socklen = c->socklen;
|
89
87
|
ctx->handler = ngx_mail_smtp_resolve_addr_handler;
|
90
88
|
ctx->data = s;
|
91
89
|
ctx->timeout = cscf->resolver_timeout;
|
@@ -167,7 +165,6 @@ ngx_mail_smtp_resolve_name(ngx_event_t *rev)
|
|
167
165
|
}
|
168
166
|
|
169
167
|
ctx->name = s->host;
|
170
|
-
ctx->type = NGX_RESOLVE_A;
|
171
168
|
ctx->handler = ngx_mail_smtp_resolve_name_handler;
|
172
169
|
ctx->data = s;
|
173
170
|
ctx->timeout = cscf->resolver_timeout;
|
@@ -181,10 +178,8 @@ ngx_mail_smtp_resolve_name(ngx_event_t *rev)
|
|
181
178
|
static void
|
182
179
|
ngx_mail_smtp_resolve_name_handler(ngx_resolver_ctx_t *ctx)
|
183
180
|
{
|
184
|
-
in_addr_t addr;
|
185
181
|
ngx_uint_t i;
|
186
182
|
ngx_connection_t *c;
|
187
|
-
struct sockaddr_in *sin;
|
188
183
|
ngx_mail_session_t *s;
|
189
184
|
|
190
185
|
s = ctx->data;
|
@@ -205,22 +200,29 @@ ngx_mail_smtp_resolve_name_handler(ngx_resolver_ctx_t *ctx)
|
|
205
200
|
|
206
201
|
} else {
|
207
202
|
|
208
|
-
|
203
|
+
#if (NGX_DEBUG)
|
204
|
+
{
|
205
|
+
u_char text[NGX_SOCKADDR_STRLEN];
|
206
|
+
ngx_str_t addr;
|
209
207
|
|
210
|
-
|
208
|
+
addr.data = text;
|
211
209
|
|
212
210
|
for (i = 0; i < ctx->naddrs; i++) {
|
211
|
+
addr.len = ngx_sock_ntop(ctx->addrs[i].sockaddr,
|
212
|
+
ctx->addrs[i].socklen,
|
213
|
+
text, NGX_SOCKADDR_STRLEN, 0);
|
213
214
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
(ntohl(addr) >> 16) & 0xff,
|
220
|
-
(ntohl(addr) >> 8) & 0xff,
|
221
|
-
ntohl(addr) & 0xff);
|
215
|
+
ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
|
216
|
+
"name was resolved to %V", &addr);
|
217
|
+
}
|
218
|
+
}
|
219
|
+
#endif
|
222
220
|
|
223
|
-
|
221
|
+
for (i = 0; i < ctx->naddrs; i++) {
|
222
|
+
if (ngx_cmp_sockaddr(ctx->addrs[i].sockaddr, ctx->addrs[i].socklen,
|
223
|
+
c->sockaddr, c->socklen, 0)
|
224
|
+
== NGX_OK)
|
225
|
+
{
|
224
226
|
goto found;
|
225
227
|
}
|
226
228
|
}
|
@@ -321,6 +323,7 @@ ngx_mail_smtp_invalid_pipelining(ngx_event_t *rev)
|
|
321
323
|
}
|
322
324
|
|
323
325
|
ngx_str_set(&s->out, smtp_invalid_pipelining);
|
326
|
+
s->quit = 1;
|
324
327
|
}
|
325
328
|
|
326
329
|
ngx_mail_send(c->write);
|
@@ -485,6 +488,10 @@ ngx_mail_smtp_auth_state(ngx_event_t *rev)
|
|
485
488
|
}
|
486
489
|
}
|
487
490
|
|
491
|
+
if (s->buffer->pos < s->buffer->last) {
|
492
|
+
s->blocked = 1;
|
493
|
+
}
|
494
|
+
|
488
495
|
switch (rc) {
|
489
496
|
|
490
497
|
case NGX_DONE:
|
@@ -504,11 +511,14 @@ ngx_mail_smtp_auth_state(ngx_event_t *rev)
|
|
504
511
|
|
505
512
|
case NGX_OK:
|
506
513
|
s->args.nelts = 0;
|
507
|
-
|
508
|
-
s->buffer->
|
514
|
+
|
515
|
+
if (s->buffer->pos == s->buffer->last) {
|
516
|
+
s->buffer->pos = s->buffer->start;
|
517
|
+
s->buffer->last = s->buffer->start;
|
518
|
+
}
|
509
519
|
|
510
520
|
if (s->state) {
|
511
|
-
s->arg_start = s->buffer->
|
521
|
+
s->arg_start = s->buffer->pos;
|
512
522
|
}
|
513
523
|
|
514
524
|
ngx_mail_send(c->write);
|
@@ -651,9 +661,7 @@ ngx_mail_smtp_auth(ngx_mail_session_t *s, ngx_connection_t *c)
|
|
651
661
|
static ngx_int_t
|
652
662
|
ngx_mail_smtp_mail(ngx_mail_session_t *s, ngx_connection_t *c)
|
653
663
|
{
|
654
|
-
|
655
|
-
ngx_str_t l;
|
656
|
-
ngx_uint_t i;
|
664
|
+
ngx_str_t *arg, cmd;
|
657
665
|
ngx_mail_smtp_srv_conf_t *sscf;
|
658
666
|
|
659
667
|
sscf = ngx_mail_get_module_srv_conf(s, ngx_mail_smtp_module);
|
@@ -671,37 +679,20 @@ ngx_mail_smtp_mail(ngx_mail_session_t *s, ngx_connection_t *c)
|
|
671
679
|
return NGX_OK;
|
672
680
|
}
|
673
681
|
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
for (i = 0; i < l.len; i++) {
|
678
|
-
ch = l.data[i];
|
679
|
-
|
680
|
-
if (ch != CR && ch != LF) {
|
681
|
-
continue;
|
682
|
-
}
|
683
|
-
|
684
|
-
l.data[i] = ' ';
|
685
|
-
}
|
686
|
-
|
687
|
-
while (i) {
|
688
|
-
if (l.data[i - 1] != ' ') {
|
689
|
-
break;
|
690
|
-
}
|
691
|
-
|
692
|
-
i--;
|
693
|
-
}
|
682
|
+
arg = s->args.elts;
|
683
|
+
arg += s->args.nelts - 1;
|
694
684
|
|
695
|
-
|
685
|
+
cmd.len = arg->data + arg->len - s->cmd.data;
|
686
|
+
cmd.data = s->cmd.data;
|
696
687
|
|
697
|
-
s->smtp_from.len =
|
688
|
+
s->smtp_from.len = cmd.len;
|
698
689
|
|
699
|
-
s->smtp_from.data = ngx_pnalloc(c->pool,
|
690
|
+
s->smtp_from.data = ngx_pnalloc(c->pool, cmd.len);
|
700
691
|
if (s->smtp_from.data == NULL) {
|
701
692
|
return NGX_ERROR;
|
702
693
|
}
|
703
694
|
|
704
|
-
ngx_memcpy(s->smtp_from.data,
|
695
|
+
ngx_memcpy(s->smtp_from.data, cmd.data, cmd.len);
|
705
696
|
|
706
697
|
ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
|
707
698
|
"smtp mail from:\"%V\"", &s->smtp_from);
|
@@ -715,46 +706,27 @@ ngx_mail_smtp_mail(ngx_mail_session_t *s, ngx_connection_t *c)
|
|
715
706
|
static ngx_int_t
|
716
707
|
ngx_mail_smtp_rcpt(ngx_mail_session_t *s, ngx_connection_t *c)
|
717
708
|
{
|
718
|
-
|
719
|
-
ngx_str_t l;
|
720
|
-
ngx_uint_t i;
|
709
|
+
ngx_str_t *arg, cmd;
|
721
710
|
|
722
711
|
if (s->smtp_from.len == 0) {
|
723
712
|
ngx_str_set(&s->out, smtp_bad_sequence);
|
724
713
|
return NGX_OK;
|
725
714
|
}
|
726
715
|
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
for (i = 0; i < l.len; i++) {
|
731
|
-
ch = l.data[i];
|
732
|
-
|
733
|
-
if (ch != CR && ch != LF) {
|
734
|
-
continue;
|
735
|
-
}
|
736
|
-
|
737
|
-
l.data[i] = ' ';
|
738
|
-
}
|
739
|
-
|
740
|
-
while (i) {
|
741
|
-
if (l.data[i - 1] != ' ') {
|
742
|
-
break;
|
743
|
-
}
|
744
|
-
|
745
|
-
i--;
|
746
|
-
}
|
716
|
+
arg = s->args.elts;
|
717
|
+
arg += s->args.nelts - 1;
|
747
718
|
|
748
|
-
|
719
|
+
cmd.len = arg->data + arg->len - s->cmd.data;
|
720
|
+
cmd.data = s->cmd.data;
|
749
721
|
|
750
|
-
s->smtp_to.len =
|
722
|
+
s->smtp_to.len = cmd.len;
|
751
723
|
|
752
|
-
s->smtp_to.data = ngx_pnalloc(c->pool,
|
724
|
+
s->smtp_to.data = ngx_pnalloc(c->pool, cmd.len);
|
753
725
|
if (s->smtp_to.data == NULL) {
|
754
726
|
return NGX_ERROR;
|
755
727
|
}
|
756
728
|
|
757
|
-
ngx_memcpy(s->smtp_to.data,
|
729
|
+
ngx_memcpy(s->smtp_to.data, cmd.data, cmd.len);
|
758
730
|
|
759
731
|
ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
|
760
732
|
"smtp rcpt to:\"%V\"", &s->smtp_to);
|
@@ -25,7 +25,7 @@ static char *ngx_mail_ssl_session_cache(ngx_conf_t *cf, ngx_command_t *cmd,
|
|
25
25
|
void *conf);
|
26
26
|
|
27
27
|
|
28
|
-
static ngx_conf_enum_t
|
28
|
+
static ngx_conf_enum_t ngx_mail_starttls_state[] = {
|
29
29
|
{ ngx_string("off"), NGX_MAIL_STARTTLS_OFF },
|
30
30
|
{ ngx_string("on"), NGX_MAIL_STARTTLS_ON },
|
31
31
|
{ ngx_string("only"), NGX_MAIL_STARTTLS_ONLY },
|
@@ -58,7 +58,7 @@ static ngx_command_t ngx_mail_ssl_commands[] = {
|
|
58
58
|
ngx_mail_ssl_starttls,
|
59
59
|
NGX_MAIL_SRV_CONF_OFFSET,
|
60
60
|
offsetof(ngx_mail_ssl_conf_t, starttls),
|
61
|
-
|
61
|
+
ngx_mail_starttls_state },
|
62
62
|
|
63
63
|
{ ngx_string("ssl_certificate"),
|
64
64
|
NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_TAKE1,
|
@@ -116,6 +116,20 @@ static ngx_command_t ngx_mail_ssl_commands[] = {
|
|
116
116
|
0,
|
117
117
|
NULL },
|
118
118
|
|
119
|
+
{ ngx_string("ssl_session_tickets"),
|
120
|
+
NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_FLAG,
|
121
|
+
ngx_conf_set_flag_slot,
|
122
|
+
NGX_MAIL_SRV_CONF_OFFSET,
|
123
|
+
offsetof(ngx_mail_ssl_conf_t, session_tickets),
|
124
|
+
NULL },
|
125
|
+
|
126
|
+
{ ngx_string("ssl_session_ticket_key"),
|
127
|
+
NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_TAKE1,
|
128
|
+
ngx_conf_set_str_array_slot,
|
129
|
+
NGX_MAIL_SRV_CONF_OFFSET,
|
130
|
+
offsetof(ngx_mail_ssl_conf_t, session_ticket_keys),
|
131
|
+
NULL },
|
132
|
+
|
119
133
|
{ ngx_string("ssl_session_timeout"),
|
120
134
|
NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_TAKE1,
|
121
135
|
ngx_conf_set_sec_slot,
|
@@ -184,6 +198,8 @@ ngx_mail_ssl_create_conf(ngx_conf_t *cf)
|
|
184
198
|
scf->prefer_server_ciphers = NGX_CONF_UNSET;
|
185
199
|
scf->builtin_session_cache = NGX_CONF_UNSET;
|
186
200
|
scf->session_timeout = NGX_CONF_UNSET;
|
201
|
+
scf->session_tickets = NGX_CONF_UNSET;
|
202
|
+
scf->session_ticket_keys = NGX_CONF_UNSET_PTR;
|
187
203
|
|
188
204
|
return scf;
|
189
205
|
}
|
@@ -292,15 +308,14 @@ ngx_mail_ssl_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
292
308
|
return NGX_CONF_ERROR;
|
293
309
|
}
|
294
310
|
|
295
|
-
if (conf->
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
}
|
311
|
+
if (SSL_CTX_set_cipher_list(conf->ssl.ctx,
|
312
|
+
(const char *) conf->ciphers.data)
|
313
|
+
== 0)
|
314
|
+
{
|
315
|
+
ngx_ssl_error(NGX_LOG_EMERG, cf->log, 0,
|
316
|
+
"SSL_CTX_set_cipher_list(\"%V\") failed",
|
317
|
+
&conf->ciphers);
|
318
|
+
return NGX_CONF_ERROR;
|
304
319
|
}
|
305
320
|
|
306
321
|
if (conf->prefer_server_ciphers) {
|
@@ -313,6 +328,10 @@ ngx_mail_ssl_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
313
328
|
return NGX_CONF_ERROR;
|
314
329
|
}
|
315
330
|
|
331
|
+
if (ngx_ssl_ecdh_curve(cf, &conf->ssl, &conf->ecdh_curve) != NGX_OK) {
|
332
|
+
return NGX_CONF_ERROR;
|
333
|
+
}
|
334
|
+
|
316
335
|
ngx_conf_merge_value(conf->builtin_session_cache,
|
317
336
|
prev->builtin_session_cache, NGX_SSL_NONE_SCACHE);
|
318
337
|
|
@@ -328,6 +347,24 @@ ngx_mail_ssl_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
328
347
|
return NGX_CONF_ERROR;
|
329
348
|
}
|
330
349
|
|
350
|
+
ngx_conf_merge_value(conf->session_tickets,
|
351
|
+
prev->session_tickets, 1);
|
352
|
+
|
353
|
+
#ifdef SSL_OP_NO_TICKET
|
354
|
+
if (!conf->session_tickets) {
|
355
|
+
SSL_CTX_set_options(conf->ssl.ctx, SSL_OP_NO_TICKET);
|
356
|
+
}
|
357
|
+
#endif
|
358
|
+
|
359
|
+
ngx_conf_merge_ptr_value(conf->session_ticket_keys,
|
360
|
+
prev->session_ticket_keys, NULL);
|
361
|
+
|
362
|
+
if (ngx_ssl_session_ticket_keys(cf, &conf->ssl, conf->session_ticket_keys)
|
363
|
+
!= NGX_OK)
|
364
|
+
{
|
365
|
+
return NGX_CONF_ERROR;
|
366
|
+
}
|
367
|
+
|
331
368
|
return NGX_CONF_OK;
|
332
369
|
}
|
333
370
|
|