268
269
ngx_del_timer(wev);
271
if (ngx_handle_write_event(wev, 0) == NGX_ERROR) {
272
if (ngx_handle_write_event(wev, 0) != NGX_OK) {
272
273
ngx_close_connection(c);
273
274
ngx_destroy_pool(ctx->pool);
274
275
ngx_mail_session_internal_server_error(s);
531
p = ngx_pcalloc(s->connection->pool, size);
532
p = ngx_pnalloc(s->connection->pool, size);
533
534
ngx_close_connection(ctx->peer.connection);
534
535
ngx_destroy_pool(ctx->pool);
594
595
s->login.len = ctx->header_end - ctx->header_start;
596
s->login.data = ngx_palloc(s->connection->pool, s->login.len);
597
s->login.data = ngx_pnalloc(s->connection->pool, s->login.len);
597
598
if (s->login.data == NULL) {
598
599
ngx_close_connection(ctx->peer.connection);
599
600
ngx_destroy_pool(ctx->pool);
615
616
s->passwd.len = ctx->header_end - ctx->header_start;
617
s->passwd.data = ngx_palloc(s->connection->pool, s->passwd.len);
618
s->passwd.data = ngx_pnalloc(s->connection->pool,
618
620
if (s->passwd.data == NULL) {
619
621
ngx_close_connection(ctx->peer.connection);
620
622
ngx_destroy_pool(ctx->pool);
652
654
ctx->errcode.len = ctx->header_end - ctx->header_start;
654
ctx->errcode.data = ngx_palloc(s->connection->pool,
656
ctx->errcode.data = ngx_pnalloc(s->connection->pool,
656
658
if (ctx->errcode.data == NULL) {
657
659
ngx_close_connection(ctx->peer.connection);
658
660
ngx_destroy_pool(ctx->pool);
691
693
ctx->err.len = ctx->errcode.len + ctx->errmsg.len
692
694
+ sizeof(" " CRLF) - 1;
694
p = ngx_palloc(s->connection->pool, ctx->err.len);
696
p = ngx_pnalloc(s->connection->pool, ctx->err.len);
696
698
ngx_close_connection(ctx->peer.connection);
697
699
ngx_destroy_pool(ctx->pool);
811
815
peer->name.len = len;
813
peer->name.data = ngx_palloc(s->connection->pool, len);
817
peer->name.data = ngx_pnalloc(s->connection->pool, len);
814
818
if (peer->name.data == NULL) {
815
819
ngx_destroy_pool(ctx->pool);
816
820
ngx_mail_session_internal_server_error(s);
1110
1105
ngx_log_debug0(NGX_LOG_DEBUG_MAIL, rev->log, 0,
1111
1106
"mail auth http block read");
1113
if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
1108
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
1164
1159
+ sizeof(CRLF) - 1
1165
1160
+ sizeof("Client-IP: ") - 1 + s->connection->addr_text.len
1166
1161
+ sizeof(CRLF) - 1
1162
+ sizeof("Client-Host: ") - 1 + s->host.len + sizeof(CRLF) - 1
1163
+ sizeof("Auth-SMTP-Helo: ") - 1 + s->smtp_helo.len
1164
+ sizeof("Auth-SMTP-From: ") - 1 + s->smtp_from.len
1165
+ sizeof("Auth-SMTP-To: ") - 1 + s->smtp_to.len
1167
1166
+ ahcf->header.len
1168
1167
+ sizeof(CRLF) - 1;
1216
1215
b->last = ngx_cpymem(b->last, "Client-IP: ", sizeof("Client-IP: ") - 1);
1217
1216
b->last = ngx_copy(b->last, s->connection->addr_text.data,
1218
s->connection->addr_text.len);
1217
s->connection->addr_text.len);
1219
1218
*b->last++ = CR; *b->last++ = LF;
1221
b->last = ngx_cpymem(b->last, "Client-Host: ",
1222
sizeof("Client-Host: ") - 1);
1223
b->last = ngx_copy(b->last, s->host.data, s->host.len);
1224
*b->last++ = CR; *b->last++ = LF;
1227
if (s->auth_method == NGX_MAIL_AUTH_NONE) {
1229
/* HELO, MAIL FROM, and RCPT TO can't contain CRLF, no need to escape */
1231
b->last = ngx_cpymem(b->last, "Auth-SMTP-Helo: ",
1232
sizeof("Auth-SMTP-Helo: ") - 1);
1233
b->last = ngx_copy(b->last, s->smtp_helo.data, s->smtp_helo.len);
1234
*b->last++ = CR; *b->last++ = LF;
1236
b->last = ngx_cpymem(b->last, "Auth-SMTP-From: ",
1237
sizeof("Auth-SMTP-From: ") - 1);
1238
b->last = ngx_copy(b->last, s->smtp_from.data, s->smtp_from.len);
1239
*b->last++ = CR; *b->last++ = LF;
1241
b->last = ngx_cpymem(b->last, "Auth-SMTP-To: ",
1242
sizeof("Auth-SMTP-To: ") - 1);
1243
b->last = ngx_copy(b->last, s->smtp_to.data, s->smtp_to.len);
1244
*b->last++ = CR; *b->last++ = LF;
1221
1248
if (ahcf->header.len) {
1222
1249
b->last = ngx_copy(b->last, ahcf->header.data, ahcf->header.len);