diff options
| author | Vladimir Homutov <vl@nginx.com> | 2013-07-11 16:07:25 +0400 |
|---|---|---|
| committer | Vladimir Homutov <vl@nginx.com> | 2013-07-11 16:07:25 +0400 |
| commit | af18946d769296d9efead825a0d1aa6a1a41fe74 (patch) | |
| tree | 6b34cebcacea394e0126bcff647a3e73ab25c36d /src/mail | |
| parent | 050f74b751c10eeb2491ec6509d0508a7e690209 (diff) | |
| download | nginx-af18946d769296d9efead825a0d1aa6a1a41fe74.tar.gz nginx-af18946d769296d9efead825a0d1aa6a1a41fe74.tar.bz2 | |
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.
Diffstat (limited to 'src/mail')
| -rw-r--r-- | src/mail/ngx_mail.c | 6 | ||||
| -rw-r--r-- | src/mail/ngx_mail_core_module.c | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/mail/ngx_mail.c b/src/mail/ngx_mail.c index 3812e1517..b0da78605 100644 --- a/src/mail/ngx_mail.c +++ b/src/mail/ngx_mail.c @@ -465,7 +465,8 @@ ngx_mail_add_addrs(ngx_conf_t *cf, ngx_mail_port_t *mport, addrs[i].conf.ssl = addr[i].ssl; #endif - len = ngx_sock_ntop(addr[i].sockaddr, buf, NGX_SOCKADDR_STRLEN, 1); + len = ngx_sock_ntop(addr[i].sockaddr, addr[i].socklen , buf, + NGX_SOCKADDR_STRLEN, 1); p = ngx_pnalloc(cf->pool, len); if (p == NULL) { @@ -513,7 +514,8 @@ ngx_mail_add_addrs6(ngx_conf_t *cf, ngx_mail_port_t *mport, addrs6[i].conf.ssl = addr[i].ssl; #endif - len = ngx_sock_ntop(addr[i].sockaddr, buf, NGX_SOCKADDR_STRLEN, 1); + len = ngx_sock_ntop(addr[i].sockaddr, addr[i].socklen, buf, + NGX_SOCKADDR_STRLEN, 1); p = ngx_pnalloc(cf->pool, len); if (p == NULL) { diff --git a/src/mail/ngx_mail_core_module.c b/src/mail/ngx_mail_core_module.c index be8673c29..4ee7c8dc3 100644 --- a/src/mail/ngx_mail_core_module.c +++ b/src/mail/ngx_mail_core_module.c @@ -439,7 +439,8 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ls->bind = 1; } else { - len = ngx_sock_ntop(sa, buf, NGX_SOCKADDR_STRLEN, 1); + len = ngx_sock_ntop(sa, ls->socklen, buf, + NGX_SOCKADDR_STRLEN, 1); ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "ipv6only is not supported " |
