# HG changeset patch # User Igor Sysoev # Date 1257789845 0 # Node ID 847ab5a323079b381a48fbd007068f6199f0a20f # Parent ebc5384479b4979b6dae22bfee91a69c69411177 fix "PTR ." case in address resolver diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c --- 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 --- 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_r 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);