mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-31 01:35:11 +02:00
upstream: when redirecting sshd's log output to a file, undo this
redirection after the session child process is forked(); ok dtucker@ OpenBSD-Commit-ID: 6df86dd653c91f5bc8ac1916e7680d9d24690865
This commit is contained in:
parent
183c4aaef9
commit
c8935081db
10
log.c
10
log.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: log.c,v 1.51 2018/07/27 12:03:17 markus Exp $ */
|
/* $OpenBSD: log.c,v 1.52 2020/07/03 06:46:41 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
@ -370,6 +370,14 @@ log_redirect_stderr_to(const char *logfile)
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
if (logfile == NULL) {
|
||||||
|
if (log_stderr_fd != STDERR_FILENO) {
|
||||||
|
close(log_stderr_fd);
|
||||||
|
log_stderr_fd = STDERR_FILENO;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ((fd = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0600)) == -1) {
|
if ((fd = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0600)) == -1) {
|
||||||
fprintf(stderr, "Couldn't open logfile %s: %s\n", logfile,
|
fprintf(stderr, "Couldn't open logfile %s: %s\n", logfile,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: session.c,v 1.320 2020/06/26 04:45:11 dtucker Exp $ */
|
/* $OpenBSD: session.c,v 1.321 2020/07/03 06:46:41 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
@ -1501,6 +1501,9 @@ child_close_fds(struct ssh *ssh)
|
|||||||
*/
|
*/
|
||||||
endpwent();
|
endpwent();
|
||||||
|
|
||||||
|
/* Stop directing logs to a high-numbered fd before we close it */
|
||||||
|
log_redirect_stderr_to(NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close any extra open file descriptors so that we don't have them
|
* Close any extra open file descriptors so that we don't have them
|
||||||
* hanging around in clients. Note that we want to do this after
|
* hanging around in clients. Note that we want to do this after
|
||||||
|
Loading…
x
Reference in New Issue
Block a user