From fcf0d3ebefa5be809a0dd082055888ed99a5c003 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 5 Jun 2015 09:40:19 +0200 Subject: [PATCH] libcli/named_pipe_auth: call smb_set_close_on_exec() in tstream_npa_socketpair() BUG: https://bugzilla.samba.org/show_bug.cgi?id=11312 Signed-off-by: Stefan Metzmacher Reviewed-by: Volker Lendecke --- libcli/named_pipe_auth/npa_tstream.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libcli/named_pipe_auth/npa_tstream.c b/libcli/named_pipe_auth/npa_tstream.c index 35392021275..20ae3de8154 100644 --- a/libcli/named_pipe_auth/npa_tstream.c +++ b/libcli/named_pipe_auth/npa_tstream.c @@ -1460,6 +1460,7 @@ int _tstream_npa_socketpair(uint16_t file_type, int fd1; int fd2; int rc; + bool ok; rc = socketpair(AF_UNIX, SOCK_STREAM, 0, fds); if (rc == -1) { @@ -1468,6 +1469,16 @@ int _tstream_npa_socketpair(uint16_t file_type, fd1 = fds[0]; fd2 = fds[1]; + ok = smb_set_close_on_exec(fd1); + if (!ok) { + goto close_fail; + } + + ok = smb_set_close_on_exec(fd2); + if (!ok) { + goto close_fail; + } + rc = set_blocking(fd1, false); if (rc == -1) { goto close_fail; -- 2.11.4.GIT