diff src/mail/ngx_mail.c @ 4853:0b0ddfdbdd7b stable-1.2

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 24 Sep 2012 18:58:13 +0000
parents d620f497c50f
children
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;
@@ -539,6 +545,11 @@ ngx_mail_cmp_conf_addrs(const void *one,
         return 1;
     }
 
+    if (second->wildcard) {
+        /* a wildcard must be the last resort, shift it to the end */
+        return -1;
+    }
+
     if (first->bind && !second->bind) {
         /* shift explicit bind()ed addresses to the start */
         return -1;