Klaus Demo nginx / 9288e65
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. Maxim Dounin 9 years ago
4 changed file(s) with 37 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
262262 break;
263263 #endif
264264
265 #if (NGX_HAVE_UNIX_DOMAIN)
266 case AF_UNIX:
267 p = 0;
268 break;
269 #endif
270
265271 default: /* AF_INET */
266272 sin = (struct sockaddr_in *) sa;
267273 p = sin->sin_port;
538544 return 1;
539545 }
540546
547 if (second->wildcard) {
548 /* a wildcard must be the last resort, shift it to the end */
549 return -1;
550 }
551
541552 if (first->bind && !second->bind) {
542553 /* shift explicit bind()ed addresses to the start */
543554 return -1;
13311331
13321332 if (conf->peer == NULL) {
13331333 ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
1334 "no \"http_auth\" is defined for server in %s:%ui",
1334 "no \"auth_http\" is defined for server in %s:%ui",
13351335 conf->file, conf->line);
13361336
13371337 return NGX_CONF_ERROR;
339339 break;
340340 #endif
341341
342 #if (NGX_HAVE_UNIX_DOMAIN)
343 case AF_UNIX:
344 off = offsetof(struct sockaddr_un, sun_path);
345 len = sizeof(((struct sockaddr_un *) sa)->sun_path);
346 port = 0;
347 break;
348 #endif
349
342350 default: /* AF_INET */
343351 off = offsetof(struct sockaddr_in, sin_addr);
344352 len = 4;
373381 ls->wildcard = u.wildcard;
374382 ls->ctx = cf->ctx;
375383
376 for (m = 0; ngx_modules[m]; m++) {
377 if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
378 continue;
379 }
380
381 module = ngx_modules[m]->ctx;
382
383 if (module->protocol == NULL) {
384 continue;
385 }
386
387 for (i = 0; module->protocol->port[i]; i++) {
388 if (module->protocol->port[i] == u.port) {
389 cscf->protocol = module->protocol;
390 break;
384 if (cscf->protocol == NULL) {
385 for (m = 0; ngx_modules[m]; m++) {
386 if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
387 continue;
388 }
389
390 module = ngx_modules[m]->ctx;
391
392 if (module->protocol == NULL) {
393 continue;
394 }
395
396 for (i = 0; module->protocol->port[i]; i++) {
397 if (module->protocol->port[i] == u.port) {
398 cscf->protocol = module->protocol;
399 break;
400 }
391401 }
392402 }
393403 }
3737
3838 /* find the server configuration for the address:port */
3939
40 /* AF_INET only */
41
4240 port = c->listening->servers;
4341
4442 if (port->naddrs > 1) {