Klaus Demo nginx / 5fa1146
do not resolve SMTP clients by default Igor Sysoev 14 years ago
3 changed file(s) with 17 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
153153 * set by ngx_pcalloc():
154154 *
155155 * cscf->protocol = NULL;
156 * cscf->resolver = NULL;
157156 */
158157
159158 cscf->timeout = NGX_CONF_UNSET_MSEC;
160159 cscf->resolver_timeout = NGX_CONF_UNSET_MSEC;
161160 cscf->so_keepalive = NGX_CONF_UNSET;
161
162 cscf->resolver = NGX_CONF_UNSET_PTR;
162163
163164 cscf->file_name = cf->conf_file->file.name.data;
164165 cscf->line = cf->conf_file->line;
206207 return NGX_CONF_ERROR;
207208 }
208209
209 if (conf->resolver == NULL) {
210 conf->resolver = prev->resolver;
211 }
210 ngx_conf_merge_ptr_value(conf->resolver, prev->resolver, NULL);
212211
213212 return NGX_CONF_OK;
214213 }
422421
423422 value = cf->args->elts;
424423
424 if (ngx_strcmp(value[1].data, "off") == 0) {
425 cscf->resolver = NULL;
426 return NGX_CONF_OK;
427 }
428
425429 ngx_memzero(&u, sizeof(ngx_url_t));
426430
427431 u.host = value[1];
434438
435439 cscf->resolver = ngx_resolver_create(&u.addrs[0], cf->cycle->new_log);
436440 if (cscf->resolver == NULL) {
437 return NGX_OK;
441 return NGX_CONF_OK;
438442 }
439443
440444 return NGX_CONF_OK;
5353 ngx_resolver_ctx_t *ctx;
5454 ngx_mail_core_srv_conf_t *cscf;
5555
56 cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
57
58 if (cscf->resolver == NULL) {
59 s->host = smtp_unavailable;
60 ngx_mail_smtp_greeting(s, c);
61 return;
62 }
63
5664 c->log->action = "in resolving client address";
57
58 cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
5965
6066 ctx = ngx_resolve_start(cscf->resolver, NULL);
6167 if (ctx == NULL) {
157157
158158 cscf = ngx_mail_conf_get_module_srv_conf(cf, ngx_mail_core_module);
159159
160 if (cscf->protocol->type == NGX_MAIL_SMTP_PROTOCOL
161 && cscf->resolver == NULL)
162 {
163 ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
164 "undefined resolver for server in %s:%ui",
165 cscf->file_name, cscf->line);
166 return NGX_CONF_ERROR;
167 }
168
169160 size = sizeof("220 ESMTP ready" CRLF) - 1 + cscf->server_name.len;
170161
171162 p = ngx_palloc(cf->pool, size);