Mercurial > dovecot > core-2.2
changeset 9844:4efd13c0f778 HEAD
auth: Use net_getunixname() instead of implementing it ourself.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 31 Aug 2009 17:04:37 -0400 |
parents | 95fba8612a87 |
children | f5dcc960ab7a |
files | src/auth/main.c |
diffstat | 1 files changed, 3 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/main.c Mon Aug 31 17:04:27 2009 -0400 +++ b/src/auth/main.c Mon Aug 31 17:04:37 2009 -0400 @@ -124,23 +124,16 @@ static void client_connected(const struct master_service_connection *conn) { enum auth_socket_type *type; + const char *name, *suffix; type = array_idx_modifiable(&listen_fd_types, conn->listen_fd); if (*type == AUTH_SOCKET_UNKNOWN) { /* figure out if this is a server or network socket by checking the socket path name. */ - struct sockaddr_un sa; - socklen_t addrlen = sizeof(sa); - const char *suffix; - - if (getsockname(conn->listen_fd, (void *)&sa, &addrlen) < 0) + if (net_getunixname(conn->listen_fd, &name) < 0) i_fatal("getsockname(%d) failed: %m", conn->listen_fd); - if (sa.sun_family != AF_UNIX) { - i_fatal("getsockname(%d) isn't UNIX socket", - conn->listen_fd); - } - suffix = strrchr(sa.sun_path, '-'); + suffix = strrchr(name, '-'); if (suffix == NULL) *type = AUTH_SOCKET_CLIENT; else {