Mail: fixed handling of AF_UNIX addresses in "listen".

This makes AF_UNIX addresses in mail officially supported.
This commit is contained in:
Ruslan Ermilov 2012-08-17 05:21:28 +00:00
parent b0c8df479b
commit f33eb8c971
2 changed files with 14 additions and 0 deletions

View file

@ -263,6 +263,12 @@ ngx_mail_add_ports(ngx_conf_t *cf, ngx_array_t *ports,
break; break;
#endif #endif
#if (NGX_HAVE_UNIX_DOMAIN)
case AF_UNIX:
p = 0;
break;
#endif
default: /* AF_INET */ default: /* AF_INET */
sin = (struct sockaddr_in *) sa; sin = (struct sockaddr_in *) sa;
p = sin->sin_port; p = sin->sin_port;

View file

@ -340,6 +340,14 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
break; break;
#endif #endif
#if (NGX_HAVE_UNIX_DOMAIN)
case AF_UNIX:
off = offsetof(struct sockaddr_un, sun_path);
len = sizeof(((struct sockaddr_un *) sa)->sun_path);
port = 0;
break;
#endif
default: /* AF_INET */ default: /* AF_INET */
off = offsetof(struct sockaddr_in, sin_addr); off = offsetof(struct sockaddr_in, sin_addr);
len = 4; len = 4;