1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

source3/libsmb/unexpected.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 <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Gary Lockyer 2017-12-11 09:54:34 +13:00 committed by Andrew Bartlett
parent 92e801aad5
commit 40877f3e8a

View File

@ -157,6 +157,7 @@ static void nb_packet_server_listener(struct tevent_context *ev,
if (sock == -1) {
return;
}
smb_set_close_on_exec(sock);
DEBUG(6,("accepted socket %d\n", sock));
client = talloc_zero(server, struct nb_packet_client);