mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-23 05:55:41 +02:00
Merge with PowerShell\L1-Prod.
This commit is contained in:
parent
30b28c106b
commit
9291dde274
85
auth.c
85
auth.c
@ -379,78 +379,6 @@ auth_root_allowed(const char *method)
|
||||
* This returns a buffer allocated by xmalloc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Win32 implementation uses UTF16 names.
|
||||
*/
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
|
||||
wchar_t *expand_authorized_keys(const wchar_t *filename, struct passwd *pw)
|
||||
{
|
||||
wchar_t *file_w, ret[MAXPATHLEN], pw_name_w[MAXPATHLEN], filename_w[MAXPATHLEN];
|
||||
|
||||
int i;
|
||||
|
||||
wchar_t *slash;
|
||||
|
||||
i = MultiByteToWideChar(CP_UTF8, 0, filename, -1, filename_w, MAXPATHLEN);
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
fatal("expand_authorized_keys: unable to convert path to UTF-16");
|
||||
}
|
||||
|
||||
MultiByteToWideChar(CP_UTF8, 0, pw -> pw_name, -1, pw_name_w, MAXPATHLEN);
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
fatal("expand_authorized_keys: unable to convert path to UTF-16");
|
||||
}
|
||||
|
||||
file_w = percent_expand_w(filename_w, L"h", pw -> pw_dir,
|
||||
L"u", pw_name_w, (char *) NULL);
|
||||
|
||||
/*
|
||||
* Replace '/' with '\'
|
||||
*/
|
||||
|
||||
slash = file_w;
|
||||
|
||||
while ((slash = wcschr(slash, L'/')))
|
||||
{
|
||||
*slash = L'\\';
|
||||
}
|
||||
|
||||
/*
|
||||
* Absolute path given.
|
||||
*/
|
||||
|
||||
if (wcschr(file_w, ':'))
|
||||
{
|
||||
i = _snwprintf(ret, sizeof(ret), L"%ls", file_w);
|
||||
}
|
||||
|
||||
/*
|
||||
* Relative path given. Expand to user homedir.
|
||||
*/
|
||||
|
||||
else
|
||||
{
|
||||
i = _snwprintf(ret, sizeof(ret), L"%ls\\%ls", pw->pw_dir, file_w);
|
||||
}
|
||||
|
||||
if (i < 0 || (size_t) i >= sizeof(ret))
|
||||
{
|
||||
fatal("expand_authorized_keys: path too long");
|
||||
}
|
||||
|
||||
free(file_w);
|
||||
|
||||
return (_wcsdup(ret));
|
||||
}
|
||||
|
||||
#else /* WIN32_FIXME */
|
||||
|
||||
char *
|
||||
expand_authorized_keys(const char *filename, struct passwd *pw)
|
||||
{
|
||||
@ -473,7 +401,6 @@ expand_authorized_keys(const char *filename, struct passwd *pw)
|
||||
free(file);
|
||||
return (xstrdup(ret));
|
||||
}
|
||||
#endif /* WIN32_FIXME */
|
||||
|
||||
char *
|
||||
authorized_principals_file(struct passwd *pw)
|
||||
@ -639,23 +566,15 @@ auth_openfile(const char *file, struct passwd *pw, int strict_modes,
|
||||
FILE *f;
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
if ((fd = _wopen(file, O_RDONLY|O_NONBLOCK)) == -1) {
|
||||
if ((f = fopen(file, "r")) == NULL)
|
||||
return NULL;
|
||||
#else
|
||||
if ((fd = open(file, O_RDONLY|O_NONBLOCK)) == -1) {
|
||||
#endif
|
||||
if (log_missing || errno != ENOENT)
|
||||
debug("Could not open %s '%s': %s", file_type, file,
|
||||
strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
if ((f = _fdopen(fd, "r")) == NULL) {
|
||||
_close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
if (fstat(fd, &st) < 0) {
|
||||
close(fd);
|
||||
return NULL;
|
||||
|
4
auth.h
4
auth.h
@ -196,11 +196,7 @@ char *get_challenge(Authctxt *);
|
||||
int verify_response(Authctxt *, const char *);
|
||||
void abandon_challenge_response(Authctxt *);
|
||||
|
||||
#ifndef WIN32_FIXME
|
||||
char *expand_authorized_keys(const char *, struct passwd *pw);
|
||||
#else
|
||||
wchar_t *expand_authorized_keys(const wchar_t *filename, struct passwd *pw);
|
||||
#endif
|
||||
|
||||
char *authorized_principals_file(struct passwd *);
|
||||
|
||||
|
@ -183,7 +183,7 @@ sshkey_perm_ok(int fd, const char *filename)
|
||||
if (check_ntsec(filename))
|
||||
#endif
|
||||
|
||||
#ifndef WIN32_FIXME//R
|
||||
#ifndef WINDOWS /*TODO - implement permission checks on Windows*/
|
||||
if ((st.st_uid == getuid()) && (st.st_mode & 077) != 0) {
|
||||
error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
|
||||
error("@ WARNING: UNPROTECTED PRIVATE KEY FILE! @");
|
||||
|
@ -1997,7 +1997,7 @@ channel_post_mux_listener(Channel *c, fd_set *readset, fd_set *writeset)
|
||||
c->notbefore = monotime() + 1;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef WINDOWS /*TODO - implement user check for Windows*/
|
||||
if (getpeereid(newsock, &euid, &egid) < 0) {
|
||||
error("%s getpeereid failed: %s", __func__,
|
||||
strerror(errno));
|
||||
@ -2010,6 +2010,7 @@ channel_post_mux_listener(Channel *c, fd_set *readset, fd_set *writeset)
|
||||
close(newsock);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
nc = channel_new("multiplex client", SSH_CHANNEL_MUX_CLIENT,
|
||||
newsock, newsock, -1, c->local_window_max,
|
||||
c->local_maxpacket, 0, "mux-control", 1);
|
||||
|
@ -110,7 +110,8 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Netapi32.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
@ -130,7 +131,8 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Netapi32.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
@ -153,7 +155,8 @@
|
||||
<GenerateDebugInformation>No</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Netapi32.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
@ -176,14 +179,14 @@
|
||||
<GenerateDebugInformation>No</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Netapi32.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)ssh-keygen.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)contrib\win32\win32compat\wmain.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="version.rc" />
|
||||
|
@ -18,9 +18,6 @@
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)ssh-keygen.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)contrib\win32\win32compat\wmain.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="version.rc">
|
||||
|
@ -21,7 +21,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)scp.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)contrib\win32\win32compat\wmain.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)win32_dirent.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="version.rc" />
|
||||
@ -116,7 +116,8 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
@ -135,7 +136,8 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
@ -158,7 +160,8 @@
|
||||
<GenerateDebugInformation>No</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
@ -181,7 +184,8 @@
|
||||
<GenerateDebugInformation>No</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)scp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\win32compat\wmain.c">
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)win32_dirent.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -23,7 +23,7 @@
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sftp-common.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sftp-server-main.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sftp-server.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)contrib\win32\win32compat\wmain.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)win32_dirent.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="version.rc" />
|
||||
@ -119,7 +119,8 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
@ -139,7 +140,7 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
@ -162,7 +163,7 @@
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
@ -185,7 +186,7 @@
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sftp-server.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\win32compat\wmain.c">
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)win32_dirent.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -25,7 +25,7 @@
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sftp-common.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sftp-glob.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sftp.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)contrib\win32\win32compat\wmain.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)win32_dirent.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="version.rc" />
|
||||
@ -121,7 +121,8 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
@ -141,7 +142,8 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
@ -164,7 +166,8 @@
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
@ -187,7 +190,8 @@
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
|
@ -30,7 +30,7 @@
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sftp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\win32compat\wmain.c">
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)win32_dirent.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -21,7 +21,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)ssh-add.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)contrib\win32\win32compat\wmain.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="version.rc" />
|
||||
@ -120,7 +119,8 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>win32iocompat.lib;Netapi32.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
@ -140,7 +140,8 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>win32iocompat.lib;Netapi32.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
@ -163,7 +164,8 @@
|
||||
<GenerateDebugInformation>No</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>win32iocompat.lib;Netapi32.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
@ -186,7 +188,8 @@
|
||||
<GenerateDebugInformation>No</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>win32iocompat.lib;Netapi32.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
|
@ -18,9 +18,6 @@
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)ssh-add.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\win32compat\wmain.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="version.rc">
|
||||
|
@ -116,7 +116,8 @@
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>Crypt32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;Crypt32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
</Link>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>targetos.manifest</AdditionalManifestFiles>
|
||||
@ -138,7 +139,8 @@
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>Crypt32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;Crypt32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
</Link>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>targetos.manifest</AdditionalManifestFiles>
|
||||
@ -162,7 +164,8 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>Crypt32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;Crypt32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
</Link>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>targetos.manifest</AdditionalManifestFiles>
|
||||
@ -187,7 +190,8 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>Crypt32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;Crypt32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
</Link>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>targetos.manifest</AdditionalManifestFiles>
|
||||
|
@ -116,7 +116,8 @@
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
<Manifest>
|
||||
@ -139,7 +140,8 @@
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
<Manifest>
|
||||
@ -164,7 +166,8 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
<Manifest>
|
||||
@ -190,7 +193,8 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;win32iocompat.lib;bcrypt.lib;Userenv.lib;Ws2_32.lib;Secur32.lib;Shlwapi.lib;openbsd_compat.lib;libssh.lib;win32compat.lib;libeay32.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)</AdditionalDependencies>
|
||||
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
<Manifest>
|
||||
@ -300,7 +304,6 @@
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sshconnect1.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sshconnect2.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sshtty.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)contrib\win32\win32compat\wmain.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="version.rc" />
|
||||
|
@ -317,9 +317,6 @@
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sshtty.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\win32compat\wmain.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="version.rc">
|
||||
|
@ -110,7 +110,8 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
@ -134,7 +135,8 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Debug-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
@ -161,7 +163,8 @@
|
||||
<GenerateDebugInformation>No</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-Win32-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
@ -189,7 +192,8 @@
|
||||
<GenerateDebugInformation>No</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<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)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Netapi32.lib;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)</AdditionalDependencies>
|
||||
|
||||
<AdditionalLibraryDirectories>$(OpenSSH-Lib-Path)$(Platform)\$(Configuration);$(OpenSSL-x64-Release-Path)lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>
|
||||
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
|
||||
@ -252,7 +256,6 @@
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sshd.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sshlogin.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sshpty.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)contrib\win32\win32compat\wmain.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="version.rc" />
|
||||
|
@ -174,9 +174,6 @@
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)sshpty.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\win32compat\wmain.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="version.rc">
|
||||
|
@ -151,10 +151,8 @@
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\gettimeofday.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\homedirhelp.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\kerberos.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\pwd.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\startupneeds.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\strcasecmp.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\stringhelp.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\tncon.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\tnnet.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\win32auth.c" />
|
||||
|
@ -57,18 +57,12 @@
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\kerberos.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\pwd.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\startupneeds.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\strcasecmp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\stringhelp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\tncon.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -150,7 +150,10 @@
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\signal_sigalrm.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\signal_sigchld.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\w32log.c" />
|
||||
<ClCompile Include="..\win32compat\win32_dirent.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\pwd.c" />
|
||||
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\wmain.c" />
|
||||
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\w32fd.h" />
|
||||
@ -169,6 +172,12 @@
|
||||
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\dlfcn.h" />
|
||||
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\syslog.h" />
|
||||
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\signal_internal.h" />
|
||||
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\pwd.h" />
|
||||
|
||||
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\sys\param.h" />
|
||||
|
||||
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\utf.h" />
|
||||
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
@ -10,7 +10,10 @@
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\signal_sigalrm.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\signal_sigchld.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\w32log.c" />
|
||||
<ClCompile Include="..\win32compat\win32_dirent.c" />
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\pwd.c" />
|
||||
|
||||
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\wmain.c" />
|
||||
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\w32fd.h" />
|
||||
@ -53,6 +56,23 @@
|
||||
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\dlfcn.h" />
|
||||
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\syslog.h" />
|
||||
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\signal_internal.h" />
|
||||
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\pwd.h">
|
||||
|
||||
<Filter>inc</Filter>
|
||||
|
||||
</ClInclude>
|
||||
|
||||
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\sys\param.h">
|
||||
|
||||
<Filter>inc\sys</Filter>
|
||||
|
||||
</ClInclude>
|
||||
|
||||
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\utf.h">
|
||||
|
||||
<Filter>inc</Filter>
|
||||
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="inc">
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "inc/defs.h"
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
#include "inc\utf.h"
|
||||
|
||||
/* internal read buffer size */
|
||||
#define READ_BUFFER_SIZE 100*1024
|
||||
@ -238,39 +239,40 @@ createFile_flags_setup(int flags, int mode, struct createFile_flags* cf_flags) {
|
||||
|
||||
/* open() implementation. Uses CreateFile to open file, console, device, etc */
|
||||
struct w32_io*
|
||||
fileio_open(const char *pathname, int flags, int mode) {
|
||||
fileio_open(const char *path_utf8, int flags, int mode) {
|
||||
struct w32_io* pio = NULL;
|
||||
struct createFile_flags cf_flags;
|
||||
HANDLE handle;
|
||||
wchar_t wpathname[MAX_PATH];
|
||||
wchar_t *path_utf16 = NULL;
|
||||
|
||||
debug2("open - pathname:%s, flags:%d, mode:%d", pathname, flags, mode);
|
||||
debug2("open - pathname:%s, flags:%d, mode:%d", path_utf8, flags, mode);
|
||||
/* check input params*/
|
||||
if (pathname == NULL) {
|
||||
if (path_utf8 == NULL) {
|
||||
errno = EINVAL;
|
||||
debug("open - ERROR:%d", errno);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (MultiByteToWideChar(CP_UTF8, 0, pathname, -1, wpathname, MAX_PATH) == 0) {
|
||||
errno = EFAULT;
|
||||
debug("WideCharToMultiByte failed - ERROR:%d", GetLastError());
|
||||
if ((path_utf16 = utf8_to_utf16(path_utf8)) == NULL) {
|
||||
errno = ENOMEM;
|
||||
debug("utf8_to_utf16 failed - ERROR:%d", GetLastError());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (createFile_flags_setup(flags, mode, &cf_flags) == -1)
|
||||
return NULL;
|
||||
|
||||
handle = CreateFileW(wpathname, cf_flags.dwDesiredAccess, cf_flags.dwShareMode,
|
||||
handle = CreateFileW(path_utf16, cf_flags.dwDesiredAccess, cf_flags.dwShareMode,
|
||||
&cf_flags.securityAttributes, cf_flags.dwCreationDisposition,
|
||||
cf_flags.dwFlagsAndAttributes, NULL);
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
errno = errno_from_Win32LastError();
|
||||
debug("open - CreateFile ERROR:%d", GetLastError());
|
||||
free(path_utf16);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
free(path_utf16);
|
||||
pio = (struct w32_io*)malloc(sizeof(struct w32_io));
|
||||
if (pio == NULL) {
|
||||
CloseHandle(handle);
|
||||
@ -565,7 +567,7 @@ fileio_stat(const char *path, struct _stat64 *buf) {
|
||||
return GetLastError();
|
||||
}
|
||||
|
||||
return _wstat64(wpath, buf);
|
||||
return _wstat64(wpath, buf);
|
||||
}
|
||||
|
||||
long
|
||||
|
42
contrib/win32/win32compat/inc/pwd.h
Normal file
42
contrib/win32/win32compat/inc/pwd.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Author: Manoj Ampalam <manoj.ampalam@microsoft.com>
|
||||
*
|
||||
* Compatibility header to give us pwd-like functionality on Win32
|
||||
* A lot of passwd fields are not applicable in Windows, neither are some API calls based on this structure
|
||||
* Ideally, usage of this structure needs to be replaced in core SSH code to an ssh_user interface,
|
||||
* that each platform can extend and implement.
|
||||
*/
|
||||
|
||||
#ifndef COMPAT_PWD_H
|
||||
#define COMPAT_PWD_H 1
|
||||
|
||||
#include "sys\param.h"
|
||||
|
||||
struct passwd {
|
||||
char *pw_name; /* user's login name */
|
||||
char *pw_passwd; /* password? */
|
||||
char *pw_gecos; /* ??? */
|
||||
uid_t pw_uid; /* numerical user ID */
|
||||
gid_t pw_gid; /* numerical group ID */
|
||||
char *pw_dir; /* initial working directory */
|
||||
char *pw_shell; /* path to shell */
|
||||
};
|
||||
|
||||
/*start - declarations not applicable in Windows */
|
||||
uid_t getuid(void);
|
||||
gid_t getgid(void);
|
||||
uid_t geteuid(void);
|
||||
gid_t getegid(void);
|
||||
int setuid(uid_t uid);
|
||||
int setgid(gid_t gid);
|
||||
int seteuid(uid_t uid);
|
||||
int setegid(gid_t gid);
|
||||
/*end - declarations not applicable in Windows */
|
||||
|
||||
struct passwd *w32_getpwuid(uid_t uid);
|
||||
struct passwd *w32_getpwnam(const char *username);
|
||||
|
||||
#define getpwuid w32_getpwuid
|
||||
#define getpwnam w32_getpwnam
|
||||
|
||||
#endif
|
10
contrib/win32/win32compat/inc/sys/param.h
Normal file
10
contrib/win32/win32compat/inc/sys/param.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef COMPAT_PARAM_H
|
||||
#define COMPAT_PARAM_H 1
|
||||
|
||||
typedef unsigned int uid_t;
|
||||
typedef unsigned int gid_t;
|
||||
typedef long off_t;
|
||||
typedef unsigned int dev_t;
|
||||
|
||||
|
||||
#endif
|
@ -13,10 +13,12 @@
|
||||
#define getsockopt(a,b,c,d,e) w32_getsockopt((a), (b), (c), (d), (e))
|
||||
#define getsockname(a,b,c) w32_getsockname((a), (b), (c))
|
||||
#define getpeername(a,b,c) w32_getpeername((a), (b), (c))
|
||||
#define listen(a,b) w32_listen((a), (b))
|
||||
#define bind(a,b,c) w32_bind((a), (b), (c))
|
||||
#define listen(a,b) w32_listen((a), (b))
|
||||
#define bind(a,b,c) w32_bind((a), (b), (c))
|
||||
#define connect(a,b,c) w32_connect((a), (b), (c))
|
||||
#define recv(a,b,c,d) w32_recv((a), (b), (c), (d))
|
||||
#define send(a,b,c,d) w32_send((a), (b), (c), (d))
|
||||
#define shutdown(a,b) w32_shutdown((a), (b))
|
||||
#define socketpair(a,b,c,d) w32_socketpair((a), (b), (c), (d))
|
||||
#define freeaddrinfo w32_freeaddrinfo
|
||||
#define getaddrinfo w32_getaddrinfo
|
||||
|
@ -35,6 +35,7 @@
|
||||
#define lseek w32_lseek
|
||||
|
||||
#define getdtablesize() MAX_FDS
|
||||
#define gethostname w32_gethostname
|
||||
|
||||
#define fopen w32_fopen_utf8
|
||||
|
||||
|
12
contrib/win32/win32compat/inc/utf.h
Normal file
12
contrib/win32/win32compat/inc/utf.h
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Author: Manoj Ampalam <manoj.ampalam@microsoft.com>
|
||||
*
|
||||
* UTF-16 <--> UTF-8 definitions
|
||||
*/
|
||||
#ifndef UTF_H
|
||||
#define UTF_H 1
|
||||
|
||||
wchar_t* utf8_to_utf16(const char *);
|
||||
char* utf16_to_utf8(const wchar_t*);
|
||||
|
||||
#endif
|
@ -8,6 +8,7 @@
|
||||
#include <WS2tcpip.h>
|
||||
#include <stdio.h>
|
||||
#include "defs.h"
|
||||
#include "utf.h"
|
||||
|
||||
#ifndef _OFF_T_DEFINED
|
||||
#define _OFF_T_DEFINED
|
||||
|
@ -1,34 +0,0 @@
|
||||
#ifndef COMPAT_PWD_H
|
||||
#define COMPAT_PWD_H 1
|
||||
|
||||
/* Compatibility header to give us pwd-like functionality on Win32 */
|
||||
|
||||
struct passwd
|
||||
{
|
||||
char *pw_name; /* user's login name */
|
||||
char *pw_passwd; /* password? */
|
||||
char *pw_gecos; /* ??? */
|
||||
uid_t pw_uid; /* numerical user ID */
|
||||
gid_t pw_gid; /* numerical group ID */
|
||||
char *pw_dir; /* initial working directory */
|
||||
char *pw_shell; /* path to shell */
|
||||
};
|
||||
|
||||
uid_t getuid(void);
|
||||
gid_t getgid(void);
|
||||
uid_t geteuid(void);
|
||||
gid_t getegid(void);
|
||||
int setuid(uid_t uid);
|
||||
int setgid(gid_t gid);
|
||||
int seteuid(uid_t uid);
|
||||
int setegid(gid_t gid);
|
||||
struct passwd *getpwuid(uid_t uid);
|
||||
struct passwd *getpwnam(const char *username);
|
||||
void endpwent(void);
|
||||
|
||||
char *realpathWin32(const char *path, char resolved[PATH_MAX]);
|
||||
|
||||
const char *
|
||||
user_from_uid(uid_t uid, int nouser);
|
||||
|
||||
#endif
|
@ -117,4 +117,27 @@ w32_fopen_utf8(const char *path, const char *mode) {
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
wchar_t*
|
||||
utf8_to_utf16(const char *utf8) {
|
||||
int needed = 0;
|
||||
wchar_t* utf16 = NULL;
|
||||
if ((needed = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL, 0)) == 0 ||
|
||||
(utf16 = malloc(needed * sizeof(wchar_t))) == NULL ||
|
||||
MultiByteToWideChar(CP_UTF8, 0, utf8, -1, utf16, needed) == 0)
|
||||
return NULL;
|
||||
return utf16;
|
||||
}
|
||||
|
||||
char*
|
||||
utf16_to_utf8(const wchar_t* utf16) {
|
||||
int needed = 0;
|
||||
char* utf8 = NULL;
|
||||
if ((needed = WideCharToMultiByte(CP_UTF8, 0, utf16, -1, NULL, 0, NULL, NULL)) == 0 ||
|
||||
(utf8 = malloc(needed)) == NULL ||
|
||||
WideCharToMultiByte(CP_UTF8, 0, utf16, -1, utf8, needed, NULL, NULL) == 0)
|
||||
return NULL;
|
||||
return utf8;
|
||||
}
|
@ -29,76 +29,160 @@
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
#include <Lmcons.h>
|
||||
#include <Lm.h>
|
||||
#include <stdlib.h>
|
||||
#include <ntsecapi.h>
|
||||
#include <errno.h>
|
||||
#include <shlobj.h>
|
||||
#include <Userenv.h>
|
||||
#include <Windows.h>
|
||||
#include <stdio.h>
|
||||
#include <LM.h>
|
||||
#include <sddl.h>
|
||||
|
||||
#include "win32auth.h"
|
||||
#include "homedirhelp.h"
|
||||
|
||||
|
||||
char *GetHomeDirFromToken(char *userName, HANDLE token);
|
||||
|
||||
uid_t getuid(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
gid_t getgid(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uid_t geteuid(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
gid_t getegid(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setuid(uid_t uid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setgid(gid_t gid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int seteuid(uid_t uid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setegid(gid_t gid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Global pw variables
|
||||
*/
|
||||
#define SECURITY_WIN32
|
||||
#include <security.h>
|
||||
#include "inc\pwd.h"
|
||||
#include "inc\utf.h"
|
||||
|
||||
static struct passwd pw;
|
||||
static char* pw_shellpath = "ssh-shellhost.exe";
|
||||
|
||||
static char pw_gecos[UNLEN + 1] = {'\0'};
|
||||
static char pw_username[UNLEN + 1] = {'\0'};
|
||||
static char pw_passwd[UNLEN + 1] = {'\0'};
|
||||
static wchar_t pw_homedir[MAX_PATH] = {L'\0'};
|
||||
static char pw_homedir_ascii[MAX_PATH] = {'\0'};
|
||||
static char pw_password[MAX_PATH] = {'\0'};
|
||||
static char pw_shellpath[MAX_PATH] = {'\0'};
|
||||
int
|
||||
initialize_pw() {
|
||||
if (pw.pw_shell != pw_shellpath) {
|
||||
memset(&pw, 0, sizeof(pw));
|
||||
pw.pw_shell = pw_shellpath;
|
||||
pw.pw_passwd = "\0";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
reset_pw() {
|
||||
initialize_pw();
|
||||
if (pw.pw_name)
|
||||
free(pw.pw_name);
|
||||
if (pw.pw_dir)
|
||||
free(pw.pw_dir);
|
||||
}
|
||||
|
||||
static struct passwd*
|
||||
get_passwd(const char *user_utf8, LPWSTR user_sid) {
|
||||
struct passwd *ret = NULL;
|
||||
wchar_t *user_utf16 = NULL, *uname_utf16, *udom_utf16, *tmp;
|
||||
char *uname_utf8 = NULL, *pw_home_utf8 = NULL;
|
||||
LPBYTE user_info = NULL;
|
||||
LPWSTR user_sid_local = NULL;
|
||||
wchar_t reg_path[MAX_PATH], profile_home[MAX_PATH];
|
||||
HKEY reg_key = 0;
|
||||
int tmp_len = MAX_PATH;
|
||||
|
||||
errno = 0;
|
||||
|
||||
reset_pw();
|
||||
|
||||
if ((user_utf16 = utf8_to_utf16(user_utf8) ) == NULL) {
|
||||
errno = ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/*find domain part if any*/
|
||||
if ((tmp = wcschr(user_utf16, L'\\')) != NULL) {
|
||||
udom_utf16 = user_utf16;
|
||||
uname_utf16 = tmp + 1;
|
||||
*tmp = L'\0';
|
||||
|
||||
}
|
||||
else if ((tmp = wcschr(user_utf16, L'@')) != NULL) {
|
||||
udom_utf16 = tmp + 1;
|
||||
uname_utf16 = user_utf16;
|
||||
*tmp = L'\0';
|
||||
}
|
||||
else {
|
||||
uname_utf16 = user_utf16;
|
||||
udom_utf16 = NULL;
|
||||
}
|
||||
|
||||
if (user_sid == NULL) {
|
||||
if (NetUserGetInfo(udom_utf16, uname_utf16, 23, &user_info) != NERR_Success ||
|
||||
ConvertSidToStringSidW(((LPUSER_INFO_23)user_info)->usri23_user_sid, &user_sid_local) == FALSE) {
|
||||
errno = ENOMEM; //??
|
||||
goto done;
|
||||
}
|
||||
user_sid = user_sid_local;
|
||||
}
|
||||
|
||||
if (swprintf(reg_path, MAX_PATH, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\%ls", user_sid) == MAX_PATH ||
|
||||
RegOpenKeyExW(HKEY_LOCAL_MACHINE, reg_path, 0, STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_WOW64_64KEY, ®_key) != 0 ||
|
||||
RegQueryValueExW(reg_key, L"ProfileImagePath", 0, NULL, (LPBYTE)profile_home, &tmp_len) != 0)
|
||||
GetWindowsDirectoryW(profile_home, MAX_PATH);
|
||||
|
||||
if ((uname_utf8 = _strdup(user_utf8)) == NULL ||
|
||||
(pw_home_utf8 = utf16_to_utf8(profile_home)) == NULL) {
|
||||
errno = ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
|
||||
pw.pw_name = uname_utf8;
|
||||
uname_utf8 = NULL;
|
||||
pw.pw_dir = pw_home_utf8;
|
||||
pw_home_utf8 = NULL;
|
||||
ret = &pw;
|
||||
done:
|
||||
if (user_utf16)
|
||||
free(user_utf16);
|
||||
if (uname_utf8)
|
||||
free(uname_utf8);
|
||||
if (pw_home_utf8)
|
||||
free(pw_home_utf8);
|
||||
if (user_info)
|
||||
NetApiBufferFree(user_info);
|
||||
if (user_sid_local)
|
||||
LocalFree(user_sid_local);
|
||||
if (reg_key)
|
||||
RegCloseKey(reg_key);
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct passwd*
|
||||
w32_getpwnam(const char *user_utf8) {
|
||||
return get_passwd(user_utf8, NULL);
|
||||
}
|
||||
|
||||
struct passwd*
|
||||
w32_getpwuid(uid_t uid) {
|
||||
wchar_t* wuser = NULL;
|
||||
char* user_utf8 = NULL;
|
||||
ULONG needed = 0;
|
||||
struct passwd *ret = NULL;
|
||||
HANDLE token = 0;
|
||||
DWORD info_len = 0;
|
||||
TOKEN_USER* info = NULL;
|
||||
LPWSTR user_sid = NULL;
|
||||
|
||||
errno = 0;
|
||||
|
||||
if (GetUserNameExW(NameSamCompatible, NULL, &needed) != 0 ||
|
||||
(wuser = malloc(needed * sizeof(wchar_t))) == NULL ||
|
||||
GetUserNameExW(NameSamCompatible, wuser, &needed) == 0 ||
|
||||
(user_utf8 = utf16_to_utf8(wuser)) == NULL ||
|
||||
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token) == FALSE ||
|
||||
GetTokenInformation(token, TokenUser, NULL, 0, &info_len) == TRUE ||
|
||||
(info = (TOKEN_USER*)malloc(info_len)) == NULL ||
|
||||
GetTokenInformation(token, TokenUser, info, info_len, &info_len) == FALSE ||
|
||||
ConvertSidToStringSidW(info->User.Sid, &user_sid) == FALSE){
|
||||
errno = ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
ret = get_passwd(user_utf8, user_sid);
|
||||
|
||||
done:
|
||||
if (wuser)
|
||||
free(wuser);
|
||||
if (user_utf8)
|
||||
free(user_utf8);
|
||||
if (token)
|
||||
CloseHandle(token);
|
||||
if (info)
|
||||
free(info);
|
||||
if (user_sid)
|
||||
LocalFree(user_sid);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* given a access token, find the domain name of user account of the access token */
|
||||
int GetDomainFromToken ( HANDLE *hAccessToken, UCHAR *domain, DWORD dwSize)
|
||||
@ -135,315 +219,13 @@ int GetDomainFromToken ( HANDLE *hAccessToken, UCHAR *domain, DWORD dwSize)
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
char *GetHomeDirFromToken(char *userName, HANDLE token)
|
||||
{
|
||||
UCHAR InfoBuffer[1000];
|
||||
PTOKEN_USER pTokenUser = (PTOKEN_USER)InfoBuffer;
|
||||
DWORD dwInfoBufferSize, tmp_len;
|
||||
LPWSTR sid_str = NULL;
|
||||
wchar_t reg_path[MAX_PATH];
|
||||
HKEY reg_key = 0;
|
||||
|
||||
/* set home dir to Windows if any of below fair*/
|
||||
GetWindowsDirectoryW(pw_homedir, MAX_PATH);
|
||||
|
||||
tmp_len = MAX_PATH;
|
||||
if (GetTokenInformation(token, TokenUser, InfoBuffer,
|
||||
1000, &dwInfoBufferSize) == FALSE ||
|
||||
ConvertSidToStringSidW(pTokenUser->User.Sid, &sid_str) == FALSE ||
|
||||
swprintf(reg_path, MAX_PATH, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\%ls", sid_str) == MAX_PATH ||
|
||||
RegOpenKeyExW(HKEY_LOCAL_MACHINE, reg_path, 0, STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_WOW64_64KEY, ®_key) != 0 ||
|
||||
RegQueryValueExW(reg_key, L"ProfileImagePath", 0, NULL, pw_homedir, &tmp_len) != 0 ){
|
||||
/* one of the above failed */
|
||||
debug("cannot retirve profile path - perhaps user profile is not created yet");
|
||||
}
|
||||
|
||||
if (sid_str)
|
||||
LocalFree(sid_str);
|
||||
|
||||
if (reg_key)
|
||||
RegCloseKey(reg_key);
|
||||
|
||||
{ /* retrieve and set env variables. */
|
||||
/* TODO - Get away with fixed limits and dynamically allocate required memory, cleanup this logic*/
|
||||
#define MAX_VALUE_LEN 1000
|
||||
#define MAX_DATA_LEN 2000
|
||||
#define MAX_EXPANDED_DATA_LEN 5000
|
||||
wchar_t *path;
|
||||
wchar_t value_name[MAX_VALUE_LEN];
|
||||
wchar_t value_data[MAX_DATA_LEN], value_data_expanded[MAX_EXPANDED_DATA_LEN], *to_apply;
|
||||
DWORD value_type, name_len, data_len;
|
||||
int i;
|
||||
LONG ret;
|
||||
|
||||
if (ImpersonateLoggedOnUser(token) == FALSE)
|
||||
debug("Failed to impersonate user token, %d", GetLastError());
|
||||
SET_USER_ENV(FOLDERID_LocalAppData, L"LOCALAPPDATA");
|
||||
SET_USER_ENV(FOLDERID_Profile, L"USERPROFILE");
|
||||
SET_USER_ENV(FOLDERID_RoamingAppData, L"APPDATA");
|
||||
reg_key = 0;
|
||||
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Environment", 0, KEY_QUERY_VALUE, ®_key) == ERROR_SUCCESS) {
|
||||
i = 0;
|
||||
while (1) {
|
||||
name_len = MAX_VALUE_LEN * 2;
|
||||
data_len = MAX_DATA_LEN * 2;
|
||||
to_apply = NULL;
|
||||
if (RegEnumValueW(reg_key, i++, &value_name, &name_len, 0, &value_type, &value_data, &data_len) != ERROR_SUCCESS)
|
||||
break;
|
||||
if (value_type == REG_SZ)
|
||||
to_apply = value_data;
|
||||
else if (value_type == REG_EXPAND_SZ) {
|
||||
ExpandEnvironmentStringsW(value_data, value_data_expanded, MAX_EXPANDED_DATA_LEN);
|
||||
to_apply = value_data_expanded;
|
||||
}
|
||||
|
||||
if (wcsicmp(value_name, L"PATH") == 0) {
|
||||
DWORD size;
|
||||
if ((size = GetEnvironmentVariableW(L"PATH", NULL, 0)) != ERROR_ENVVAR_NOT_FOUND) {
|
||||
memcpy(value_data_expanded + size, to_apply, (wcslen(to_apply) + 1)*2);
|
||||
GetEnvironmentVariableW(L"PATH", value_data_expanded, MAX_EXPANDED_DATA_LEN);
|
||||
value_data_expanded[size-1] = L';';
|
||||
to_apply = value_data_expanded;
|
||||
}
|
||||
|
||||
}
|
||||
if (to_apply)
|
||||
SetEnvironmentVariableW(value_name, to_apply);
|
||||
|
||||
|
||||
}
|
||||
RegCloseKey(reg_key);
|
||||
}
|
||||
|
||||
|
||||
RevertToSelf();
|
||||
}
|
||||
|
||||
|
||||
|
||||
debug("<- GetHomeDirFromToken()...");
|
||||
|
||||
return pw_homedir;
|
||||
}
|
||||
|
||||
/*
|
||||
* Not thread safe, would need to use thread local
|
||||
* storage instead of a static.
|
||||
* Temporary getpwuid implementaion of Windows. This should be replaced with getpw_currentuser
|
||||
*/
|
||||
|
||||
struct passwd *getpwuid(uid_t uid)
|
||||
{
|
||||
static struct passwd pw;
|
||||
|
||||
static char username[UNLEN + 1];
|
||||
|
||||
DWORD usernamelen = UNLEN + 1;
|
||||
|
||||
wchar_t *homedir_w;
|
||||
|
||||
/*
|
||||
* Clear errno.
|
||||
*/
|
||||
|
||||
errno = 0;
|
||||
|
||||
/*
|
||||
* Zero out the structure.
|
||||
*/
|
||||
|
||||
memset(&pw, 0, sizeof(pw));
|
||||
|
||||
memset(pw_username, 0, sizeof(pw_username));
|
||||
memset(pw_homedir, 0, sizeof(pw_homedir));
|
||||
memset(pw_password, 0, sizeof(pw_password));
|
||||
memset(pw_shellpath, 0, sizeof(pw_shellpath));
|
||||
|
||||
/*
|
||||
* Point to the static string variables.
|
||||
*/
|
||||
|
||||
pw.pw_name = pw_username;
|
||||
pw.pw_passwd = pw_password;
|
||||
pw.pw_gecos = pw_gecos;
|
||||
pw.pw_shell = pw_shellpath;
|
||||
pw.pw_dir = pw_homedir_ascii;
|
||||
|
||||
/*
|
||||
* Get the current user's name.
|
||||
*/
|
||||
|
||||
GetUserName(username, &usernamelen);
|
||||
|
||||
debug3("getpwuid: username [%s]", username);
|
||||
|
||||
strncpy(pw_username, username, sizeof(pw_username));
|
||||
|
||||
/*
|
||||
* ssh need path to 'known_hosts' file, so we don't
|
||||
* comment it here (see -> getpwnam() function).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Get default shell path.
|
||||
*/
|
||||
|
||||
//GetSystemDirectory(pw_shellpath, MAX_PATH);
|
||||
|
||||
//debug3("getpwuid: system dir [%s]", pw_shellpath);
|
||||
pw_shellpath[0] = '\0';
|
||||
strcat(pw_shellpath, "ssh-shellhost.exe");
|
||||
|
||||
//debug3("getpwuid: shell path [%s]", pw_shellpath);
|
||||
|
||||
/*
|
||||
* Get home directory path (if this fails,
|
||||
* the user is invalid, bail)
|
||||
*/
|
||||
|
||||
homedir_w = gethomedir_w(username, NULL);
|
||||
|
||||
if (!homedir_w || homedir_w[0] == '\0')
|
||||
{
|
||||
/*
|
||||
* Bail out.
|
||||
*/
|
||||
|
||||
errno = ENOENT;
|
||||
|
||||
return &pw;
|
||||
}
|
||||
|
||||
debug3("getpwuid: homedir [%ls]", homedir_w);
|
||||
|
||||
//wcsncpy(pw_homedir, homedir_w, sizeof(pw_homedir));
|
||||
// convert to ascii from widechar(unicode)
|
||||
int rc = WideCharToMultiByte( CP_UTF8, // UTF8/ANSI Code Page
|
||||
0, // No special handling of unmapped chars
|
||||
homedir_w, // wide-character string to be converted
|
||||
-1, // Unicode src str len, -1 means calc it
|
||||
pw_homedir_ascii,
|
||||
sizeof(pw_homedir_ascii),
|
||||
NULL, NULL ); // Unrepresented char replacement - Use Default
|
||||
|
||||
free(homedir_w);
|
||||
|
||||
if ( rc == 0 ) {
|
||||
debug3("Could not convert homedirectory [%ls]from unicode to utf8", homedir_w);
|
||||
}
|
||||
|
||||
/*
|
||||
* Point to the username static variable.
|
||||
*/
|
||||
|
||||
//pw.pw_name = pw_username;
|
||||
//pw.pw_passwd = pw_passwd;
|
||||
//pw.pw_gecos = pw_gecos;
|
||||
//pw.pw_shell = pw_shellpath;
|
||||
//pw.pw_dir = pw_homedir;
|
||||
|
||||
return &pw;
|
||||
}
|
||||
|
||||
|
||||
struct passwd *getpwnam(const char *userin)
|
||||
{
|
||||
char *homedir;
|
||||
|
||||
debug3("getpwnam: username [%s]", userin);
|
||||
|
||||
/*
|
||||
* Clear errno.
|
||||
*/
|
||||
|
||||
errno = 0;
|
||||
|
||||
/*
|
||||
* Zero out the structure.
|
||||
*/
|
||||
|
||||
memset(&pw, 0, sizeof(pw));
|
||||
|
||||
memset(pw_username, 0, sizeof(pw_username));
|
||||
memset(pw_homedir, 0, sizeof(pw_homedir));
|
||||
memset(pw_password, 0, sizeof(pw_password));
|
||||
memset(pw_shellpath, 0, sizeof(pw_shellpath));
|
||||
|
||||
/*
|
||||
* Point to the static string variables.
|
||||
*/
|
||||
|
||||
pw.pw_name = pw_username;
|
||||
pw.pw_passwd = pw_password;
|
||||
pw.pw_gecos = pw_gecos;
|
||||
pw.pw_shell = pw_shellpath;
|
||||
pw.pw_dir = pw_homedir;
|
||||
|
||||
/*
|
||||
* Get default shell path.
|
||||
*/
|
||||
|
||||
//GetSystemDirectory(pw_shellpath, MAX_PATH);
|
||||
|
||||
//debug3("getpwuid: system dir [%s]", pw_shellpath);
|
||||
|
||||
pw_shellpath[0] = '\0';
|
||||
strcat(pw_shellpath, "ssh-shellhost.exe");
|
||||
|
||||
//debug3("getpwuid: shell path [%s]", pw_shellpath);
|
||||
|
||||
/*
|
||||
* Copy user name to static structure.
|
||||
*/
|
||||
|
||||
strncpy(pw_username, userin, UNLEN + 1);
|
||||
|
||||
/*
|
||||
* Get a token for this user.
|
||||
*/
|
||||
|
||||
return &pw;
|
||||
}
|
||||
|
||||
void endpwent(void)
|
||||
{
|
||||
/*
|
||||
* This normally cleans up access to the passwd file,
|
||||
* which we don't have, thus no cleanup.
|
||||
*/
|
||||
}
|
||||
|
||||
#define NCACHE 64 /* power of 2 */
|
||||
#define MASK (NCACHE - 1) /* bits to store with */
|
||||
|
||||
const char *
|
||||
user_from_uid(uid_t uid, int nouser)
|
||||
{
|
||||
static struct ncache {
|
||||
uid_t uid;
|
||||
char *name;
|
||||
} c_uid[NCACHE];
|
||||
static int pwopen;
|
||||
static char nbuf[15]; /* 32 bits == 10 digits */
|
||||
struct passwd *pw;
|
||||
struct ncache *cp;
|
||||
|
||||
cp = c_uid + (uid & MASK);
|
||||
if (cp->uid != uid || cp->name == NULL) {
|
||||
if (pwopen == 0) {
|
||||
pwopen = 1;
|
||||
}
|
||||
if ((pw = getpwuid(uid)) == NULL) {
|
||||
if (nouser)
|
||||
return (NULL);
|
||||
(void)snprintf(nbuf, sizeof(nbuf), "%u", uid);
|
||||
}
|
||||
cp->uid = uid;
|
||||
if (cp->name != NULL)
|
||||
free(cp->name);
|
||||
cp->name = strdup(pw ? pw->pw_name : nbuf);
|
||||
}
|
||||
return (cp->name);
|
||||
}
|
||||
|
||||
/* TODO - this is moved from realpath.c in openbsdcompat. Review and finalize its position*/
|
||||
|
||||
@ -469,56 +251,43 @@ void slashconvert(char *str)
|
||||
}
|
||||
}
|
||||
|
||||
char *realpathWin32(const char *path, char resolved[PATH_MAX])
|
||||
{
|
||||
char realpath[PATH_MAX];
|
||||
|
||||
strlcpy(resolved, path + 1, sizeof(realpath));
|
||||
backslashconvert(resolved);
|
||||
PathCanonicalizeA(realpath, resolved);
|
||||
slashconvert(realpath);
|
||||
|
||||
/*
|
||||
* Store terminating slash in 'X:/' on Windows.
|
||||
*/
|
||||
|
||||
if (realpath[1] == ':' && realpath[2] == 0)
|
||||
{
|
||||
realpath[2] = '/';
|
||||
realpath[3] = 0;
|
||||
}
|
||||
|
||||
resolved[0] = *path; // will be our first slash in /x:/users/test1 format
|
||||
strncpy(resolved + 1, realpath, sizeof(realpath));
|
||||
return resolved;
|
||||
uid_t
|
||||
getuid(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// like realpathWin32() but takes out the first slash so that windows systems can work on the actual file or directory
|
||||
char *realpathWin32i(const char *path, char resolved[PATH_MAX])
|
||||
{
|
||||
char realpath[PATH_MAX];
|
||||
|
||||
if (path[0] != '/') {
|
||||
// absolute form x:/abc/def given, no first slash to take out
|
||||
strlcpy(resolved, path, sizeof(realpath));
|
||||
}
|
||||
else
|
||||
strlcpy(resolved, path + 1, sizeof(realpath));
|
||||
|
||||
backslashconvert(resolved);
|
||||
PathCanonicalizeA(realpath, resolved);
|
||||
slashconvert(realpath);
|
||||
|
||||
/*
|
||||
* Store terminating slash in 'X:/' on Windows.
|
||||
*/
|
||||
|
||||
if (realpath[1] == ':' && realpath[2] == 0)
|
||||
{
|
||||
realpath[2] = '/';
|
||||
realpath[3] = 0;
|
||||
}
|
||||
|
||||
strncpy(resolved, realpath, sizeof(realpath));
|
||||
return resolved;
|
||||
gid_t
|
||||
getgid(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uid_t
|
||||
geteuid(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
gid_t
|
||||
getegid(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
setuid(uid_t uid) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
setgid(gid_t gid) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
seteuid(uid_t uid) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
setegid(gid_t gid) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -32,8 +32,10 @@
|
||||
#include <ws2tcpip.h>
|
||||
#include <mswsock.h>
|
||||
#include <errno.h>
|
||||
#include <VersionHelpers.h>
|
||||
#include "w32fd.h"
|
||||
#include <stddef.h>
|
||||
#include "inc\utf.h"
|
||||
|
||||
#define INTERNAL_SEND_BUFFER_SIZE 70*1024 //70KB
|
||||
|
||||
@ -978,4 +980,103 @@ socketio_on_select(struct w32_io* pio, BOOL rd) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
w32_gethostname(char *name_utf8, size_t len) {
|
||||
wchar_t name_utf16[256];
|
||||
char* tmp_name_utf8 = NULL;
|
||||
|
||||
if (IsWindows8OrGreater()) {
|
||||
/* TODO - GetHostNameW not present in Win7, do GetProcAddr on Win8+*/
|
||||
// if (GetHostNameW(name_utf16, 256) == SOCKET_ERROR) {
|
||||
// errno = errno_from_WSALastError();
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
// if ((tmp_name_utf8 = utf16_to_utf8(name_utf16)) == NULL ||
|
||||
// strlen(tmp_name_utf8) >= len) {
|
||||
// errno = EFAULT; //??
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
// memcpy(name_utf8, tmp_name_utf8, strlen(tmp_name_utf8) + 1);
|
||||
// free(tmp_name_utf8);
|
||||
// return 0;
|
||||
return gethostname(name_utf8, len);
|
||||
}
|
||||
else
|
||||
return gethostname(name_utf8, len);
|
||||
}
|
||||
|
||||
void
|
||||
w32_freeaddrinfo(struct addrinfo *ai) {
|
||||
struct addrinfo *cur;
|
||||
while (ai) {
|
||||
cur = ai;
|
||||
ai = ai->ai_next;
|
||||
if (cur->ai_addr)
|
||||
free(cur->ai_addr);
|
||||
if (cur->ai_canonname)
|
||||
free(cur->ai_canonname);
|
||||
free(cur);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
w32_getaddrinfo(const char *node_utf8, const char *service_utf8,
|
||||
const struct addrinfo *hints, struct addrinfo **res) {
|
||||
int ret = 0;
|
||||
wchar_t *node_utf16 = NULL, *service_utf16 = NULL;
|
||||
struct addrinfoW *info_w = NULL;
|
||||
*res = NULL;
|
||||
|
||||
if ((node_utf8 && (node_utf16 = utf8_to_utf16(node_utf8)) == NULL) ||
|
||||
(service_utf8 && (service_utf16 = utf8_to_utf16(service_utf8)) == NULL)) {
|
||||
ret = EAI_MEMORY;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ((ret = GetAddrInfoW(node_utf16, service_utf16, (ADDRINFOW*)hints, &info_w)) != 0)
|
||||
goto done;
|
||||
|
||||
/* copy info_w to res */
|
||||
{
|
||||
struct addrinfoW **cur_w = &info_w;
|
||||
struct addrinfo **cur = res;
|
||||
|
||||
while (*cur_w) {
|
||||
if ((*cur = malloc(sizeof(struct addrinfo))) == NULL) {
|
||||
ret = EAI_MEMORY;
|
||||
goto done;
|
||||
}
|
||||
memcpy(*cur, *cur_w, sizeof(struct addrinfo));
|
||||
(*cur)->ai_next = NULL;
|
||||
if (((*cur_w)->ai_canonname && ((*cur)->ai_canonname = utf16_to_utf8((*cur_w)->ai_canonname)) == NULL) ||
|
||||
((*cur_w)->ai_addrlen && ((*cur)->ai_addr = malloc((*cur_w)->ai_addrlen)) == NULL) ) {
|
||||
ret = EAI_MEMORY;
|
||||
goto done;
|
||||
|
||||
}
|
||||
if ((*cur_w)->ai_addrlen)
|
||||
memcpy((*cur)->ai_addr, (*cur_w)->ai_addr, (*cur_w)->ai_addrlen);
|
||||
cur_w = &(*cur_w)->ai_next;
|
||||
cur = &(*cur)->ai_next;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
if (node_utf16)
|
||||
free(node_utf16);
|
||||
if (service_utf16)
|
||||
free(service_utf16);
|
||||
if (info_w)
|
||||
FreeAddrInfoW(info_w);
|
||||
if (ret != 0 && *res) {
|
||||
w32_freeaddrinfo(*res);
|
||||
*res = NULL;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,6 +46,8 @@
|
||||
#include "digest.h"
|
||||
#include "agent.h"
|
||||
|
||||
#include <utf.h>
|
||||
|
||||
static int use_privsep = -1;
|
||||
Buffer cfg;
|
||||
ServerOptions options;
|
||||
@ -67,14 +69,14 @@ int kexgex_server(struct ssh * sh) {
|
||||
}
|
||||
|
||||
static
|
||||
int GetCurrentModulePath(char *path, int pathSize)
|
||||
int GetCurrentModulePath(wchar_t *path, int pathSize)
|
||||
{
|
||||
if (GetModuleFileName(NULL, path, pathSize)) {
|
||||
if (GetModuleFileNameW(NULL, path, pathSize)) {
|
||||
int i;
|
||||
int lastSlashPos = 0;
|
||||
|
||||
for (i = 0; path[i]; i++) {
|
||||
if (path[i] == '/' || path[i] == '\\') {
|
||||
if (path[i] == L'/' || path[i] == L'\\') {
|
||||
lastSlashPos = i;
|
||||
}
|
||||
}
|
||||
@ -86,17 +88,20 @@ int GetCurrentModulePath(char *path, int pathSize)
|
||||
}
|
||||
|
||||
int load_config() {
|
||||
char basePath[MAX_PATH] = { 0 };
|
||||
char path[MAX_PATH] = { 0 };
|
||||
|
||||
wchar_t basePath[MAX_PATH] = { 0 };
|
||||
wchar_t path[MAX_PATH] = { 0 };
|
||||
|
||||
/* TODO - account for UNICODE paths*/
|
||||
if (GetCurrentModulePath(basePath, MAX_PATH) == 0)
|
||||
{
|
||||
strncpy(path, basePath, MAX_PATH);
|
||||
strncat(path, "/sshd_config", MAX_PATH);
|
||||
config_file_name = path;
|
||||
}
|
||||
buffer_init(&cfg);
|
||||
if (GetCurrentModulePath(basePath, MAX_PATH) == -1)
|
||||
return -1;
|
||||
|
||||
wcsncpy(path, basePath, MAX_PATH);
|
||||
wcsncat(path, L"/sshd_config", MAX_PATH);
|
||||
|
||||
if ((config_file_name = utf16_to_utf8(path)) == NULL)
|
||||
return -1;
|
||||
|
||||
buffer_init(&cfg);
|
||||
initialize_server_options(&options);
|
||||
load_server_config(config_file_name, &cfg);
|
||||
parse_server_config(&options, config_file_name, &cfg, NULL);
|
||||
@ -111,14 +116,18 @@ int config_log_level() {
|
||||
|
||||
int pubkey_allowed(struct sshkey* pubkey, wchar_t* wuser, wchar_t* wuser_home) {
|
||||
struct passwd pw;
|
||||
char user[256], user_home[MAX_PATH];
|
||||
int ret;
|
||||
char *user = NULL, *user_home = NULL;
|
||||
memset(&pw, 0, sizeof(pw));
|
||||
|
||||
if (WideCharToMultiByte(CP_UTF8, 0, wuser, -1, user, 256, NULL, NULL) == 0)
|
||||
return 0;
|
||||
/* BUG - pw structure is assumed to be filled with unicode strings by expand_authorized_keys()*/
|
||||
//WideCharToMultiByte(CP_UTF8, 0, wuser_home, -1, user_home, MAX_PATH, NULL, NULL);
|
||||
pw.pw_dir = wuser_home;
|
||||
if ((user_home = utf16_to_utf8(wuser_home)) == NULL ||
|
||||
(user = utf16_to_utf8(wuser)) == NULL)
|
||||
return 0;
|
||||
|
||||
pw.pw_dir = user_home;
|
||||
pw.pw_name = user;
|
||||
return user_key_allowed(&pw, pubkey, 1);
|
||||
ret = user_key_allowed(&pw, pubkey, 1);
|
||||
free(user);
|
||||
free(user_home);
|
||||
return ret;
|
||||
}
|
@ -1,198 +0,0 @@
|
||||
/*
|
||||
* Author: NoMachine <developers@nomachine.com>
|
||||
*
|
||||
* Copyright (c) 2009, 2010 NoMachine
|
||||
* All rights reserved
|
||||
*
|
||||
* Support functions and system calls' replacements needed to let the
|
||||
* software run on Win32 based operating systems.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include <Windows.h>
|
||||
#include "Debug.h"
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
# define DBG_MSG(...) debug3(__VA_ARGS__)
|
||||
#else
|
||||
# define DBG_MSG(...)
|
||||
#endif
|
||||
|
||||
#define SocketErrorStringSize 1024
|
||||
|
||||
/*
|
||||
* Convert string encoding from one 8-bit CP to another 8-bit CP.
|
||||
* WARNING: Returned string MUST be freed by caller.
|
||||
*
|
||||
* src - source string (IN).
|
||||
* srcSize - size of src string in bytes or -1 if zero terminated (IN).
|
||||
* srcCP - code page used by src string (IN).
|
||||
* dstCP - target code page (IN).
|
||||
* retSize - size of returned string, may be NULL (OUT/OPTIONAL).
|
||||
*
|
||||
* RETURNS: Pointer to new allocated string encoded in target CP
|
||||
* or NULL if error.
|
||||
*
|
||||
*/
|
||||
void *ConvertCodePage(const char *src, int srcSize,
|
||||
DWORD srcCP, DWORD dstCP, int *retSize)
|
||||
{
|
||||
int exitCode = -1;
|
||||
|
||||
int utf16Len = 0;
|
||||
int dstLen = 0;
|
||||
|
||||
wchar_t *utf16 = NULL;
|
||||
|
||||
char *ret = NULL;
|
||||
|
||||
DBG_MSG("-> ConvertCodePage(src=[%s], srcSize=[%d])...", src, srcSize);
|
||||
|
||||
/*
|
||||
* Check args.
|
||||
*/
|
||||
|
||||
FAIL(src == NULL);
|
||||
|
||||
/*
|
||||
* Retrieve size for UTF16.
|
||||
*/
|
||||
|
||||
DBG_MSG("Retrieving size of UTF16...");
|
||||
|
||||
utf16Len = MultiByteToWideChar(srcCP, 0, src, srcSize, NULL, 0);
|
||||
|
||||
FAIL(utf16Len <= 0);
|
||||
|
||||
/*
|
||||
* Allocate buffer for UTF16.
|
||||
*/
|
||||
|
||||
DBG_MSG("Allocating [%d] bytes for UTF16...", utf16Len * sizeof(wchar_t));
|
||||
|
||||
utf16 = (wchar_t *) malloc((utf16Len + 1) * sizeof(wchar_t));
|
||||
|
||||
FAIL(utf16 == NULL);
|
||||
|
||||
/*
|
||||
* Convert src to UTF16.
|
||||
*/
|
||||
|
||||
DBG_MSG("Allocating [%d] bytes for UTF16...", utf16Len * sizeof(wchar_t));
|
||||
|
||||
FAIL(MultiByteToWideChar(srcCP, 0, src, srcSize, utf16, utf16Len) < 0);
|
||||
|
||||
/*
|
||||
* Allocate buffer for return.
|
||||
*/
|
||||
|
||||
DBG_MSG("Allocating buffer for dst...");
|
||||
|
||||
dstLen = WideCharToMultiByte(dstCP, 0, utf16, -1, NULL, 0, NULL, NULL);
|
||||
|
||||
ret = malloc(dstLen + 1);
|
||||
|
||||
FAIL(ret == NULL);
|
||||
|
||||
ret[dstLen] = 0;
|
||||
|
||||
/*
|
||||
* Convert utf16 to target CP.
|
||||
*/
|
||||
|
||||
DBG_MSG("Converting UTF16 to dst...");
|
||||
|
||||
dstLen = WideCharToMultiByte(dstCP, 0, utf16, utf16Len,
|
||||
ret, dstLen + 1, NULL, NULL);
|
||||
|
||||
FAIL(dstLen < 0);
|
||||
|
||||
if (retSize)
|
||||
{
|
||||
*retSize = dstLen;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up.
|
||||
*/
|
||||
|
||||
exitCode = 0;
|
||||
|
||||
fail:
|
||||
|
||||
if (exitCode)
|
||||
{
|
||||
debug3("ERROR: Cannot convert [%s] from CP[0x%x] to CP[0x%x]."
|
||||
"Error code is : %d.\n", src, srcCP, dstCP, GetLastError());
|
||||
|
||||
if (ret)
|
||||
{
|
||||
free(ret);
|
||||
|
||||
ret = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (utf16)
|
||||
{
|
||||
free(utf16);
|
||||
}
|
||||
|
||||
DBG_MSG("<- ConvertCodePage()...");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert string from UTF8 to CP used by current thread (Local8).
|
||||
*
|
||||
* utf8 - string in UTF8 (IN).
|
||||
* utf8Size - size of utf8 string in bytes or -1 if zero terminated (IN).
|
||||
* bytesReturned - size of returned Local8 string (OUT).
|
||||
*
|
||||
* RETURNS: Pointer to new allocated Local8 string or NULL if error.
|
||||
*/
|
||||
|
||||
void *ConvertUtf8ToLocal8(const char *utf8, int utf8Size, int *bytesReturned)
|
||||
{
|
||||
return ConvertCodePage(utf8, utf8Size, CP_UTF8, GetACP(), bytesReturned);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert string from CP used by current thread (Local8) to UTF8.
|
||||
*
|
||||
* local8 - string in Local8 CP (IN).
|
||||
* local8Size - size of local8 string in bytes or -1 if zero terminated (IN).
|
||||
* bytesReturned - size of returned UTF8 string (OUT).
|
||||
*
|
||||
* RETURNS: Pointer to new allocated UTF8 string or NULL if error.
|
||||
*/
|
||||
|
||||
void *ConvertLocal8ToUtf8(const char *local8, int local8Size, int *bytesReturned)
|
||||
{
|
||||
return ConvertCodePage(local8, local8Size,
|
||||
GetACP(), CP_UTF8, bytesReturned);
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Author: NoMachine <developers@nomachine.com>
|
||||
*
|
||||
* Copyright (c) 2009, 2010 NoMachine
|
||||
* All rights reserved
|
||||
*
|
||||
* Support functions and system calls' replacements needed to let the
|
||||
* software run on Win32 based operating systems.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef StringHelp_H
|
||||
#define StringHelp_H 1
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void *ConvertCodePage(const char *src, int srcSize, DWORD srcCP, DWORD dstCP, int *retSize);
|
||||
void *ConvertUtf8ToLocal8(const char *utf8, int utf8Size, int *bytesReturned);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* StringHelp_H */
|
@ -417,24 +417,23 @@ w32_lseek(int fd, long offset, int origin) {
|
||||
}
|
||||
|
||||
int
|
||||
w32_mkdir(const char *pathname, unsigned short mode) {
|
||||
wchar_t wdirname[MAX_PATH];
|
||||
|
||||
if (MultiByteToWideChar(CP_UTF8, 0, pathname, -1, wdirname, MAX_PATH)) {
|
||||
return _wmkdir(wdirname);
|
||||
w32_mkdir(const char *path_utf8, unsigned short mode) {
|
||||
wchar_t *path_utf16 = utf8_to_utf16(path_utf8);
|
||||
if (path_utf16 == NULL) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return _wmkdir(path_utf16);
|
||||
}
|
||||
|
||||
int w32_chdir(const char *dirname) {
|
||||
wchar_t wdirname[MAX_PATH];
|
||||
|
||||
if (MultiByteToWideChar(CP_UTF8, 0, dirname, -1, wdirname, MAX_PATH)) {
|
||||
return _wchdir(wdirname);
|
||||
int w32_chdir(const char *dirname_utf8) {
|
||||
wchar_t *dirname_utf16 = utf8_to_utf16(dirname_utf8);
|
||||
if (dirname_utf16 == NULL) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return _wchdir(dirname_utf16);
|
||||
}
|
||||
|
||||
char *w32_getcwd(char *buffer, int maxlen) {
|
||||
|
@ -31,20 +31,10 @@
|
||||
*/
|
||||
|
||||
#include <Windows.h>
|
||||
#include "inc\utf.h"
|
||||
|
||||
int main(int, char **);
|
||||
|
||||
char*
|
||||
utf16_to_utf8(wchar_t* utf16str) {
|
||||
char* ret;
|
||||
int needed;
|
||||
if ((needed = WideCharToMultiByte(CP_UTF8, 0, utf16str, -1, NULL, 0, NULL, NULL)) == 0 ||
|
||||
(ret = malloc(needed)) == NULL ||
|
||||
WideCharToMultiByte(CP_UTF8, 0, utf16str, -1, ret, needed, NULL, NULL) != needed )
|
||||
fatal("failed to convert input arguments");
|
||||
|
||||
return ret;
|
||||
}
|
||||
void w32posix_initialize();
|
||||
|
||||
int
|
||||
wmain(int argc, wchar_t **wargv) {
|
||||
@ -58,5 +48,6 @@ wmain(int argc, wchar_t **wargv) {
|
||||
argv[i] = utf16_to_utf8(wargv[i]);
|
||||
}
|
||||
|
||||
w32posix_initialize();
|
||||
return main(argc, argv);
|
||||
}
|
||||
|
@ -527,6 +527,7 @@ getlast_entry(struct logininfo *li)
|
||||
/* If wtmp isn't available, try wtmpx */
|
||||
return (wtmpx_get_entry(li));
|
||||
# else
|
||||
/* TODO - implement last_login_entry in Windows*/
|
||||
/* Give up: No means of retrieving last login time */
|
||||
return (0);
|
||||
# endif /* DISABLE_LASTLOG */
|
||||
|
63
misc.c
63
misc.c
@ -223,11 +223,8 @@ pwcopy(struct passwd *pw)
|
||||
copy->pw_class = xstrdup(pw->pw_class);
|
||||
#endif
|
||||
|
||||
#ifdef WIN32_FIXME//N
|
||||
copy -> pw_dir = (char*)_wcsdup((wchar_t*)pw->pw_dir);
|
||||
#else
|
||||
|
||||
copy->pw_dir = xstrdup(pw->pw_dir);
|
||||
#endif
|
||||
copy->pw_shell = xstrdup(pw->pw_shell);
|
||||
return copy;
|
||||
}
|
||||
@ -677,64 +674,6 @@ percent_expand(const char *string, ...)
|
||||
#undef EXPAND_MAX_KEYS
|
||||
}
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
wchar_t *percent_expand_w(const wchar_t *string, ...)
|
||||
{
|
||||
#define EXPAND_MAX_KEYS 16
|
||||
u_int num_keys, i, j;
|
||||
struct {
|
||||
const wchar_t *key;
|
||||
const wchar_t *repl;
|
||||
} keys[EXPAND_MAX_KEYS];
|
||||
wchar_t buf[4096];
|
||||
wchar_t *aptr = NULL;
|
||||
va_list ap;
|
||||
|
||||
/* Gather keys */
|
||||
va_start(ap, string);
|
||||
for (num_keys = 0; num_keys < EXPAND_MAX_KEYS; num_keys++) {
|
||||
keys[num_keys].key = va_arg(ap, wchar_t *);
|
||||
if (keys[num_keys].key == NULL)
|
||||
break;
|
||||
keys[num_keys].repl = va_arg(ap, wchar_t *);
|
||||
if (keys[num_keys].repl == NULL)
|
||||
fatal("%s: NULL replacement", __func__);
|
||||
}
|
||||
if (num_keys == EXPAND_MAX_KEYS && va_arg(ap, wchar_t *) != NULL)
|
||||
fatal("%s: too many keys", __func__);
|
||||
va_end(ap);
|
||||
|
||||
/* Expand string */
|
||||
*buf = L'\0';
|
||||
for (i = 0; *string != L'\0'; string++) {
|
||||
if (*string != L'%') {
|
||||
append:
|
||||
buf[i++] = *string;
|
||||
if (i >= sizeof(buf))
|
||||
fatal("%s: string too long", __func__);
|
||||
buf[i] = L'\0';
|
||||
continue;
|
||||
}
|
||||
string++;
|
||||
/* %% case */
|
||||
if (*string == L'%')
|
||||
goto append;
|
||||
for (j = 0; j < num_keys; j++) {
|
||||
if (wcschr(keys[j].key, *string) != NULL) {
|
||||
aptr = wcsncat(buf, keys[j].repl, sizeof(buf));
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
if (aptr == NULL)
|
||||
fatal("%s: string too long", __func__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j >= num_keys)
|
||||
fatal("%s: unknown key %%%c", __func__, *string);
|
||||
}
|
||||
return (_wcsdup(buf));
|
||||
#undef EXPAND_MAX_KEYS
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Read an entire line from a public key file into a static buffer, discarding
|
||||
* lines that exceed the buffer size. Returns 0 on success, -1 on failure.
|
||||
|
3
misc.h
3
misc.h
@ -50,9 +50,6 @@ char *colon(char *);
|
||||
long convtime(const char *);
|
||||
char *tilde_expand_filename(const char *, uid_t);
|
||||
char *percent_expand(const char *, ...) __attribute__((__sentinel__));
|
||||
#ifdef WIN32_FIXME
|
||||
wchar_t *percent_expand_w(const wchar_t *, ...) __attribute__((__sentinel__));
|
||||
#endif
|
||||
char *tohex(const void *, size_t);
|
||||
void sanitise_stdfd(void);
|
||||
void ms_subtract_diff(struct timeval *, int *);
|
||||
|
@ -1564,7 +1564,7 @@ read_config_file(const char *filename, struct passwd *pw, const char *host,
|
||||
if ((f = fopen(filename, "r")) == NULL)
|
||||
return 0;
|
||||
|
||||
#ifndef WIN32_FIXME
|
||||
#ifndef WINDOWS /* TODO - implement permission checks for Windows */
|
||||
if (flags & SSHCONF_CHECKPERM) {
|
||||
struct stat sb;
|
||||
|
||||
|
@ -334,7 +334,7 @@ read_passphrase(const char *prompt, int flags)
|
||||
/*
|
||||
* Show prompt for user.
|
||||
*/
|
||||
_cputs(prompt);
|
||||
_cputws(utf8_to_utf16(prompt));
|
||||
|
||||
len = retr = 0;
|
||||
int bufsize = sizeof(buf);
|
||||
|
52
session.c
52
session.c
@ -103,7 +103,6 @@
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
|
||||
char *GetHomeDirFromToken(char *userName, HANDLE token);
|
||||
/*
|
||||
FIXME: GFPZR: Function stat() may be undeclared.
|
||||
*/
|
||||
@ -510,6 +509,7 @@ int
|
||||
do_exec_no_pty(Session *s, const char *command)
|
||||
{
|
||||
#ifdef WIN32_FIXME
|
||||
wchar_t* pw_dir_utf16 = utf8_to_utf16(s->pw->pw_dir);
|
||||
|
||||
/*
|
||||
* Win32 code.
|
||||
@ -702,33 +702,28 @@ do_exec_no_pty(Session *s, const char *command)
|
||||
SetEnvironmentVariable("DISPLAY", s -> display);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get user homedir if needed.
|
||||
*/
|
||||
|
||||
if (1) // (s -> pw -> pw_dir == NULL || s -> pw -> pw_dir[0] == '\0')
|
||||
{
|
||||
s -> pw -> pw_dir = GetHomeDirFromToken(s -> pw -> pw_name, hToken);
|
||||
}
|
||||
|
||||
/*
|
||||
* Change to users home directory
|
||||
* TODO - pw_dir is utf-8, convert it to utf-16 and call _wchdir
|
||||
* also change subsequent calls to SetEnvironmentVariable
|
||||
*/
|
||||
|
||||
_wchdir(s -> pw -> pw_dir);
|
||||
_wchdir(pw_dir_utf16);
|
||||
|
||||
SetEnvironmentVariableW(L"HOME", pw_dir_utf16);
|
||||
SetEnvironmentVariableW(L"USERPROFILE", pw_dir_utf16);
|
||||
|
||||
SetEnvironmentVariableW(L"HOME", s -> pw -> pw_dir);
|
||||
wchar_t *wstr, wchr;
|
||||
wstr = wcschr(s->pw->pw_dir, ':');
|
||||
wstr = wcschr(pw_dir_utf16, L':');
|
||||
if (wstr) {
|
||||
wchr = *(wstr + 1);
|
||||
*(wstr + 1) = '\0';
|
||||
SetEnvironmentVariableW(L"HOMEDRIVE", s->pw->pw_dir);
|
||||
SetEnvironmentVariableW(L"HOMEDRIVE", pw_dir_utf16);
|
||||
*(wstr + 1) = wchr;
|
||||
SetEnvironmentVariableW(L"HOMEPATH", (wstr+1));
|
||||
}
|
||||
|
||||
SetEnvironmentVariableW(L"USERPROFILE", s -> pw -> pw_dir);
|
||||
|
||||
|
||||
// find the server name of the domain controller which created this token
|
||||
GetDomainFromToken ( &hToken, buf, sizeof(buf));
|
||||
@ -742,7 +737,7 @@ do_exec_no_pty(Session *s, const char *command)
|
||||
snprintf(buf, sizeof buf, "%.50s %d %d",
|
||||
get_remote_ipaddr(), get_remote_port(), get_local_port());
|
||||
|
||||
SetEnvironmentVariable("SSH_CLIENT", buf);
|
||||
SetEnvironmentVariableA("SSH_CLIENT", buf);
|
||||
|
||||
/*
|
||||
* Set SSH_CONNECTION variable.
|
||||
@ -755,16 +750,16 @@ do_exec_no_pty(Session *s, const char *command)
|
||||
|
||||
free(laddr);
|
||||
|
||||
SetEnvironmentVariable("SSH_CONNECTION", buf);
|
||||
SetEnvironmentVariableA("SSH_CONNECTION", buf);
|
||||
|
||||
if (original_command)
|
||||
SetEnvironmentVariable("SSH_ORIGINAL_COMMAND", original_command);
|
||||
SetEnvironmentVariableA("SSH_ORIGINAL_COMMAND", original_command);
|
||||
|
||||
|
||||
// set better prompt for Windows cmd shell
|
||||
if (!s -> is_subsystem) {
|
||||
snprintf(buf,sizeof buf, "%s@%s $P$G", s->pw->pw_name, getenv("COMPUTERNAME"));
|
||||
SetEnvironmentVariable("PROMPT", buf);
|
||||
SetEnvironmentVariableA("PROMPT", buf);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -797,14 +792,17 @@ do_exec_no_pty(Session *s, const char *command)
|
||||
DWORD dwStartupFlags = DETACHED_PROCESS;// CREATE_SUSPENDED; // 0
|
||||
|
||||
SetConsoleCtrlHandler(NULL, FALSE);
|
||||
if (debug_flag)
|
||||
b = CreateProcessW(NULL, exec_command_w, NULL, NULL, TRUE,
|
||||
/*CREATE_NEW_PROCESS_GROUP*/ dwStartupFlags, NULL, s->pw->pw_dir,
|
||||
&si, &pi);
|
||||
else
|
||||
b = CreateProcessAsUserW(hToken, NULL, exec_command_w, NULL, NULL, TRUE,
|
||||
/*CREATE_NEW_PROCESS_GROUP*/ dwStartupFlags, NULL, s -> pw -> pw_dir,
|
||||
&si, &pi);
|
||||
|
||||
wchar_t* p_dir = utf8_to_utf16(s->pw->pw_dir);
|
||||
if (debug_flag)
|
||||
b = CreateProcessW(NULL, exec_command_w, NULL, NULL, TRUE,
|
||||
/*CREATE_NEW_PROCESS_GROUP*/ dwStartupFlags, NULL, pw_dir_utf16,
|
||||
&si, &pi);
|
||||
else
|
||||
b = CreateProcessAsUserW(hToken, NULL, exec_command_w, NULL, NULL, TRUE,
|
||||
/*CREATE_NEW_PROCESS_GROUP*/ dwStartupFlags, NULL, pw_dir_utf16,
|
||||
&si, &pi);
|
||||
|
||||
if (!b)
|
||||
{
|
||||
debug("ERROR. Cannot create process (%u).\n", GetLastError());
|
||||
|
@ -68,7 +68,7 @@ void free_sftp_dirents(SFTP_DIRENT **);
|
||||
int do_rm(struct sftp_conn *, const char *);
|
||||
|
||||
/* Create directory 'path' */
|
||||
u_int do_mkdir(struct sftp_conn *, const char *, Attrib *, int);
|
||||
int do_mkdir(struct sftp_conn *, const char *, Attrib *, int);
|
||||
|
||||
/* Remove directory 'path' */
|
||||
int do_rmdir(struct sftp_conn *, const char *);
|
||||
|
@ -230,9 +230,13 @@ ls_file(const char *name, const struct stat *st, int remote, int si_units)
|
||||
strmode_from_attrib(remote, mode);
|
||||
#endif
|
||||
if (!remote) {
|
||||
user = user_from_uid(st->st_uid, 0);
|
||||
snprintf(gbuf, sizeof gbuf, "%u", (u_int)st->st_gid);
|
||||
group = gbuf;
|
||||
#ifndef WIN32_FIXME
|
||||
user = user_from_uid(st->st_uid, 0);
|
||||
#else
|
||||
user = "\0";
|
||||
snprintf(gbuf, sizeof gbuf, "%u", (u_int)st->st_gid);
|
||||
group = gbuf;
|
||||
#endif
|
||||
} else {
|
||||
snprintf(ubuf, sizeof ubuf, "%u", (u_int)st->st_uid);
|
||||
user = ubuf;
|
||||
|
@ -38,10 +38,6 @@ main(int argc, char **argv)
|
||||
{
|
||||
struct passwd *user_pw;
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
w32posix_initialize();
|
||||
#endif
|
||||
|
||||
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
|
||||
sanitise_stdfd();
|
||||
|
||||
|
@ -60,8 +60,8 @@
|
||||
#include "sftp.h"
|
||||
#include "sftp-common.h"
|
||||
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
#include <Shlwapi.h>
|
||||
|
||||
char * get_inside_path(char *, BOOL, BOOL);
|
||||
int readlink(const char *path, char *link, int linklen);
|
||||
@ -72,6 +72,8 @@
|
||||
* without slash at the end).
|
||||
*/
|
||||
|
||||
char *realpathWin32(const char *path, char resolved[PATH_MAX]);
|
||||
char *realpathWin32i(const char *path, char resolved[PATH_MAX]);
|
||||
#define realpath realpathWin32
|
||||
|
||||
#endif /* WIN32_FIXME */
|
||||
@ -2157,3 +2159,59 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
|
||||
}
|
||||
//#endif /* else WIN32 */
|
||||
}
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
char *realpathWin32(const char *path, char resolved[PATH_MAX])
|
||||
{
|
||||
char realpath[PATH_MAX];
|
||||
|
||||
strlcpy(resolved, path + 1, sizeof(realpath));
|
||||
backslashconvert(resolved);
|
||||
PathCanonicalizeA(realpath, resolved);
|
||||
slashconvert(realpath);
|
||||
|
||||
/*
|
||||
* Store terminating slash in 'X:/' on Windows.
|
||||
*/
|
||||
|
||||
if (realpath[1] == ':' && realpath[2] == 0)
|
||||
{
|
||||
realpath[2] = '/';
|
||||
realpath[3] = 0;
|
||||
}
|
||||
|
||||
resolved[0] = *path; // will be our first slash in /x:/users/test1 format
|
||||
strncpy(resolved + 1, realpath, sizeof(realpath));
|
||||
return resolved;
|
||||
}
|
||||
|
||||
// like realpathWin32() but takes out the first slash so that windows systems can work on the actual file or directory
|
||||
char *realpathWin32i(const char *path, char resolved[PATH_MAX])
|
||||
{
|
||||
char realpath[PATH_MAX];
|
||||
|
||||
if (path[0] != '/') {
|
||||
// absolute form x:/abc/def given, no first slash to take out
|
||||
strlcpy(resolved, path, sizeof(realpath));
|
||||
}
|
||||
else
|
||||
strlcpy(resolved, path + 1, sizeof(realpath));
|
||||
|
||||
backslashconvert(resolved);
|
||||
PathCanonicalizeA(realpath, resolved);
|
||||
slashconvert(realpath);
|
||||
|
||||
/*
|
||||
* Store terminating slash in 'X:/' on Windows.
|
||||
*/
|
||||
|
||||
if (realpath[1] == ':' && realpath[2] == 0)
|
||||
{
|
||||
realpath[2] = '/';
|
||||
realpath[3] = 0;
|
||||
}
|
||||
|
||||
strncpy(resolved, realpath, sizeof(realpath));
|
||||
return resolved;
|
||||
}
|
||||
#endif
|
||||
|
2
sftp.c
2
sftp.c
@ -74,7 +74,7 @@ typedef void EditLine;
|
||||
#define DEFAULT_NUM_REQUESTS 64 /* # concurrent outstanding requests */
|
||||
#define MAX_COMMAND_LINE 2048
|
||||
|
||||
#ifdef WINDOWS
|
||||
#ifdef WIN32_VS
|
||||
#include "win32_dirent.h"
|
||||
#endif
|
||||
|
||||
|
11
ssh-add.c
11
ssh-add.c
@ -484,17 +484,6 @@ main(int argc, char **argv)
|
||||
char *pkcs11provider = NULL;
|
||||
int r, i, ch, deleting = 0, ret = 0, key_only = 0;
|
||||
int xflag = 0, lflag = 0, Dflag = 0;
|
||||
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
|
||||
/*
|
||||
* Allocate stdio inside our wrapper function.
|
||||
*/
|
||||
|
||||
w32posix_initialize();
|
||||
|
||||
#endif
|
||||
|
||||
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
|
||||
sanitise_stdfd();
|
||||
|
25
ssh-keygen.c
25
ssh-keygen.c
@ -58,13 +58,6 @@
|
||||
#include "krl.h"
|
||||
#include "digest.h"
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
#undef open
|
||||
#undef fdopen
|
||||
#define open(a,b,...) _open((a), (b), __VA_ARGS__)
|
||||
#define fdopen(a,b) _fdopen((a), (b))
|
||||
#endif
|
||||
|
||||
#ifdef WITH_OPENSSL
|
||||
# define DEFAULT_KEY_TYPE_NAME "rsa"
|
||||
#else
|
||||
@ -997,6 +990,11 @@ do_gen_all_hostkeys(struct passwd *pw)
|
||||
}
|
||||
sshkey_free(private);
|
||||
strlcat(identity_file, ".pub", sizeof(identity_file));
|
||||
#ifdef WINDOWS
|
||||
if ((f = fopen(identity_file, "w")) == NULL) {
|
||||
error("fopen %s failed: %s", identity_file, strerror(errno));
|
||||
/* TODO - set permissions on file */
|
||||
#else
|
||||
fd = open(identity_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if (fd == -1) {
|
||||
error("Could not save your public key in %s",
|
||||
@ -1006,9 +1004,11 @@ do_gen_all_hostkeys(struct passwd *pw)
|
||||
continue;
|
||||
}
|
||||
f = fdopen(fd, "w");
|
||||
|
||||
if (f == NULL) {
|
||||
error("fdopen %s failed", identity_file);
|
||||
close(fd);
|
||||
#endif
|
||||
sshkey_free(public);
|
||||
first = 0;
|
||||
continue;
|
||||
@ -2231,11 +2231,6 @@ main(int argc, char **argv)
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
|
||||
/*
|
||||
* Init wrapped stdio.
|
||||
*/
|
||||
|
||||
w32posix_initialize();
|
||||
/*
|
||||
* -rand option used for generate random password.
|
||||
*/
|
||||
@ -2777,11 +2772,17 @@ passphrase_again:
|
||||
printf("Your identification has been saved in %s.\n", identity_file);
|
||||
|
||||
strlcat(identity_file, ".pub", sizeof(identity_file));
|
||||
#ifdef WINDOWS
|
||||
if ((f = fopen(identity_file, "w")) == NULL)
|
||||
fatal("fopen %s failed: %s", identity_file, strerror(errno));
|
||||
/* TODO - set permissions on file */
|
||||
#else
|
||||
if ((fd = open(identity_file, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1)
|
||||
fatal("Unable to save public key to %s: %s",
|
||||
identity_file, strerror(errno));
|
||||
if ((f = fdopen(fd, "w")) == NULL)
|
||||
fatal("fdopen %s failed: %s", identity_file, strerror(errno));
|
||||
#endif
|
||||
if ((r = sshkey_write(public, f)) != 0)
|
||||
error("write key failed: %s", ssh_err(r));
|
||||
fprintf(f, " %s\n", comment);
|
||||
|
28
ssh.c
28
ssh.c
@ -528,16 +528,6 @@ main(int ac, char **av)
|
||||
u_char conn_hash[SSH_DIGEST_MAX_LENGTH];
|
||||
char *conn_hash_hex;
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
|
||||
/*
|
||||
* Initialize wrapped stdio.
|
||||
*/
|
||||
|
||||
w32posix_initialize();
|
||||
|
||||
#endif
|
||||
|
||||
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
|
||||
sanitise_stdfd();
|
||||
|
||||
@ -560,6 +550,7 @@ main(int ac, char **av)
|
||||
*/
|
||||
closefrom(STDERR_FILENO + 1);
|
||||
|
||||
#ifndef WINDOWS
|
||||
/*
|
||||
* Save the original real uid. It will be needed later (uid-swapping
|
||||
* may clobber the real uid).
|
||||
@ -575,6 +566,7 @@ main(int ac, char **av)
|
||||
* has been made, as we may need to create the port several times).
|
||||
*/
|
||||
PRIV_END;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SETRLIMIT
|
||||
/* If we are installed setuid root be careful to not drop core. */
|
||||
@ -1336,14 +1328,8 @@ main(int ac, char **av)
|
||||
* directory if it doesn't already exist.
|
||||
*/
|
||||
if (config == NULL) {
|
||||
#ifdef WIN32_FIXME
|
||||
r = snprintf(buf, sizeof(buf), "%ls%s%s", pw -> pw_dir,
|
||||
wcscmp(pw -> pw_dir, L"/") ? "/" : "",
|
||||
_PATH_SSH_USER_DIR);
|
||||
#else
|
||||
r = snprintf(buf, sizeof buf, "%s%s%s", pw->pw_dir,
|
||||
strcmp(pw->pw_dir, "/") ? "/" : "", _PATH_SSH_USER_DIR);
|
||||
#endif
|
||||
|
||||
if (r > 0 && (size_t)r < sizeof(buf) && stat(buf, &st) < 0) {
|
||||
#ifdef WITH_SELINUX
|
||||
@ -2081,16 +2067,8 @@ load_public_identity_files(void)
|
||||
if ((pw = getpwuid(original_real_uid)) == NULL)
|
||||
fatal("load_public_identity_files: getpwuid failed");
|
||||
pwname = xstrdup(pw->pw_name);
|
||||
#ifdef WIN32_FIXME
|
||||
pwdir = _wcsdup(pw -> pw_dir);
|
||||
|
||||
if (pwdir)
|
||||
{
|
||||
sprintf(pwdir, "%ls", pw -> pw_dir);
|
||||
}
|
||||
#else
|
||||
pwdir = xstrdup(pw->pw_dir);
|
||||
#endif
|
||||
|
||||
if (gethostname(thishost, sizeof(thishost)) == -1)
|
||||
fatal("load_public_identity_files: gethostname: %s",
|
||||
strerror(errno));
|
||||
|
50
sshd.c
50
sshd.c
@ -1691,43 +1691,6 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
|
||||
/*
|
||||
* Win32 only.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* This function handles exit signal from parent process.
|
||||
*/
|
||||
|
||||
BOOL WINAPI CtrlHandlerRoutine(DWORD dwCtrlType)
|
||||
{
|
||||
switch( dwCtrlType )
|
||||
{
|
||||
case CTRL_C_EVENT:
|
||||
return TRUE; // control C will be passed to shell but sshd wil not exit
|
||||
|
||||
case CTRL_BREAK_EVENT:
|
||||
case CTRL_LOGOFF_EVENT:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
debug("Exit signal received...");
|
||||
|
||||
cleanup_exit(0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* WIN32_FIXME */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Main program for the daemon.
|
||||
*/
|
||||
@ -1768,10 +1731,6 @@ main(int ac, char **av)
|
||||
|
||||
AllocConsole();
|
||||
|
||||
SetConsoleCtrlHandler(CtrlHandlerRoutine, TRUE);
|
||||
|
||||
w32posix_initialize();
|
||||
|
||||
#endif /* WIN32_FIXME */
|
||||
|
||||
|
||||
@ -1936,9 +1895,10 @@ main(int ac, char **av)
|
||||
{
|
||||
do
|
||||
{
|
||||
SERVICE_TABLE_ENTRY DispatchTable[] =
|
||||
int wmain(int , wchar_t **);
|
||||
SERVICE_TABLE_ENTRYW DispatchTable[] =
|
||||
{
|
||||
{SVCNAME, (LPSERVICE_MAIN_FUNCTION) main},
|
||||
{L"SSHD", (LPSERVICE_MAIN_FUNCTIONW) wmain},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@ -1961,7 +1921,7 @@ main(int ac, char **av)
|
||||
* for any other reason, bail out.
|
||||
*/
|
||||
|
||||
if (!StartServiceCtrlDispatcher(DispatchTable))
|
||||
if (!StartServiceCtrlDispatcherW(DispatchTable))
|
||||
{
|
||||
if (GetLastError() == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT)
|
||||
{
|
||||
@ -2213,6 +2173,7 @@ main(int ac, char **av)
|
||||
logit("[Build " __DATE__ " " __TIME__ "]");
|
||||
#endif
|
||||
|
||||
#ifndef WINDOWS
|
||||
/* Store privilege separation user for later use if required. */
|
||||
if ((privsep_pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) {
|
||||
if (use_privsep || options.kerberos_authentication)
|
||||
@ -2226,6 +2187,7 @@ main(int ac, char **av)
|
||||
privsep_pw->pw_passwd = xstrdup("*");
|
||||
}
|
||||
endpwent();
|
||||
#endif
|
||||
|
||||
/* load host keys */
|
||||
sensitive_data.host_keys = xcalloc(options.num_host_key_files,
|
||||
|
@ -40,8 +40,8 @@ DIR * opendir(char *name)
|
||||
pdir->c_file.time_create = c_file.time_create;
|
||||
pdir->c_file.time_write = c_file.time_write;
|
||||
|
||||
if ((needed = WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, c_file.name, -1, NULL, 0, NULL, NULL)) == 0 ||
|
||||
WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, c_file.name, -1, pdir->c_file.name, needed, NULL, NULL) != needed)
|
||||
if ((needed = WideCharToMultiByte(CP_UTF8, 0, c_file.name, -1, NULL, 0, NULL, NULL)) == 0 ||
|
||||
WideCharToMultiByte(CP_UTF8, 0, c_file.name, -1, pdir->c_file.name, needed, NULL, NULL) != needed)
|
||||
fatal("failed to covert input arguments");
|
||||
|
||||
strcpy_s(pdir->initName, sizeof(pdir->initName), pdir->c_file.name);
|
||||
@ -82,9 +82,9 @@ struct dirent *readdir(void *avp)
|
||||
}
|
||||
pdirentry = (struct dirent *) malloc( sizeof(struct dirent) );
|
||||
|
||||
if ((needed = WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, c_file.name, -1, NULL, 0, NULL, NULL)) == 0 ||
|
||||
if ((needed = WideCharToMultiByte(CP_UTF8, 0, c_file.name, -1, NULL, 0, NULL, NULL)) == 0 ||
|
||||
(pdirentry->d_name = malloc(needed)) == NULL ||
|
||||
WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, c_file.name, -1, pdirentry->d_name, needed, NULL, NULL) != needed)
|
||||
WideCharToMultiByte(CP_UTF8, 0, c_file.name, -1, pdirentry->d_name, needed, NULL, NULL) != needed)
|
||||
fatal("failed to covert input arguments");
|
||||
|
||||
pdirentry->d_ino = 1; // a fictious one like UNIX to say it is nonzero
|
Loading…
x
Reference in New Issue
Block a user