fix "PTR ." case in address resolver

This commit is contained in:
Igor Sysoev 2009-11-09 18:04:05 +00:00
parent 64bfa87e73
commit 70966c154f
2 changed files with 19 additions and 0 deletions

View File

@ -1902,6 +1902,12 @@ done:
return NGX_OK; return NGX_OK;
} }
if (len == -1) {
name->len = 0;
name->data = NULL;
return NGX_OK;
}
dst = ngx_resolver_alloc(r, len); dst = ngx_resolver_alloc(r, len);
if (dst == NULL) { if (dst == NULL) {
return NGX_ERROR; return NGX_ERROR;

View File

@ -124,6 +124,19 @@ ngx_mail_smtp_resolve_addr_handler(ngx_resolver_ctx_t *ctx)
return; 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"; c->log->action = "in resolving client hostname";
s->host.data = ngx_pstrdup(c->pool, &ctx->name); s->host.data = ngx_pstrdup(c->pool, &ctx->name);