diff options
| author | Maxim Dounin <mdounin@mdounin.ru> | 2012-09-24 18:58:13 +0000 |
|---|---|---|
| committer | Maxim Dounin <mdounin@mdounin.ru> | 2012-09-24 18:58:13 +0000 |
| commit | 9288e6587b2b7e50d81425a0c101adf4182c70fb (patch) | |
| tree | 9101b53f29f483b7aa3dd93c82c66e2458b5168b /src/mail/ngx_mail_core_module.c | |
| parent | 191e31938e81f2a59a4ba4dc6b3f4f28bc232187 (diff) | |
| download | nginx-9288e6587b2b7e50d81425a0c101adf4182c70fb.tar.gz nginx-9288e6587b2b7e50d81425a0c101adf4182c70fb.tar.bz2 | |
Merge of r4813, r4814, r4818, r4819, r4820, r4823: mail fixes.
*) Corrected the directive name in the ngx_mail_auth_http_module
error message.
*) Don't let the well-known port in the "listen" directive to
override the already set "protocol".
*) Fixed sorting of listen addresses (ticket #187). For http module
this problem was already fixed in r4756.
*) Removed a stale "AF_INET only" comment. IPv6 client connections
in mail modules have been supported since r2856.
*) Fixed handling of AF_UNIX addresses in "listen". This makes AF_UNIX
addresses in mail officially supported.
*) Whitespace fix.
Diffstat (limited to 'src/mail/ngx_mail_core_module.c')
| -rw-r--r-- | src/mail/ngx_mail_core_module.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src/mail/ngx_mail_core_module.c b/src/mail/ngx_mail_core_module.c index f79913b0a..6509b989b 100644 --- a/src/mail/ngx_mail_core_module.c +++ b/src/mail/ngx_mail_core_module.c @@ -340,6 +340,14 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) break; #endif +#if (NGX_HAVE_UNIX_DOMAIN) + case AF_UNIX: + off = offsetof(struct sockaddr_un, sun_path); + len = sizeof(((struct sockaddr_un *) sa)->sun_path); + port = 0; + break; +#endif + default: /* AF_INET */ off = offsetof(struct sockaddr_in, sin_addr); len = 4; @@ -374,21 +382,23 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ls->wildcard = u.wildcard; ls->ctx = cf->ctx; - for (m = 0; ngx_modules[m]; m++) { - if (ngx_modules[m]->type != NGX_MAIL_MODULE) { - continue; - } + if (cscf->protocol == NULL) { + for (m = 0; ngx_modules[m]; m++) { + if (ngx_modules[m]->type != NGX_MAIL_MODULE) { + continue; + } - module = ngx_modules[m]->ctx; + module = ngx_modules[m]->ctx; - if (module->protocol == NULL) { - continue; - } + if (module->protocol == NULL) { + continue; + } - for (i = 0; module->protocol->port[i]; i++) { - if (module->protocol->port[i] == u.port) { - cscf->protocol = module->protocol; - break; + for (i = 0; module->protocol->port[i]; i++) { + if (module->protocol->port[i] == u.port) { + cscf->protocol = module->protocol; + break; + } } } } |
