From 7d929c2954b34d4cdcd8524857d8999e04d0038c Mon Sep 17 00:00:00 2001 From: bagajjal Date: Sun, 7 May 2017 22:51:24 -0700 Subject: [PATCH] Fix sshd logging (#128) PowerShell/Win32-OpenSSH#709 https://github.com/PowerShell/Win32-OpenSSH/issues/708 --- contrib/win32/win32compat/w32-sshfileperm.c | 2 +- sshd.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/contrib/win32/win32compat/w32-sshfileperm.c b/contrib/win32/win32compat/w32-sshfileperm.c index 350db5cc0..1191c6638 100644 --- a/contrib/win32/win32compat/w32-sshfileperm.c +++ b/contrib/win32/win32compat/w32-sshfileperm.c @@ -181,7 +181,7 @@ check_secure_file_permission(const char *name, struct passwd * pw) } cleanup: if(bad_user) - free(bad_user); + LocalFree(bad_user); if (pSD) LocalFree(pSD); if (user_sid) diff --git a/sshd.c b/sshd.c index dda48392f..f20a9b6ee 100644 --- a/sshd.c +++ b/sshd.c @@ -1674,6 +1674,14 @@ main(int ac, char **av) /* Fill in default values for those options not explicitly set. */ fill_default_server_options(&options); +#ifdef WINDOWS + /* + * For windows, enable logging right away to capture failures while loading private host keys. + * On Unix, logging at configured level is not done until private host keys are loaded. Why?? + */ + log_init(__progname, options.log_level, options.log_facility, log_stderr); +#endif // WINDOWS + /* challenge-response is implemented via keyboard interactive */ if (options.challenge_response_authentication) options.kbd_interactive_authentication = 1;