fix "PTR ." case in address resolver
diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c
index 82785c2..775f17f 100644
--- a/src/core/ngx_resolver.c
+++ b/src/core/ngx_resolver.c
@@ -1902,6 +1902,12 @@
         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 5d9be14..12e4b57 100644
--- a/src/mail/ngx_mail_smtp_handler.c
+++ b/src/mail/ngx_mail_smtp_handler.c
@@ -124,6 +124,19 @@
         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);