diff options
author | Anoop C S <anoopcs@redhat.com> | 2016-08-11 20:24:54 +0530 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2016-08-12 08:30:40 +0200 |
commit | 3eee8df6964fdca0d22967a5c8d65f934e935f34 (patch) | |
tree | 8ccceda1830c027476c003b2db95344d28da576d /src | |
parent | 92788865b636237f761ebd57d02fad0f3c9e03cd (diff) | |
download | socket_wrapper-3eee8df6964fdca0d22967a5c8d65f934e935f34.tar.gz socket_wrapper-3eee8df6964fdca0d22967a5c8d65f934e935f34.tar.xz socket_wrapper-3eee8df6964fdca0d22967a5c8d65f934e935f34.zip |
swrap: Delay addition of child socket_info_fd into socket_info list
In swrap_accept() we used to add new child socket_info_fd[child_fi]
into newly created child socket_info struture[child_si] without
considering the fact that we may return early in case of errors from
subsequent calls to libc_getsockname() and sockaddr_convert_from_un()
during which we free child_fi and child_si and return. So it is better
to delay the addition of child_fi into child_si->fds until child_si
is completely initialized.
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/socket_wrapper.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index b11e4a9..00518c1 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -2682,8 +2682,6 @@ static int swrap_accept(int s, child_fi->fd = fd; - SWRAP_DLIST_ADD(child_si->fds, child_fi); - child_si->family = parent_si->family; child_si->type = parent_si->type; child_si->protocol = parent_si->protocol; @@ -2736,6 +2734,7 @@ static int swrap_accept(int s, }; memcpy(&child_si->myname.sa.ss, &in_my_addr.sa.ss, in_my_addr.sa_socklen); + SWRAP_DLIST_ADD(child_si->fds, child_fi); SWRAP_DLIST_ADD(sockets, child_si); if (addr != NULL) { |