changeset 4819:49a3fb31a05c

Mail: fixed handling of AF_UNIX addresses in "listen". This makes AF_UNIX addresses in mail officially supported.
author Ruslan Ermilov <ru@nginx.com>
date Fri, 17 Aug 2012 05:21:28 +0000
parents 28a64967e891
children 49d65c9364fc
files src/mail/ngx_mail.c src/mail/ngx_mail_core_module.c
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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_a
         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;
--- 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
             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;