summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>1999-11-16 22:52:56 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>1999-11-16 22:52:56 +0000
commit27966a0bd6a7b397f1ebdc9a912477dd23dc223f (patch)
tree6962370fe89b7bb5894ad33147566cdaae7af5b4 /usr.bin
parent4801565298dead76938c1aae65a3a67469c3a17b (diff)
close-on-exec for auth-socket, ok deraadt
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/authfd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.bin/ssh/authfd.c b/usr.bin/ssh/authfd.c
index 99478e7a054..34c68711c39 100644
--- a/usr.bin/ssh/authfd.c
+++ b/usr.bin/ssh/authfd.c
@@ -14,7 +14,7 @@ Functions for connecting the local authentication agent.
*/
#include "includes.h"
-RCSID("$Id: authfd.c,v 1.9 1999/11/15 20:53:24 markus Exp $");
+RCSID("$Id: authfd.c,v 1.10 1999/11/16 22:52:55 markus Exp $");
#include "ssh.h"
#include "rsa.h"
@@ -45,6 +45,13 @@ ssh_get_authentication_socket()
sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock < 0)
return -1;
+
+ /* close on exec */
+ if (fcntl(sock, F_SETFD, 1) == -1)
+ {
+ close(sock);
+ return -1;
+ }
if (connect(sock, (struct sockaddr *)&sunaddr, sizeof(sunaddr)) < 0)
{