Blame openssh-5.1p1-cloexec.patch
|
Tomáš Mráz |
93a474 |
diff -up openssh-5.1p1/sshconnect2.c.cloexec openssh-5.1p1/sshconnect2.c
|
|
Tomáš Mráz |
93a474 |
--- openssh-5.1p1/sshconnect2.c.cloexec 2008-07-23 15:21:23.000000000 +0200
|
|
Tomáš Mráz |
93a474 |
+++ openssh-5.1p1/sshconnect2.c 2008-07-23 15:23:19.000000000 +0200
|
|
Tomáš Mráz |
077dad |
@@ -38,6 +38,7 @@
|
|
Tomáš Mráz |
077dad |
#include <stdio.h>
|
|
Tomáš Mráz |
077dad |
#include <string.h>
|
|
Tomáš Mráz |
077dad |
#include <unistd.h>
|
|
Tomáš Mráz |
077dad |
+#include <fcntl.h>
|
|
Tomáš Mráz |
93a474 |
#if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H)
|
|
Tomáš Mráz |
93a474 |
#include <vis.h>
|
|
Tomáš Mráz |
93a474 |
#endif
|
|
Tomáš Mráz |
93a474 |
@@ -1267,6 +1268,7 @@ ssh_keysign(Key *key, u_char **sigp, u_i
|
|
Tomáš Mráz |
077dad |
return -1;
|
|
Tomáš Mráz |
077dad |
}
|
|
Tomáš Mráz |
077dad |
if (pid == 0) {
|
|
Tomáš Mráz |
077dad |
+ fcntl(packet_get_connection_in(), F_SETFD, 0); /* keep the socket on exec */
|
|
Tomáš Mráz |
077dad |
permanently_drop_suid(getuid());
|
|
Tomáš Mráz |
077dad |
close(from[0]);
|
|
Tomáš Mráz |
077dad |
if (dup2(from[1], STDOUT_FILENO) < 0)
|
|
Tomáš Mráz |
93a474 |
diff -up openssh-5.1p1/sshconnect.c.cloexec openssh-5.1p1/sshconnect.c
|
|
Tomáš Mráz |
93a474 |
--- openssh-5.1p1/sshconnect.c.cloexec 2008-07-02 14:34:30.000000000 +0200
|
|
Tomáš Mráz |
93a474 |
+++ openssh-5.1p1/sshconnect.c 2008-07-23 15:21:23.000000000 +0200
|
|
Tomáš Mráz |
2cb0e7 |
@@ -38,6 +38,7 @@
|
|
Tomáš Mráz |
2cb0e7 |
#include <stdlib.h>
|
|
Tomáš Mráz |
2cb0e7 |
#include <string.h>
|
|
Tomáš Mráz |
2cb0e7 |
#include <unistd.h>
|
|
Tomáš Mráz |
2cb0e7 |
+#include <fcntl.h>
|
|
Tomáš Mráz |
2cb0e7 |
|
|
Tomáš Mráz |
2cb0e7 |
#include "xmalloc.h"
|
|
Tomáš Mráz |
2cb0e7 |
#include "key.h"
|
|
Tomáš Mráz |
93a474 |
@@ -194,8 +195,11 @@ ssh_create_socket(int privileged, struct
|
|
Tomáš Mráz |
2cb0e7 |
return sock;
|
|
Tomáš Mráz |
2cb0e7 |
}
|
|
Tomáš Mráz |
2cb0e7 |
sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
|
|
Tomáš Mráz |
2cb0e7 |
- if (sock < 0)
|
|
Tomáš Mráz |
2cb0e7 |
+ if (sock < 0) {
|
|
Tomáš Mráz |
2cb0e7 |
error("socket: %.100s", strerror(errno));
|
|
Tomáš Mráz |
2cb0e7 |
+ return -1;
|
|
Tomáš Mráz |
2cb0e7 |
+ }
|
|
Tomáš Mráz |
2cb0e7 |
+ fcntl(sock, F_SETFD, FD_CLOEXEC);
|
|
Tomáš Mráz |
2cb0e7 |
|
|
Tomáš Mráz |
2cb0e7 |
/* Bind the socket to an alternative local IP address */
|
|
Tomáš Mráz |
2cb0e7 |
if (options.bind_address == NULL)
|