From 53b8514f2d1b6a5616344cd12ab7898f1e3e6747 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Fri, 17 Aug 2012 05:21:28 +0000 Subject: [PATCH] Mail: fixed handling of AF_UNIX addresses in "listen". This makes AF_UNIX addresses in mail officially supported. --- src/mail/ngx_mail.c | 6 ++++++ src/mail/ngx_mail_core_module.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/src/mail/ngx_mail.c b/src/mail/ngx_mail.c index b097778db..3812e1517 100644 --- a/src/mail/ngx_mail.c +++ b/src/mail/ngx_mail.c @@ -263,6 +263,12 @@ ngx_mail_add_ports(ngx_conf_t *cf, ngx_array_t *ports, break; #endif +#if (NGX_HAVE_UNIX_DOMAIN) + case AF_UNIX: + p = 0; + break; +#endif + default: /* AF_INET */ sin = (struct sockaddr_in *) sa; p = sin->sin_port; diff --git a/src/mail/ngx_mail_core_module.c b/src/mail/ngx_mail_core_module.c index ecb722994..86d0b3bee 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;