From: Gary Lockyer Date: Sun, 10 Dec 2017 20:51:35 +0000 (+1300) Subject: source3/smbd/server.c set socket close on exec X-Git-Tag: talloc-2.1.11~148 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=92e801aad5aec25d0aeb3b016b02d85642ed3269;p=thirdparty%2Fsamba.git source3/smbd/server.c set socket close on exec Set SOCKET_CLOEXEC on the sockets returned by accept. This ensures that the socket is unavailable to any child process created by system(). Making it harder for malicious code to set up a command channel, as seen in the exploit for CVE-2015-0240 Signed-off-by: Gary Lockyer Reviewed-by: Andrew Bartlett --- diff --git a/source3/smbd/server.c b/source3/smbd/server.c index f8c1aa65744..79786d68853 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -975,6 +975,7 @@ static void smbd_accept_connection(struct tevent_context *ev, strerror(errno))); return; } + smb_set_close_on_exec(fd); if (s->parent->interactive) { reinit_after_fork(msg_ctx, ev, true, NULL);