summaryrefslogtreecommitdiffhomepage
path: root/src/mail
diff options
context:
space:
mode:
Diffstat (limited to 'src/mail')
-rw-r--r--src/mail/ngx_mail.c4
-rw-r--r--src/mail/ngx_mail_auth_http_module.c17
-rw-r--r--src/mail/ngx_mail_handler.c19
-rw-r--r--src/mail/ngx_mail_imap_handler.c6
-rw-r--r--src/mail/ngx_mail_imap_module.c6
-rw-r--r--src/mail/ngx_mail_pop3_handler.c10
-rw-r--r--src/mail/ngx_mail_pop3_module.c6
-rw-r--r--src/mail/ngx_mail_proxy_module.c14
-rw-r--r--src/mail/ngx_mail_smtp_handler.c2
-rw-r--r--src/mail/ngx_mail_smtp_module.c10
10 files changed, 48 insertions, 46 deletions
diff --git a/src/mail/ngx_mail.c b/src/mail/ngx_mail.c
index 00c255040..edfa245ee 100644
--- a/src/mail/ngx_mail.c
+++ b/src/mail/ngx_mail.c
@@ -357,8 +357,8 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
imip->addrs[i].addr = in_addr[i].addr;
imip->addrs[i].ctx = in_addr[i].ctx;
- text = ngx_palloc(cf->pool,
- INET_ADDRSTRLEN - 1 + sizeof(":65535") - 1);
+ text = ngx_pnalloc(cf->pool,
+ INET_ADDRSTRLEN - 1 + sizeof(":65535") - 1);
if (text == NULL) {
return NGX_CONF_ERROR;
}
diff --git a/src/mail/ngx_mail_auth_http_module.c b/src/mail/ngx_mail_auth_http_module.c
index 17e7861c0..876ac404e 100644
--- a/src/mail/ngx_mail_auth_http_module.c
+++ b/src/mail/ngx_mail_auth_http_module.c
@@ -593,7 +593,7 @@ ngx_mail_auth_http_process_headers(ngx_mail_session_t *s,
{
s->login.len = ctx->header_end - ctx->header_start;
- s->login.data = ngx_palloc(s->connection->pool, s->login.len);
+ s->login.data = ngx_pnalloc(s->connection->pool, s->login.len);
if (s->login.data == NULL) {
ngx_close_connection(ctx->peer.connection);
ngx_destroy_pool(ctx->pool);
@@ -614,7 +614,8 @@ ngx_mail_auth_http_process_headers(ngx_mail_session_t *s,
{
s->passwd.len = ctx->header_end - ctx->header_start;
- s->passwd.data = ngx_palloc(s->connection->pool, s->passwd.len);
+ s->passwd.data = ngx_pnalloc(s->connection->pool,
+ s->passwd.len);
if (s->passwd.data == NULL) {
ngx_close_connection(ctx->peer.connection);
ngx_destroy_pool(ctx->pool);
@@ -651,8 +652,8 @@ ngx_mail_auth_http_process_headers(ngx_mail_session_t *s,
{
ctx->errcode.len = ctx->header_end - ctx->header_start;
- ctx->errcode.data = ngx_palloc(s->connection->pool,
- ctx->errcode.len);
+ ctx->errcode.data = ngx_pnalloc(s->connection->pool,
+ ctx->errcode.len);
if (ctx->errcode.data == NULL) {
ngx_close_connection(ctx->peer.connection);
ngx_destroy_pool(ctx->pool);
@@ -691,7 +692,7 @@ ngx_mail_auth_http_process_headers(ngx_mail_session_t *s,
ctx->err.len = ctx->errcode.len + ctx->errmsg.len
+ sizeof(" " CRLF) - 1;
- p = ngx_palloc(s->connection->pool, ctx->err.len);
+ p = ngx_pnalloc(s->connection->pool, ctx->err.len);
if (p == NULL) {
ngx_close_connection(ctx->peer.connection);
ngx_destroy_pool(ctx->pool);
@@ -810,7 +811,7 @@ ngx_mail_auth_http_process_headers(ngx_mail_session_t *s,
peer->name.len = len;
- peer->name.data = ngx_palloc(s->connection->pool, len);
+ peer->name.data = ngx_pnalloc(s->connection->pool, len);
if (peer->name.data == NULL) {
ngx_destroy_pool(ctx->pool);
ngx_mail_session_internal_server_error(s);
@@ -1255,7 +1256,7 @@ ngx_mail_auth_http_escape(ngx_pool_t *pool, ngx_str_t *text, ngx_str_t *escaped)
escaped->len = text->len + n * 2;
- p = ngx_palloc(pool, escaped->len);
+ p = ngx_pnalloc(pool, escaped->len);
if (p == NULL) {
return NGX_ERROR;
}
@@ -1326,7 +1327,7 @@ ngx_mail_auth_http_merge_conf(ngx_conf_t *cf, void *parent, void *child)
len += header[i].key.len + 2 + header[i].value.len + 2;
}
- p = ngx_palloc(cf->pool, len);
+ p = ngx_pnalloc(cf->pool, len);
if (p == NULL) {
return NGX_CONF_ERROR;
}
diff --git a/src/mail/ngx_mail_handler.c b/src/mail/ngx_mail_handler.c
index 0cb67a237..2dc5d7a31 100644
--- a/src/mail/ngx_mail_handler.c
+++ b/src/mail/ngx_mail_handler.c
@@ -236,10 +236,10 @@ ngx_int_t
ngx_mail_salt(ngx_mail_session_t *s, ngx_connection_t *c,
ngx_mail_core_srv_conf_t *cscf)
{
- s->salt.data = ngx_palloc(c->pool,
- sizeof(" <18446744073709551616.@>" CRLF) - 1
- + NGX_TIME_T_LEN
- + cscf->server_name.len);
+ s->salt.data = ngx_pnalloc(c->pool,
+ sizeof(" <18446744073709551616.@>" CRLF) - 1
+ + NGX_TIME_T_LEN
+ + cscf->server_name.len);
if (s->salt.data == NULL) {
return NGX_ERROR;
}
@@ -288,7 +288,7 @@ ngx_mail_auth_plain(ngx_mail_session_t *s, ngx_connection_t *c, ngx_uint_t n)
"mail auth plain: \"%V\"", &arg[n]);
#endif
- plain.data = ngx_palloc(c->pool, ngx_base64_decoded_length(arg[n].len));
+ plain.data = ngx_pnalloc(c->pool, ngx_base64_decoded_length(arg[n].len));
if (plain.data == NULL){
return NGX_ERROR;
}
@@ -344,7 +344,7 @@ ngx_mail_auth_login_username(ngx_mail_session_t *s, ngx_connection_t *c)
ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
"mail auth login username: \"%V\"", &arg[0]);
- s->login.data = ngx_palloc(c->pool, ngx_base64_decoded_length(arg[0].len));
+ s->login.data = ngx_pnalloc(c->pool, ngx_base64_decoded_length(arg[0].len));
if (s->login.data == NULL){
return NGX_ERROR;
}
@@ -374,7 +374,8 @@ ngx_mail_auth_login_password(ngx_mail_session_t *s, ngx_connection_t *c)
"mail auth login password: \"%V\"", &arg[0]);
#endif
- s->passwd.data = ngx_palloc(c->pool, ngx_base64_decoded_length(arg[0].len));
+ s->passwd.data = ngx_pnalloc(c->pool,
+ ngx_base64_decoded_length(arg[0].len));
if (s->passwd.data == NULL){
return NGX_ERROR;
}
@@ -402,7 +403,7 @@ ngx_mail_auth_cram_md5_salt(ngx_mail_session_t *s, ngx_connection_t *c,
ngx_str_t salt;
ngx_uint_t n;
- p = ngx_palloc(c->pool, len + ngx_base64_encoded_length(s->salt.len) + 2);
+ p = ngx_pnalloc(c->pool, len + ngx_base64_encoded_length(s->salt.len) + 2);
if (p == NULL) {
return NGX_ERROR;
}
@@ -434,7 +435,7 @@ ngx_mail_auth_cram_md5(ngx_mail_session_t *s, ngx_connection_t *c)
ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
"mail auth cram-md5: \"%V\"", &arg[0]);
- s->login.data = ngx_palloc(c->pool, ngx_base64_decoded_length(arg[0].len));
+ s->login.data = ngx_pnalloc(c->pool, ngx_base64_decoded_length(arg[0].len));
if (s->login.data == NULL){
return NGX_ERROR;
}
diff --git a/src/mail/ngx_mail_imap_handler.c b/src/mail/ngx_mail_imap_handler.c
index 62ba17da8..f8ca4f689 100644
--- a/src/mail/ngx_mail_imap_handler.c
+++ b/src/mail/ngx_mail_imap_handler.c
@@ -259,7 +259,7 @@ ngx_mail_imap_auth_state(ngx_event_t *rev)
if (s->tagged_line.len < s->tag.len + s->text.len + s->out.len) {
s->tagged_line.len = s->tag.len + s->text.len + s->out.len;
- s->tagged_line.data = ngx_palloc(c->pool, s->tagged_line.len);
+ s->tagged_line.data = ngx_pnalloc(c->pool, s->tagged_line.len);
if (s->tagged_line.data == NULL) {
ngx_mail_close_connection(c);
return;
@@ -317,7 +317,7 @@ ngx_mail_imap_login(ngx_mail_session_t *s, ngx_connection_t *c)
}
s->login.len = arg[0].len;
- s->login.data = ngx_palloc(c->pool, s->login.len);
+ s->login.data = ngx_pnalloc(c->pool, s->login.len);
if (s->login.data == NULL) {
return NGX_ERROR;
}
@@ -325,7 +325,7 @@ ngx_mail_imap_login(ngx_mail_session_t *s, ngx_connection_t *c)
ngx_memcpy(s->login.data, arg[0].data, s->login.len);
s->passwd.len = arg[1].len;
- s->passwd.data = ngx_palloc(c->pool, s->passwd.len);
+ s->passwd.data = ngx_pnalloc(c->pool, s->passwd.len);
if (s->passwd.data == NULL) {
return NGX_ERROR;
}
diff --git a/src/mail/ngx_mail_imap_module.c b/src/mail/ngx_mail_imap_module.c
index 3889c9248..2d72397eb 100644
--- a/src/mail/ngx_mail_imap_module.c
+++ b/src/mail/ngx_mail_imap_module.c
@@ -183,7 +183,7 @@ ngx_mail_imap_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
}
}
- p = ngx_palloc(cf->pool, size);
+ p = ngx_pnalloc(cf->pool, size);
if (p == NULL) {
return NGX_CONF_ERROR;
}
@@ -216,7 +216,7 @@ ngx_mail_imap_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
size += sizeof(" STARTTLS") - 1;
- p = ngx_palloc(cf->pool, size);
+ p = ngx_pnalloc(cf->pool, size);
if (p == NULL) {
return NGX_CONF_ERROR;
}
@@ -233,7 +233,7 @@ ngx_mail_imap_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
size = (auth - conf->capability.data) + sizeof(CRLF) - 1
+ sizeof(" STARTTLS LOGINDISABLED") - 1;
- p = ngx_palloc(cf->pool, size);
+ p = ngx_pnalloc(cf->pool, size);
if (p == NULL) {
return NGX_CONF_ERROR;
}
diff --git a/src/mail/ngx_mail_pop3_handler.c b/src/mail/ngx_mail_pop3_handler.c
index c486fbebd..51763613d 100644
--- a/src/mail/ngx_mail_pop3_handler.c
+++ b/src/mail/ngx_mail_pop3_handler.c
@@ -46,7 +46,7 @@ ngx_mail_pop3_init_session(ngx_mail_session_t *s, ngx_connection_t *c)
return;
}
- s->out.data = ngx_palloc(c->pool, sizeof(pop3_greeting) + s->salt.len);
+ s->out.data = ngx_pnalloc(c->pool, sizeof(pop3_greeting) + s->salt.len);
if (s->out.data == NULL) {
ngx_mail_session_internal_server_error(s);
return;
@@ -297,7 +297,7 @@ ngx_mail_pop3_user(ngx_mail_session_t *s, ngx_connection_t *c)
arg = s->args.elts;
s->login.len = arg[0].len;
- s->login.data = ngx_palloc(c->pool, s->login.len);
+ s->login.data = ngx_pnalloc(c->pool, s->login.len);
if (s->login.data == NULL) {
return NGX_ERROR;
}
@@ -324,7 +324,7 @@ ngx_mail_pop3_pass(ngx_mail_session_t *s, ngx_connection_t *c)
arg = s->args.elts;
s->passwd.len = arg[0].len;
- s->passwd.data = ngx_palloc(c->pool, s->passwd.len);
+ s->passwd.data = ngx_pnalloc(c->pool, s->passwd.len);
if (s->passwd.data == NULL) {
return NGX_ERROR;
}
@@ -417,7 +417,7 @@ ngx_mail_pop3_apop(ngx_mail_session_t *s, ngx_connection_t *c)
arg = s->args.elts;
s->login.len = arg[0].len;
- s->login.data = ngx_palloc(c->pool, s->login.len);
+ s->login.data = ngx_pnalloc(c->pool, s->login.len);
if (s->login.data == NULL) {
return NGX_ERROR;
}
@@ -425,7 +425,7 @@ ngx_mail_pop3_apop(ngx_mail_session_t *s, ngx_connection_t *c)
ngx_memcpy(s->login.data, arg[0].data, s->login.len);
s->passwd.len = arg[1].len;
- s->passwd.data = ngx_palloc(c->pool, s->passwd.len);
+ s->passwd.data = ngx_pnalloc(c->pool, s->passwd.len);
if (s->passwd.data == NULL) {
return NGX_ERROR;
}
diff --git a/src/mail/ngx_mail_pop3_module.c b/src/mail/ngx_mail_pop3_module.c
index 6f726554a..648c57ce8 100644
--- a/src/mail/ngx_mail_pop3_module.c
+++ b/src/mail/ngx_mail_pop3_module.c
@@ -183,7 +183,7 @@ ngx_mail_pop3_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
size += sizeof("SASL LOGIN PLAIN" CRLF) - 1;
}
- p = ngx_palloc(cf->pool, size);
+ p = ngx_pnalloc(cf->pool, size);
if (p == NULL) {
return NGX_CONF_ERROR;
}
@@ -213,7 +213,7 @@ ngx_mail_pop3_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
size += sizeof("STLS" CRLF) - 1;
- p = ngx_palloc(cf->pool, size);
+ p = ngx_pnalloc(cf->pool, size);
if (p == NULL) {
return NGX_CONF_ERROR;
}
@@ -236,7 +236,7 @@ ngx_mail_pop3_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
}
- p = ngx_palloc(cf->pool, stls_only_size);
+ p = ngx_pnalloc(cf->pool, stls_only_size);
if (p == NULL) {
return NGX_CONF_ERROR;
}
diff --git a/src/mail/ngx_mail_proxy_module.c b/src/mail/ngx_mail_proxy_module.c
index 3cac329b7..f8757beb7 100644
--- a/src/mail/ngx_mail_proxy_module.c
+++ b/src/mail/ngx_mail_proxy_module.c
@@ -253,7 +253,7 @@ ngx_mail_proxy_pop3_handler(ngx_event_t *rev)
s->connection->log->action = "sending user name to upstream";
line.len = sizeof("USER ") - 1 + s->login.len + 2;
- line.data = ngx_palloc(c->pool, line.len);
+ line.data = ngx_pnalloc(c->pool, line.len);
if (line.data == NULL) {
ngx_mail_proxy_internal_server_error(s);
return;
@@ -272,7 +272,7 @@ ngx_mail_proxy_pop3_handler(ngx_event_t *rev)
s->connection->log->action = "sending password to upstream";
line.len = sizeof("PASS ") - 1 + s->passwd.len + 2;
- line.data = ngx_palloc(c->pool, line.len);
+ line.data = ngx_pnalloc(c->pool, line.len);
if (line.data == NULL) {
ngx_mail_proxy_internal_server_error(s);
return;
@@ -369,7 +369,7 @@ ngx_mail_proxy_imap_handler(ngx_event_t *rev)
line.len = s->tag.len + sizeof("LOGIN ") - 1
+ 1 + NGX_SIZE_T_LEN + 1 + 2;
- line.data = ngx_palloc(c->pool, line.len);
+ line.data = ngx_pnalloc(c->pool, line.len);
if (line.data == NULL) {
ngx_mail_proxy_internal_server_error(s);
return;
@@ -388,7 +388,7 @@ ngx_mail_proxy_imap_handler(ngx_event_t *rev)
s->connection->log->action = "sending user name to upstream";
line.len = s->login.len + 1 + 1 + NGX_SIZE_T_LEN + 1 + 2;
- line.data = ngx_palloc(c->pool, line.len);
+ line.data = ngx_pnalloc(c->pool, line.len);
if (line.data == NULL) {
ngx_mail_proxy_internal_server_error(s);
return;
@@ -408,7 +408,7 @@ ngx_mail_proxy_imap_handler(ngx_event_t *rev)
s->connection->log->action = "sending password to upstream";
line.len = s->passwd.len + 2;
- line.data = ngx_palloc(c->pool, line.len);
+ line.data = ngx_pnalloc(c->pool, line.len);
if (line.data == NULL) {
ngx_mail_proxy_internal_server_error(s);
return;
@@ -505,7 +505,7 @@ ngx_mail_proxy_smtp_handler(ngx_event_t *rev)
cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
line.len = sizeof("HELO ") - 1 + cscf->server_name.len + 2;
- line.data = ngx_palloc(c->pool, line.len);
+ line.data = ngx_pnalloc(c->pool, line.len);
if (line.data == NULL) {
ngx_mail_proxy_internal_server_error(s);
return;
@@ -535,7 +535,7 @@ ngx_mail_proxy_smtp_handler(ngx_event_t *rev)
+ s->esmtp + s->smtp_helo.len
+ s->connection->addr_text.len + s->login.len + s->host.len;
- line.data = ngx_palloc(c->pool, line.len);
+ line.data = ngx_pnalloc(c->pool, line.len);
if (line.data == NULL) {
ngx_mail_proxy_internal_server_error(s);
return;
diff --git a/src/mail/ngx_mail_smtp_handler.c b/src/mail/ngx_mail_smtp_handler.c
index 6e944738f..722354aa9 100644
--- a/src/mail/ngx_mail_smtp_handler.c
+++ b/src/mail/ngx_mail_smtp_handler.c
@@ -506,7 +506,7 @@ ngx_mail_smtp_helo(ngx_mail_session_t *s, ngx_connection_t *c)
s->smtp_helo.len = arg[0].len;
- s->smtp_helo.data = ngx_palloc(c->pool, arg[0].len);
+ s->smtp_helo.data = ngx_pnalloc(c->pool, arg[0].len);
if (s->smtp_helo.data == NULL) {
return NGX_ERROR;
}
diff --git a/src/mail/ngx_mail_smtp_module.c b/src/mail/ngx_mail_smtp_module.c
index 5f5ac0567..92e9b06de 100644
--- a/src/mail/ngx_mail_smtp_module.c
+++ b/src/mail/ngx_mail_smtp_module.c
@@ -160,7 +160,7 @@ ngx_mail_smtp_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
size = sizeof("220 ESMTP ready" CRLF) - 1 + cscf->server_name.len;
- p = ngx_palloc(cf->pool, size);
+ p = ngx_pnalloc(cf->pool, size);
if (p == NULL) {
return NGX_CONF_ERROR;
}
@@ -175,7 +175,7 @@ ngx_mail_smtp_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
size = sizeof("250 " CRLF) - 1 + cscf->server_name.len;
- p = ngx_palloc(cf->pool, size);
+ p = ngx_pnalloc(cf->pool, size);
if (p == NULL) {
return NGX_CONF_ERROR;
}
@@ -209,7 +209,7 @@ ngx_mail_smtp_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
}
}
- p = ngx_palloc(cf->pool, size);
+ p = ngx_pnalloc(cf->pool, size);
if (p == NULL) {
return NGX_CONF_ERROR;
}
@@ -247,7 +247,7 @@ ngx_mail_smtp_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
size += sizeof("250 STARTTLS" CRLF) - 1;
- p = ngx_palloc(cf->pool, size);
+ p = ngx_pnalloc(cf->pool, size);
if (p == NULL) {
return NGX_CONF_ERROR;
}
@@ -268,7 +268,7 @@ ngx_mail_smtp_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
size = (auth - conf->capability.data)
+ sizeof("250 STARTTLS" CRLF) - 1;
- p = ngx_palloc(cf->pool, size);
+ p = ngx_pnalloc(cf->pool, size);
if (p == NULL) {
return NGX_CONF_ERROR;
}