Skip to content

Commit e0130c0

Browse files
committed
fix logging from sshd-auth process on Windows
1 parent 0adbd4b commit e0130c0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

contrib/win32/win32compat/w32fd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ spawn_child_internal(const char* cmd, char *const argv[], HANDLE in, HANDLE out,
10841084
si.hStdError = err;
10851085
si.dwFlags = STARTF_USESTDHANDLES;
10861086

1087-
if (strstr(cmd, "sshd-session.exe")) {
1087+
if (strstr(cmd, "sshd-session.exe") || strstr(cmd, "sshd-auth.exe")) {
10881088
flags |= DETACHED_PROCESS;
10891089
}
10901090

sshd-auth.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,9 @@ main(int ac, char **av)
604604
OpenSSL_add_all_algorithms();
605605
#endif
606606

607+
// Windows logging handled by sending debug messages to the parent sshd process
608+
// because an unprivileged sshd-auth process cannot open a log file owned by system
609+
#ifndef WINDOWS
607610
/* If requested, redirect the logs to the specified logfile. */
608611
if (logfile != NULL) {
609612
char *cp, pid_s[32];
@@ -616,6 +619,7 @@ main(int ac, char **av)
616619
log_redirect_stderr_to(cp);
617620
free(cp);
618621
}
622+
#endif /* !WINDOWS */
619623

620624
log_init(__progname,
621625
options.log_level == SYSLOG_LEVEL_NOT_SET ?

0 commit comments

Comments
 (0)