aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/ngx_resolver.c6
-rw-r--r--src/mail/ngx_mail_smtp_handler.c13
2 files changed, 19 insertions, 0 deletions
diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c
index 82785c276..775f17fa1 100644
--- a/src/core/ngx_resolver.c
+++ b/src/core/ngx_resolver.c
@@ -1902,6 +1902,12 @@ done:
return NGX_OK;
}
+ if (len == -1) {
+ name->len = 0;
+ name->data = NULL;
+ return NGX_OK;
+ }
+
dst = ngx_resolver_alloc(r, len);
if (dst == NULL) {
return NGX_ERROR;
diff --git a/src/mail/ngx_mail_smtp_handler.c b/src/mail/ngx_mail_smtp_handler.c
index 5d9be1484..12e4b5711 100644
--- a/src/mail/ngx_mail_smtp_handler.c
+++ b/src/mail/ngx_mail_smtp_handler.c
@@ -124,6 +124,19 @@ ngx_mail_smtp_resolve_addr_handler(ngx_resolver_ctx_t *ctx)
return;
}
+ if (ctx->name.len == 0) {
+ ngx_log_error(NGX_LOG_ERR, c->log, 0,
+ "%V has been resolved to zero name", &c->addr_text);
+
+ s->host = smtp_unavailable;
+
+ ngx_resolve_addr_done(ctx);
+
+ ngx_mail_smtp_greeting(s, s->connection);
+
+ return;
+ }
+
c->log->action = "in resolving client hostname";
s->host.data = ngx_pstrdup(c->pool, &ctx->name);