From 0e1f1c1cb3d84df4086825130e21087186d99f2d Mon Sep 17 00:00:00 2001 From: Manoj Ampalam Date: Thu, 10 Mar 2016 15:18:09 -0800 Subject: [PATCH] sshd enabling changes --- auth.c | 2 +- contrib/win32/openssh/Win32-OpenSSH.sln | 3 ++- contrib/win32/openssh/sshd.vcxproj | 12 ++++++++---- contrib/win32/win32compat/inc/w32posix.h | 2 +- contrib/win32/win32compat/startupneeds.c | 2 +- serverloop.c | 5 +++-- session.c | 17 +++++++++-------- sshd.c | 10 ++++++---- 8 files changed, 31 insertions(+), 22 deletions(-) diff --git a/auth.c b/auth.c index 30bbc1e..9da9e78 100644 --- a/auth.c +++ b/auth.c @@ -647,7 +647,7 @@ auth_openfile(const char *file, struct passwd *pw, int strict_modes, int fd; FILE *f; -#ifdef WIN32_FIXME +#if(0)def WIN32_FIXME if ((fd = WSHELPwopen(file, O_RDONLY|O_NONBLOCK)) == -1) { #else if ((fd = open(file, O_RDONLY|O_NONBLOCK)) == -1) { diff --git a/contrib/win32/openssh/Win32-OpenSSH.sln b/contrib/win32/openssh/Win32-OpenSSH.sln index 1eaa752..66d3dec 100644 --- a/contrib/win32/openssh/Win32-OpenSSH.sln +++ b/contrib/win32/openssh/Win32-OpenSSH.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssh", "ssh.vcxproj", "{74E69D5E-A1EF-46EA-9173-19A412774104}" ProjectSection(ProjectDependencies) = postProject @@ -97,6 +97,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sshd", "sshd.vcxproj", "{F5 {05E1115F-8529-46D0-AAAF-52A404CE79A7} = {05E1115F-8529-46D0-AAAF-52A404CE79A7} {8F9D3B74-8D33-448E-9762-26E8DCC6B2F4} = {8F9D3B74-8D33-448E-9762-26E8DCC6B2F4} {DD483F7D-C553-4740-BC1A-903805AD0174} = {DD483F7D-C553-4740-BC1A-903805AD0174} + {0D02F0F0-013B-4EE3-906D-86517F3822C0} = {0D02F0F0-013B-4EE3-906D-86517F3822C0} {8660C2FE-9874-432D-B047-E042BB41DBE0} = {8660C2FE-9874-432D-B047-E042BB41DBE0} EndProjectSection EndProject diff --git a/contrib/win32/openssh/sshd.vcxproj b/contrib/win32/openssh/sshd.vcxproj index 346bb59..a0b6405 100644 --- a/contrib/win32/openssh/sshd.vcxproj +++ b/contrib/win32/openssh/sshd.vcxproj @@ -75,21 +75,25 @@ true $(OpenSSH-Bin-Path)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\$(TargetName)\ + $(OpenSSH-Src-Path)contrib\win32\win32compat\inc;$(VC_IncludePath);$(WindowsSDK_IncludePath); true $(OpenSSH-Bin-Path)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\$(TargetName)\ + $(OpenSSH-Src-Path)contrib\win32\win32compat\inc;$(VC_IncludePath);$(WindowsSDK_IncludePath); false $(OpenSSH-Bin-Path)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\$(TargetName)\ + $(OpenSSH-Src-Path)contrib\win32\win32compat\inc;$(VC_IncludePath);$(WindowsSDK_IncludePath); false $(OpenSSH-Bin-Path)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\$(TargetName)\ + $(OpenSSH-Src-Path)contrib\win32\win32compat\inc;$(VC_IncludePath);$(WindowsSDK_IncludePath); @@ -106,7 +110,7 @@ Console true - bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.lib;Netapi32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.lib;Netapi32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) $(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Debug-Path)lib;%(AdditionalLibraryDirectories) MultiplyDefinedSymbolOnly @@ -129,7 +133,7 @@ Console true - bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.lib;Netapi32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.lib;Netapi32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) $(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Debug-Path)lib;%(AdditionalLibraryDirectories) MultiplyDefinedSymbolOnly @@ -155,7 +159,7 @@ No true true - bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.lib;Netapi32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.lib;Netapi32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) $(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Release-Path)lib;%(AdditionalLibraryDirectories) MultiplyDefinedSymbolOnly @@ -182,7 +186,7 @@ No true true - bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.lib;Netapi32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.lib;Netapi32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) $(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Release-Path)lib;%(AdditionalLibraryDirectories) MultiplyDefinedSymbolOnly diff --git a/contrib/win32/win32compat/inc/w32posix.h b/contrib/win32/win32compat/inc/w32posix.h index 6ed1db2..92002cf 100644 --- a/contrib/win32/win32compat/inc/w32posix.h +++ b/contrib/win32/win32compat/inc/w32posix.h @@ -115,5 +115,5 @@ int w32_allocate_fd_for_handle(HANDLE h); #define WSHELPAddChildToWatch(a) w32_temp_AddChildToWatch((a)) #define sfd_to_handle(a) w32_fd_to_handle((a)) #define allocate_sfd(a) w32_allocate_fd_for_handle((a)) -#define WSHELPwopen(a) w32_open((a)) +//#define WSHELPwopen(a, b) w32_open((a, b)) diff --git a/contrib/win32/win32compat/startupneeds.c b/contrib/win32/win32compat/startupneeds.c index ee48214..b12adbe 100644 --- a/contrib/win32/win32compat/startupneeds.c +++ b/contrib/win32/win32compat/startupneeds.c @@ -35,7 +35,7 @@ int startup_handler(void) { - WSHELPinitialize(); + //WSHELPinitialize(); return 0; } diff --git a/serverloop.c b/serverloop.c index 81730fe..2d92317 100644 --- a/serverloop.c +++ b/serverloop.c @@ -884,8 +884,9 @@ collect_children(void) if (s->pid) CloseHandle(process); - int WSHELPDelChildToWatch (HANDLE processtowatch); - WSHELPDelChildToWatch (process); // take the process off from watch list in select mux + /*TODO - fix this*/ + //int WSHELPDelChildToWatch (HANDLE processtowatch); + //WSHELPDelChildToWatch (process); // take the process off from watch list in select mux } } } while (i > 0); diff --git a/session.c b/session.c index e9378a4..8c9cd1c 100644 --- a/session.c +++ b/session.c @@ -661,21 +661,21 @@ do_exec_no_pty(Session *s, const char *command) sockin[1] = allocate_sfd((int)wfdtocmd); // put the std input handle in our global general handle table } else - socketpair(sockin); + pipe(sockin); #endif - socketpair(sockout); - socketpair(sockerr); + pipe(sockout); + pipe(sockerr); debug3("sockin[0]: %d sockin[1]: %d", sockin[0], sockin[1]); debug3("sockout[0]: %d sockout[1]: %d", sockout[0], sockout[1]); debug3("sockerr[0]: %d sockerr[1]: %d", sockerr[0], sockerr[1]); #ifndef WIN32_PRAGMA_REMCON - if ( (s -> is_subsystem) || (s ->ttyfd == -1)) - crlf_sfd(sockin[1]); + // if ( (s -> is_subsystem) || (s ->ttyfd == -1)) + //crlf_sfd(sockin[1]); - crlf_sfd(sockout[1]); + // crlf_sfd(sockout[1]); if ( (s -> is_subsystem) || (s ->ttyfd == -1)) #endif @@ -1006,8 +1006,9 @@ do_exec_no_pty(Session *s, const char *command) s -> processId = pi.dwProcessId; // Add the child process created to select mux so that during our select data call we know if the process has exited - int WSHELPAddChildToWatch ( HANDLE processtowatch); - WSHELPAddChildToWatch ( pi.hProcess); + /* TODO - fix thi s*/ + //int WSHELPAddChildToWatch ( HANDLE processtowatch); + //WSHELPAddChildToWatch ( pi.hProcess); /* * Set interactive/non-interactive mode. diff --git a/sshd.c b/sshd.c index cf99125..3501842 100644 --- a/sshd.c +++ b/sshd.c @@ -1602,7 +1602,7 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s) sighup_restart(); if (fdset != NULL) free(fdset); -#ifndef WIN32_FIXME +#if(1)//ndef WIN32_FIXME fdset = xcalloc(howmany(maxfd + 1, NFDBITS), sizeof(fd_mask)); #else @@ -1968,15 +1968,16 @@ main(int ac, char **av) SetConsoleCtrlHandler(CtrlHandlerRoutine, TRUE); + w32posix_initialize(); //authctxt -> hTokenLsa_ = NULL; - WSHELPinitialize(); + /*WSHELPinitialize(); allocate_standard_descriptor(STDIN_FILENO); allocate_standard_descriptor(STDOUT_FILENO); allocate_standard_descriptor(STDERR_FILENO); - sfd_start = 3; + sfd_start = 3;*/ /* * Initialize log. @@ -2192,7 +2193,8 @@ main(int ac, char **av) * Win32 only. */ - WSHELPinitialize(); + //WSHELPinitialize(); + w32posix_initialize(); /* * Handle install and uninstall service options