summaryrefslogtreecommitdiff
path: root/sshconnect.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2010-01-08 17:07:22 +1100
committerDarren Tucker <dtucker@zip.com.au>2010-01-08 17:07:22 +1100
commit6e7fe1c01b8a69099ffc42e653cc478509e84781 (patch)
treed6636498087a2b9b4fd4651edd4e0f07788e51e1 /sshconnect.c
parentf788a91624601857c586a4dd97c66083946e7781 (diff)
- dtucker@cvs.openbsd.org 2009/11/10 04:30:45
[sshconnect2.c channels.c sshconnect.c] Set close-on-exec on various descriptors so they don't get leaked to child processes. bz #1643, patch from jchadima at redhat, ok deraadt.
Diffstat (limited to 'sshconnect.c')
-rw-r--r--sshconnect.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sshconnect.c b/sshconnect.c
index a09026e65..3c8308ffb 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect.c,v 1.215 2009/10/28 16:38:18 reyk Exp $ */ 1/* $OpenBSD: sshconnect.c,v 1.216 2009/11/10 04:30:45 dtucker Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -28,6 +28,7 @@
28 28
29#include <ctype.h> 29#include <ctype.h>
30#include <errno.h> 30#include <errno.h>
31#include <fcntl.h>
31#include <netdb.h> 32#include <netdb.h>
32#ifdef HAVE_PATHS_H 33#ifdef HAVE_PATHS_H
33#include <paths.h> 34#include <paths.h>
@@ -192,8 +193,11 @@ ssh_create_socket(int privileged, struct addrinfo *ai)
192 } 193 }
193 sock = socket_rdomain(ai->ai_family, ai->ai_socktype, ai->ai_protocol, 194 sock = socket_rdomain(ai->ai_family, ai->ai_socktype, ai->ai_protocol,
194 options.rdomain); 195 options.rdomain);
195 if (sock < 0) 196 if (sock < 0) {
196 error("socket: %.100s", strerror(errno)); 197 error("socket: %.100s", strerror(errno));
198 return -1;
199 }
200 fcntl(sock, F_SETFD, FD_CLOEXEC);
197 201
198 /* Bind the socket to an alternative local IP address */ 202 /* Bind the socket to an alternative local IP address */
199 if (options.bind_address == NULL) 203 if (options.bind_address == NULL)