]> git.kaiwu.me - nginx.git/commitdiff
mail_core: don't let the well-known port in the "listen" directive to
authorRuslan Ermilov <ru@nginx.com>
Wed, 15 Aug 2012 11:30:24 +0000 (11:30 +0000)
committerRuslan Ermilov <ru@nginx.com>
Wed, 15 Aug 2012 11:30:24 +0000 (11:30 +0000)
override the already set "protocol".

src/mail/ngx_mail_core_module.c

index f0dee7283c634cf97defca0b5fac5a37b5894a1f..ecb7229941273eec29b22a647e25875a2c6f30f9 100644 (file)
@@ -378,21 +378,23 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
     ls->ipv6only = 1;
 #endif
 
-    for (m = 0; ngx_modules[m]; m++) {
-        if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
-            continue;
-        }
-
-        module = ngx_modules[m]->ctx;
-
-        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;
+    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;
+    
+            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;
+                }
             }
         }
     }