comparison src/mail/ngx_mail.c @ 5263:05ba5bce31e0

Core: extended ngx_sock_ntop() with socklen parameter. On Linux, sockaddr length is required to process unix socket addresses properly due to unnamed sockets (which don't have sun_path set at all) and abstract namespace sockets.
author Vladimir Homutov <vl@nginx.com>
date Thu, 11 Jul 2013 16:07:25 +0400
parents 49a3fb31a05c
children 8e7db77e5d88
comparison
equal deleted inserted replaced
5262:626f288fa5ed 5263:05ba5bce31e0
463 addrs[i].conf.ctx = addr[i].ctx; 463 addrs[i].conf.ctx = addr[i].ctx;
464 #if (NGX_MAIL_SSL) 464 #if (NGX_MAIL_SSL)
465 addrs[i].conf.ssl = addr[i].ssl; 465 addrs[i].conf.ssl = addr[i].ssl;
466 #endif 466 #endif
467 467
468 len = ngx_sock_ntop(addr[i].sockaddr, buf, NGX_SOCKADDR_STRLEN, 1); 468 len = ngx_sock_ntop(addr[i].sockaddr, addr[i].socklen , buf,
469 NGX_SOCKADDR_STRLEN, 1);
469 470
470 p = ngx_pnalloc(cf->pool, len); 471 p = ngx_pnalloc(cf->pool, len);
471 if (p == NULL) { 472 if (p == NULL) {
472 return NGX_ERROR; 473 return NGX_ERROR;
473 } 474 }
511 addrs6[i].conf.ctx = addr[i].ctx; 512 addrs6[i].conf.ctx = addr[i].ctx;
512 #if (NGX_MAIL_SSL) 513 #if (NGX_MAIL_SSL)
513 addrs6[i].conf.ssl = addr[i].ssl; 514 addrs6[i].conf.ssl = addr[i].ssl;
514 #endif 515 #endif
515 516
516 len = ngx_sock_ntop(addr[i].sockaddr, buf, NGX_SOCKADDR_STRLEN, 1); 517 len = ngx_sock_ntop(addr[i].sockaddr, addr[i].socklen, buf,
518 NGX_SOCKADDR_STRLEN, 1);
517 519
518 p = ngx_pnalloc(cf->pool, len); 520 p = ngx_pnalloc(cf->pool, len);
519 if (p == NULL) { 521 if (p == NULL) {
520 return NGX_ERROR; 522 return NGX_ERROR;
521 } 523 }