libcli/named_pipe_auth: call smb_set_close_on_exec() in tstream_npa_socketpair()
authorStefan Metzmacher <metze@samba.org>
Fri, 5 Jun 2015 07:40:19 +0000 (09:40 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 5 Jun 2015 12:33:19 +0000 (14:33 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11312

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
libcli/named_pipe_auth/npa_tstream.c

index 3539202127504a58d0414b5247271a42ce65f7db..20ae3de815486117bbcbc9a120f699828efd16c2 100644 (file)
@@ -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;