Ported upstream changes (7.7)

This commit is contained in:
Manoj Ampalam 2018-04-02 22:30:15 -07:00
parent 6c9f57ac09
commit 32a7aec453
17 changed files with 51 additions and 50 deletions

View File

@ -269,8 +269,9 @@ done:
* - If LogonUser fails, then try the LSA (Local Security Authority) authentication.
*/
int
sys_auth_passwd(Authctxt *authctxt, const char *password)
sys_auth_passwd(struct ssh *ssh, const char *password)
{
Authctxt *authctxt = ssh->authctxt;
wchar_t *user_utf16 = NULL, *udom_utf16 = NULL, *pwd_utf16 = NULL, *tmp;
HANDLE token = NULL;
int r = 0;

View File

@ -1666,15 +1666,13 @@
#define __func__ __FUNCTION__
#endif
/* Windows specific macro added to workaround mysignal implementaion in bsd-misc.c */
#define HAVE_MYSIGNAL 1
#define HAVE_BZERO 1
#define PATH_MAX MAX_PATH
#define S_IFIFO 0x1000
#define HAVE_EXPLICIT_BZERO
#define HAVE_MBTOWC 1
#define HAVE_LLABS 1
#define HAVE_RAISE 1
#include <signal.h>
#include <io.h>

View File

@ -2,7 +2,7 @@ Param($Config_h_vs, $Config_h, $VCIncludePath, $OutCRTHeader)
Copy-Item $Config_h_vs $Config_h -Force
if (Test-Path $OutCRTHeader) {exit}
$headers = ("stdio.h", "string.h", "sys\types.h", "ctype.h", "stdlib.h", "sys\stat.h", "fcntl.h")
$headers = ("stdio.h", "string.h", "sys\types.h", "ctype.h", "stdlib.h", "sys\stat.h", "fcntl.h", "time.h")
$paths = $VCIncludePath.Split(";")
Set-Content -Path $OutCRTHeader -Value "/*`r`n * DO NOT EDIT - AutoGenerated by config.ps1`r`n */`r`n" -Force
foreach ($header in $headers) {

View File

@ -349,7 +349,6 @@
<ClCompile Include="$(OpenSSH-Src-Path)authfd.c" />
<ClCompile Include="$(OpenSSH-Src-Path)authfile.c" />
<ClCompile Include="$(OpenSSH-Src-Path)bitmap.c" />
<ClCompile Include="$(OpenSSH-Src-Path)blocks.c" />
<ClCompile Include="$(OpenSSH-Src-Path)bufaux.c" />
<ClCompile Include="$(OpenSSH-Src-Path)bufbn.c" />
<ClCompile Include="$(OpenSSH-Src-Path)bufec.c" />

View File

@ -6,7 +6,6 @@
<ClCompile Include="$(OpenSSH-Src-Path)authfd.c" />
<ClCompile Include="$(OpenSSH-Src-Path)authfile.c" />
<ClCompile Include="$(OpenSSH-Src-Path)bitmap.c" />
<ClCompile Include="$(OpenSSH-Src-Path)blocks.c" />
<ClCompile Include="$(OpenSSH-Src-Path)bufaux.c" />
<ClCompile Include="$(OpenSSH-Src-Path)bufbn.c" />
<ClCompile Include="$(OpenSSH-Src-Path)bufec.c" />
@ -89,6 +88,7 @@
<ClCompile Include="$(OpenSSH-Src-Path)verify.c" />
<ClCompile Include="$(OpenSSH-Src-Path)xmalloc.c" />
<ClCompile Include="$(OpenSSH-Src-Path)kexgexs.c" />
<ClCompile Include="$(OpenSSH-Src-Path)platform-misc.c" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(OpenSSH-Src-Path)addrmatch.c">
@ -259,9 +259,6 @@
<ClCompile Include="$(OpenSSH-Src-Path)poly1305.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(OpenSSH-Src-Path)rsa.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(OpenSSH-Src-Path)sc25519.c">
<Filter>Source Files</Filter>
</ClCompile>

View File

@ -44,7 +44,6 @@
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\blowfish.c" />
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\bsd-asprintf.c" />
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\bsd-closefrom.c" />
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\bsd-cray.c" />
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\bsd-cygwin_util.c" />
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\bsd-getpagesize.c" />
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\bsd-getpeereid.c" />
@ -100,6 +99,7 @@
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\xcrypt.c" />
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\glob.c" />
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\strcasestr.c" />
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\strndup.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(OpenSSH-Src-Path)openbsd-compat\base64.h" />

View File

@ -39,9 +39,6 @@
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\bsd-closefrom.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\bsd-cray.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\bsd-cygwin_util.c">
<Filter>Source Files</Filter>
</ClCompile>
@ -207,6 +204,9 @@
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\strcasestr.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(OpenSSH-Src-Path)openbsd-compat\strndup.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(OpenSSH-Src-Path)openbsd-compat\base64.h">

View File

@ -51,8 +51,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 7,6,1,0
PRODUCTVERSION 7,6,1,0
FILEVERSION 7,7,0,0
PRODUCTVERSION 7,7,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -67,7 +67,7 @@ BEGIN
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileVersion", "7.6.1.0"
VALUE "FileVersion", "7.7.0.0"
VALUE "ProductName", "OpenSSH for Windows"
VALUE "ProductVersion", "OpenSSH_7.6p1 for Windows"
END

View File

@ -348,6 +348,8 @@
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\console.h" />
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\tnnet.h" />
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\spawn.h" />
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\net\if.h" />
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\time.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -9,7 +9,7 @@
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\misc.c" />
<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\signal_wait.c" />
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\signal_wait.c" />
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\w32log.c" />
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\pwd.c" />
<ClCompile Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\win32_dirent.c" />
@ -143,6 +143,12 @@
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\spawn.h">
<Filter>inc</Filter>
</ClInclude>
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\time.h">
<Filter>inc</Filter>
</ClInclude>
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\net\if.h">
<Filter>inc\net</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="inc">
@ -157,5 +163,8 @@
<Filter Include="inc\netinet">
<UniqueIdentifier>{d943f1aa-2df9-4df3-b499-4403a899fe8d}</UniqueIdentifier>
</Filter>
<Filter Include="inc\net">
<UniqueIdentifier>{b16bbf61-e602-4b0f-832b-190085cbfd5c}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

View File

@ -0,0 +1 @@
#pragma once

View File

@ -52,10 +52,8 @@ typedef int sigset_t;
#define W32_SIG_IGN ((sighandler_t)1)
sighandler_t w32_signal(int signum, sighandler_t handler);
//#define signal(a,b) w32_signal((a), (b))
//#define mysignal(a,b) w32_signal((a), (b))
sighandler_t mysignal(int signum, sighandler_t handler);
char* strsignal(int);
int w32_raise(int sig);
#define raise(a) w32_raise(a)

View File

@ -10,4 +10,6 @@ char *w32_strerror(int);
#define strdup _strdup
#define ERROR_MSG_MAXLEN 94 /* https://msdn.microsoft.com/en-us/library/51sah927.aspx */
static char errorBuf[ERROR_MSG_MAXLEN];
static char errorBuf[ERROR_MSG_MAXLEN];
char *strndup(const char*, size_t);

View File

@ -0,0 +1,4 @@
#include "crtheaders.h"
#include TIME_H
struct tm *localtime_r(const time_t *, struct tm *);

View File

@ -53,6 +53,7 @@
#include "w32fd.h"
#include "inc\string.h"
#include "inc\grp.h"
#include "inc\time.h"
static char* s_programdir = NULL;
@ -1540,3 +1541,10 @@ copy_file(char *source, char *destination)
return 0;
}
struct tm*
localtime_r(const time_t *timep, struct tm *result)
{
struct tm *t = localtime(timep);
memcpy(result, t, sizeof(struct tm));
return t;
}

View File

@ -130,6 +130,15 @@ mysignal(int signum, sighandler_t handler) {
return w32_signal(signum, handler);
}
char*
strsignal(int sig)
{
static char buf[16];
(void)snprintf(buf, sizeof(buf), "%d", sig);
return buf;
}
sighandler_t
w32_signal(int signum, sighandler_t handler)
{

View File

@ -211,33 +211,6 @@ tcsendbreak(int fd, int duration)
}
#endif /* HAVE_TCSENDBREAK */
mysig_t
mysignal(int sig, mysig_t act)
{
#ifdef HAVE_SIGACTION
struct sigaction sa, osa;
if (sigaction(sig, NULL, &osa) == -1)
return (mysig_t) -1;
if (osa.sa_handler != act) {
memset(&sa, 0, sizeof(sa));
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
#ifdef SA_INTERRUPT
if (sig == SIGALRM)
sa.sa_flags |= SA_INTERRUPT;
#endif
sa.sa_handler = act;
if (sigaction(sig, &sa, NULL) == -1)
return (mysig_t) -1;
}
return (osa.sa_handler);
#else
#undef signal
return (signal(sig, act));
#endif
}
#ifndef HAVE_STRDUP
char *
strdup(const char *str)