Skip to content

Commit 1ad6c95

Browse files
committed
Source snapshot from Powershell/openssh-portable:latestw_all
1 parent d6ce465 commit 1ad6c95

File tree

14 files changed

+29
-1096
lines changed

14 files changed

+29
-1096
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 0.0.23.0.{build}
1+
version: 0.0.24.0.{build}
22
image: Visual Studio 2015
33

44
branches:

contrib/win32/openssh/OpenSSHTestHelper.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ function Install-OpenSSHTestDependencies
337337
if (-not ($isModuleAvailable))
338338
{
339339
Write-Log -Message "Installing Pester..."
340-
choco install Pester -y --force --limitoutput 2>&1 >> $Script:TestSetupLogFile
340+
choco install Pester --version 3.4.6 -y --force --limitoutput 2>&1 >> $Script:TestSetupLogFile
341341
}
342342

343343
if($Script:PostmortemDebugging -or (($OpenSSHTestInfo -ne $null) -and ($OpenSSHTestInfo["PostmortemDebugging"])))

contrib/win32/openssh/install-sshd.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,10 @@ if (Get-Service ssh-agent -ErrorAction SilentlyContinue)
264264
sc.exe delete ssh-agent 1>$null
265265
}
266266

267-
New-Service -Name ssh-agent -BinaryPathName $sshagentpath -Description "SSH Agent" -StartupType Manual | Out-Null
267+
New-Service -Name ssh-agent -BinaryPathName `"$sshagentpath`" -Description "SSH Agent" -StartupType Manual | Out-Null
268268
cmd.exe /c 'sc.exe sdset ssh-agent D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;RP;;;AU)'
269269

270-
New-Service -Name sshd -BinaryPathName $sshdpath -Description "SSH Daemon" -StartupType Manual -DependsOn ssh-agent | Out-Null
270+
New-Service -Name sshd -BinaryPathName `"$sshdpath`" -Description "SSH Daemon" -StartupType Manual -DependsOn ssh-agent | Out-Null
271271
sc.exe config sshd obj= $sshdAccount
272272
sc.exe privs sshd SeAssignPrimaryTokenPrivilege
273273

contrib/win32/openssh/version.rc

0 Bytes
Binary file not shown.

contrib/win32/win32compat/fileio.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ fileio_stat(const char *path, struct _stat64 *buf)
811811
}
812812

813813
long
814-
fileio_lseek(struct w32_io* pio, long offset, int origin)
814+
fileio_lseek(struct w32_io* pio, unsigned __int64 offset, int origin)
815815
{
816816
debug4("lseek - pio:%p", pio);
817817
if (origin != SEEK_SET) {
@@ -820,8 +820,9 @@ fileio_lseek(struct w32_io* pio, long offset, int origin)
820820
return -1;
821821
}
822822

823-
pio->read_overlapped.Offset = offset;
824-
pio->write_overlapped.Offset = offset;
823+
pio->write_overlapped.Offset = pio->read_overlapped.Offset = offset & 0xffffffff;
824+
pio->write_overlapped.OffsetHigh = pio->read_overlapped.OffsetHigh = (offset & 0xffffffff00000000) >> 32;
825+
825826
return 0;
826827
}
827828

contrib/win32/win32compat/inc/unistd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int w32_dup2(int oldfd, int newfd);
4646
unsigned int w32_alarm(unsigned int seconds);
4747
#define alarm w32_alarm
4848

49-
long w32_lseek(int fd, long offset, int origin);
49+
long w32_lseek(int fd, unsigned __int64 offset, int origin);
5050
#define lseek w32_lseek
5151

5252
#define getdtablesize() MAX_FDS

