Ensure "listen" exists in a mail or stream server (ticket #1049).
Roman Arutyunyan
5 years ago
123 | 123 | |
124 | 124 | /* server ctx */ |
125 | 125 | ngx_mail_conf_ctx_t *ctx; |
126 | ||
127 | ngx_uint_t listen; /* unsigned listen:1; */ | |
126 | 128 | } ngx_mail_core_srv_conf_t; |
127 | 129 | |
128 | 130 |
278 | 278 | |
279 | 279 | *cf = pcf; |
280 | 280 | |
281 | if (rv == NGX_CONF_OK && !cscf->listen) { | |
282 | ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | |
283 | "no \"listen\" is defined for server in %s:%ui", | |
284 | cscf->file_name, cscf->line); | |
285 | return NGX_CONF_ERROR; | |
286 | } | |
287 | ||
281 | 288 | return rv; |
282 | 289 | } |
283 | 290 | |
294 | 301 | ngx_mail_module_t *module; |
295 | 302 | ngx_mail_core_main_conf_t *cmcf; |
296 | 303 | |
304 | cscf->listen = 1; | |
305 | ||
297 | 306 | value = cf->args->elts; |
298 | 307 | |
299 | 308 | ngx_memzero(&u, sizeof(ngx_url_t)); |
143 | 143 | |
144 | 144 | ngx_msec_t resolver_timeout; |
145 | 145 | ngx_resolver_t *resolver; |
146 | ||
147 | ngx_uint_t listen; /* unsigned listen:1; */ | |
146 | 148 | } ngx_stream_core_srv_conf_t; |
147 | 149 | |
148 | 150 |
324 | 324 | |
325 | 325 | *cf = pcf; |
326 | 326 | |
327 | if (rv == NGX_CONF_OK && !cscf->listen) { | |
328 | ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | |
329 | "no \"listen\" is defined for server in %s:%ui", | |
330 | cscf->file_name, cscf->line); | |
331 | return NGX_CONF_ERROR; | |
332 | } | |
333 | ||
327 | 334 | return rv; |
328 | 335 | } |
329 | 336 | |
331 | 338 | static char * |
332 | 339 | ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
333 | 340 | { |
341 | ngx_stream_core_srv_conf_t *cscf = conf; | |
342 | ||
334 | 343 | ngx_str_t *value; |
335 | 344 | ngx_url_t u; |
336 | 345 | ngx_uint_t i, backlog; |
337 | 346 | ngx_stream_listen_t *ls, *als; |
338 | 347 | ngx_stream_core_main_conf_t *cmcf; |
348 | ||
349 | cscf->listen = 1; | |
339 | 350 | |
340 | 351 | value = cf->args->elts; |
341 | 352 |