comparison src/mail/ngx_mail_core_module.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 14411ee4d89f
children
comparison
equal deleted inserted replaced
4852:9be0b6b749ae 4853:0b0ddfdbdd7b
338 sin6 = (struct sockaddr_in6 *) sa; 338 sin6 = (struct sockaddr_in6 *) sa;
339 port = sin6->sin6_port; 339 port = sin6->sin6_port;
340 break; 340 break;
341 #endif 341 #endif
342 342
343 #if (NGX_HAVE_UNIX_DOMAIN)
344 case AF_UNIX:
345 off = offsetof(struct sockaddr_un, sun_path);
346 len = sizeof(((struct sockaddr_un *) sa)->sun_path);
347 port = 0;
348 break;
349 #endif
350
343 default: /* AF_INET */ 351 default: /* AF_INET */
344 off = offsetof(struct sockaddr_in, sin_addr); 352 off = offsetof(struct sockaddr_in, sin_addr);
345 len = 4; 353 len = 4;
346 sin = (struct sockaddr_in *) sa; 354 sin = (struct sockaddr_in *) sa;
347 port = sin->sin_port; 355 port = sin->sin_port;
372 380
373 ls->socklen = u.socklen; 381 ls->socklen = u.socklen;
374 ls->wildcard = u.wildcard; 382 ls->wildcard = u.wildcard;
375 ls->ctx = cf->ctx; 383 ls->ctx = cf->ctx;
376 384
377 for (m = 0; ngx_modules[m]; m++) { 385 if (cscf->protocol == NULL) {
378 if (ngx_modules[m]->type != NGX_MAIL_MODULE) { 386 for (m = 0; ngx_modules[m]; m++) {
379 continue; 387 if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
380 } 388 continue;
381 389 }
382 module = ngx_modules[m]->ctx; 390
383 391 module = ngx_modules[m]->ctx;
384 if (module->protocol == NULL) { 392
385 continue; 393 if (module->protocol == NULL) {
386 } 394 continue;
387 395 }
388 for (i = 0; module->protocol->port[i]; i++) { 396
389 if (module->protocol->port[i] == u.port) { 397 for (i = 0; module->protocol->port[i]; i++) {
390 cscf->protocol = module->protocol; 398 if (module->protocol->port[i] == u.port) {
391 break; 399 cscf->protocol = module->protocol;
400 break;
401 }
392 } 402 }
393 } 403 }
394 } 404 }
395 405
396 for (i = 2; i < cf->args->nelts; i++) { 406 for (i = 2; i < cf->args->nelts; i++) {