contrib/win32/win32compat/logonuser.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ BOOL
4141
LogonUserExExWHelper(wchar_t *user_name, wchar_t *domain, wchar_t *password, DWORD logon_type,
4242
DWORD logon_provider, PTOKEN_GROUPS token_groups, PHANDLE token, PSID *logon_sid,
4343
PVOID *profile_buffer, LPDWORD profile_length, PQUOTA_LIMITS quota_limits)
44-
{
44+
{
4545
wchar_t sspicli_dll_path[MAX_PATH + 1] = { 0, };
46+
wchar_t advapi32_dll_path[MAX_PATH + 1] = { 0, };
4647
wchar_t system32_path[MAX_PATH + 1] = { 0, };
4748

4849
if (!GetSystemDirectoryW(system32_path, _countof(system32_path))) {
@@ -51,14 +52,23 @@ LogonUserExExWHelper(wchar_t *user_name, wchar_t *domain, wchar_t *password, DWO
5152
}
5253
wcsncpy_s(sspicli_dll_path, _countof(sspicli_dll_path), system32_path, wcsnlen(system32_path, _countof(system32_path)) + 1);
5354
wcscat_s(sspicli_dll_path, _countof(sspicli_dll_path), L"\\sspicli.dll");
55+
wcsncpy_s(advapi32_dll_path, _countof(advapi32_dll_path), system32_path, wcsnlen(system32_path, _countof(system32_path)) + 1);
56+
wcscat_s(advapi32_dll_path, _countof(advapi32_dll_path), L"\\advapi32.dll");
5457

55-
if (hMod == NULL)
58+
if (hMod == NULL) {
5659
hMod = LoadLibraryW(sspicli_dll_path);
60+
if (hMod == NULL)
61+
debug3("Failed to retrieve the module handle of sspicli.dll with error %d", GetLastError());
62+
}
63+
64+
if (hMod == NULL)
65+
hMod = LoadLibraryW(advapi32_dll_path);
5766

5867
if (hMod == NULL) {
59-
debug3("Failed to retrieve the module handle of sspicli.dll with error %d", GetLastError());
68+
debug3("Failed to retrieve the module handle of advapi32.dll with error %d", GetLastError());
6069
return FALSE;
61-
}
70+
}
71+
6272
if (func == NULL)
6373
func = (LogonUserExExWType)GetProcAddress(hMod, "LogonUserExExW");
6474

contrib/win32/win32compat/w32fd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ w32_fstat(int fd, struct w32_stat *buf)
484484
}
485485

486486
long
487-
w32_lseek(int fd, long offset, int origin)
487+
w32_lseek(int fd, unsigned __int64 offset, int origin)
488488
{
489489
CHECK_FD(fd);
490490
return fileio_lseek(fd_table.w32_ios[fd], offset, origin);

contrib/win32/win32compat/w32fd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,5 @@ int fileio_read(struct w32_io* pio, void *dst, size_t max);
163163
int fileio_write(struct w32_io* pio, const void *buf, size_t max);
164164
int fileio_fstat(struct w32_io* pio, struct _stat64 *buf);
165165
int fileio_stat(const char *path, struct _stat64 *buf);
166-
long fileio_lseek(struct w32_io* pio, long offset, int origin);
166+
long fileio_lseek(struct w32_io* pio, unsigned __int64 offset, int origin);
167167
FILE* fileio_fdopen(struct w32_io* pio, const char *mode);

contrib/win32/win32compat/wmain_sshd.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,14 @@ int sshd_main(int argc, wchar_t **wargv) {
124124
}
125125

126126
int wmain(int argc, wchar_t **wargv) {
127-
128127
if (!StartServiceCtrlDispatcherW(dispatch_table)) {
129-
if (GetLastError() != ERROR_FAILED_SERVICE_CONTROLLER_CONNECT)
128+
if (GetLastError() == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT)
129+
return sshd_main(argc, wargv); /* sshd running NOT as service*/
130+
else
130131
return -1;
131132
}
132133

133-
return sshd_main(argc, wargv);
134+
return 0;
134135
}
135136

136137
int scm_start_service(DWORD num, LPWSTR* args) {

rsa.c

Lines changed: 0 additions & 188 deletions
This file was deleted.

rsa.h

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)