summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--sshd.c11
2 files changed, 9 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index b67c1bc2d..ee3ede1b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,10 @@
9 - djm@cvs.openbsd.org 2013/10/10 00:53:25 9 - djm@cvs.openbsd.org 2013/10/10 00:53:25
10 [sftp-server.c] 10 [sftp-server.c]
11 add -Q, -P and -p to usage() before jmc@ catches me 11 add -Q, -P and -p to usage() before jmc@ catches me
12 - djm@cvs.openbsd.org 2013/10/10 01:43:03
13 [sshd.c]
14 bz#2139: fix re-exec fallback by ensuring that startup_pipe is correctly
15 updated; ok dtucker@
12 16
1320131010 1720131010
14 - (dtucker) OpenBSD CVS Sync 18 - (dtucker) OpenBSD CVS Sync
diff --git a/sshd.c b/sshd.c
index 7e3b60f9f..287706d47 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshd.c,v 1.406 2013/09/02 22:00:34 deraadt Exp $ */ 1/* $OpenBSD: sshd.c,v 1.407 2013/10/10 01:43:03 djm 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
@@ -1940,13 +1940,14 @@ main(int ac, char **av)
1940 dup2(STDIN_FILENO, STDOUT_FILENO); 1940 dup2(STDIN_FILENO, STDOUT_FILENO);
1941 if (startup_pipe == -1) 1941 if (startup_pipe == -1)
1942 close(REEXEC_STARTUP_PIPE_FD); 1942 close(REEXEC_STARTUP_PIPE_FD);
1943 else 1943 else if (startup_pipe != REEXEC_STARTUP_PIPE_FD) {
1944 dup2(startup_pipe, REEXEC_STARTUP_PIPE_FD); 1944 dup2(startup_pipe, REEXEC_STARTUP_PIPE_FD);
1945 close(startup_pipe);
1946 startup_pipe = REEXEC_STARTUP_PIPE_FD;
1947 }
1945 1948
1946 dup2(config_s[1], REEXEC_CONFIG_PASS_FD); 1949 dup2(config_s[1], REEXEC_CONFIG_PASS_FD);
1947 close(config_s[1]); 1950 close(config_s[1]);
1948 if (startup_pipe != -1)
1949 close(startup_pipe);
1950 1951
1951 execv(rexec_argv[0], rexec_argv); 1952 execv(rexec_argv[0], rexec_argv);
1952 1953
@@ -1957,8 +1958,6 @@ main(int ac, char **av)
1957 options.log_facility, log_stderr); 1958 options.log_facility, log_stderr);
1958 1959
1959 /* Clean up fds */ 1960 /* Clean up fds */
1960 startup_pipe = REEXEC_STARTUP_PIPE_FD;
1961 close(config_s[1]);
1962 close(REEXEC_CONFIG_PASS_FD); 1961 close(REEXEC_CONFIG_PASS_FD);
1963 newsock = sock_out = sock_in = dup(STDIN_FILENO); 1962 newsock = sock_out = sock_in = dup(STDIN_FILENO);
1964 if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { 1963 if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {