[nginx] svn commit: r4854 - in branches/stable-1.2: . src/mail

mdounin at mdounin.ru mdounin at mdounin.ru
Mon Sep 24 18:58:13 UTC 2012


Author: mdounin
Date: 2012-09-24 18:58:13 +0000 (Mon, 24 Sep 2012)
New Revision: 4854
URL: http://trac.nginx.org/nginx/changeset/4854/nginx

Log:
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.


Modified:
   branches/stable-1.2/
   branches/stable-1.2/src/mail/ngx_mail.c
   branches/stable-1.2/src/mail/ngx_mail_auth_http_module.c
   branches/stable-1.2/src/mail/ngx_mail_core_module.c
   branches/stable-1.2/src/mail/ngx_mail_handler.c

Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2	2012-09-24 18:54:28 UTC (rev 4853)
+++ branches/stable-1.2	2012-09-24 18:58:13 UTC (rev 4854)

Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4812,4816,4822,4824,4830-4832,4834,4840,4842-4844
+/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4814,4816,4818-4820,4822-4824,4830-4832,4834,4840,4842-4844
\ No newline at end of property
Modified: branches/stable-1.2/src/mail/ngx_mail.c
===================================================================
--- branches/stable-1.2/src/mail/ngx_mail.c	2012-09-24 18:54:28 UTC (rev 4853)
+++ branches/stable-1.2/src/mail/ngx_mail.c	2012-09-24 18:58:13 UTC (rev 4854)
@@ -263,6 +263,12 @@
         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 @@
         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;

Modified: branches/stable-1.2/src/mail/ngx_mail_auth_http_module.c
===================================================================
--- branches/stable-1.2/src/mail/ngx_mail_auth_http_module.c	2012-09-24 18:54:28 UTC (rev 4853)
+++ branches/stable-1.2/src/mail/ngx_mail_auth_http_module.c	2012-09-24 18:58:13 UTC (rev 4854)
@@ -1332,7 +1332,7 @@
 
         if (conf->peer == NULL) {
             ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
-                          "no \"http_auth\" is defined for server in %s:%ui",
+                          "no \"auth_http\" is defined for server in %s:%ui",
                           conf->file, conf->line);
 
             return NGX_CONF_ERROR;

Modified: branches/stable-1.2/src/mail/ngx_mail_core_module.c
===================================================================
--- branches/stable-1.2/src/mail/ngx_mail_core_module.c	2012-09-24 18:54:28 UTC (rev 4853)
+++ branches/stable-1.2/src/mail/ngx_mail_core_module.c	2012-09-24 18:58:13 UTC (rev 4854)
@@ -340,6 +340,14 @@
             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 @@
     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;
+                }
             }
         }
     }

Modified: branches/stable-1.2/src/mail/ngx_mail_handler.c
===================================================================
--- branches/stable-1.2/src/mail/ngx_mail_handler.c	2012-09-24 18:54:28 UTC (rev 4853)
+++ branches/stable-1.2/src/mail/ngx_mail_handler.c	2012-09-24 18:58:13 UTC (rev 4854)
@@ -38,8 +38,6 @@
 
     /* find the server configuration for the address:port */
 
-    /* AF_INET only */
-
     port = c->listening->servers;
 
     if (port->naddrs > 1) {



More information about the nginx-devel mailing list