# HG changeset patch # User Ruslan Ermilov # Date 1345030224 0 # Node ID 5c47ecaef07a275df3eb279411513dee4dd2d165 # Parent 785ae4de268b23ad1e58ee3aadd8b77a474c2bb2 mail_core: don't let the well-known port in the "listen" directive to override the already set "protocol". diff --git a/src/mail/ngx_mail_core_module.c b/src/mail/ngx_mail_core_module.c --- a/src/mail/ngx_mail_core_module.c +++ b/src/mail/ngx_mail_core_module.c @@ -378,21 +378,23 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx 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; + } } } }