Skip to content

Commit

Permalink
Source snapshot from Powershell/openssh-portable:latestw_all
Browse files Browse the repository at this point in the history
  • Loading branch information
bingbing8 committed Dec 5, 2017
1 parent d6ce465 commit 1ad6c95
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 1,096 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 0.0.23.0.{build}
version: 0.0.24.0.{build}
image: Visual Studio 2015

branches:
Expand Down
2 changes: 1 addition & 1 deletion contrib/win32/openssh/OpenSSHTestHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ function Install-OpenSSHTestDependencies
if (-not ($isModuleAvailable))
{
Write-Log -Message "Installing Pester..."
choco install Pester -y --force --limitoutput 2>&1 >> $Script:TestSetupLogFile
choco install Pester --version 3.4.6 -y --force --limitoutput 2>&1 >> $Script:TestSetupLogFile
}

if($Script:PostmortemDebugging -or (($OpenSSHTestInfo -ne $null) -and ($OpenSSHTestInfo["PostmortemDebugging"])))
Expand Down
4 changes: 2 additions & 2 deletions contrib/win32/openssh/install-sshd.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,10 @@ if (Get-Service ssh-agent -ErrorAction SilentlyContinue)
sc.exe delete ssh-agent 1>$null
}

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

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

Expand Down
Binary file modified contrib/win32/openssh/version.rc
Binary file not shown.
7 changes: 4 additions & 3 deletions contrib/win32/win32compat/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ fileio_stat(const char *path, struct _stat64 *buf)
}

long
fileio_lseek(struct w32_io* pio, long offset, int origin)
fileio_lseek(struct w32_io* pio, unsigned __int64 offset, int origin)
{
debug4("lseek - pio:%p", pio);
if (origin != SEEK_SET) {
Expand All @@ -820,8 +820,9 @@ fileio_lseek(struct w32_io* pio, long offset, int origin)
return -1;
}

pio->read_overlapped.Offset = offset;
pio->write_overlapped.Offset = offset;
pio->write_overlapped.Offset = pio->read_overlapped.Offset = offset & 0xffffffff;
pio->write_overlapped.OffsetHigh = pio->read_overlapped.OffsetHigh = (offset & 0xffffffff00000000) >> 32;

return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion contrib/win32/win32compat/inc/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int w32_dup2(int oldfd, int newfd);
unsigned int w32_alarm(unsigned int seconds);
#define alarm w32_alarm

long w32_lseek(int fd, long offset, int origin);
long w32_lseek(int fd, unsigned __int64 offset, int origin);
#define lseek w32_lseek

#define getdtablesize() MAX_FDS
Expand Down
18 changes: 14 additions & 4 deletions contrib/win32/win32compat/logonuser.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ BOOL
LogonUserExExWHelper(wchar_t *user_name, wchar_t *domain, wchar_t *password, DWORD logon_type,
DWORD logon_provider, PTOKEN_GROUPS token_groups, PHANDLE token, PSID *logon_sid,
PVOID *profile_buffer, LPDWORD profile_length, PQUOTA_LIMITS quota_limits)
{
{
wchar_t sspicli_dll_path[MAX_PATH + 1] = { 0, };
wchar_t advapi32_dll_path[MAX_PATH + 1] = { 0, };
wchar_t system32_path[MAX_PATH + 1] = { 0, };

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

if (hMod == NULL)
if (hMod == NULL) {
hMod = LoadLibraryW(sspicli_dll_path);
if (hMod == NULL)
debug3("Failed to retrieve the module handle of sspicli.dll with error %d", GetLastError());
}

if (hMod == NULL)
hMod = LoadLibraryW(advapi32_dll_path);

if (hMod == NULL) {
debug3("Failed to retrieve the module handle of sspicli.dll with error %d", GetLastError());
debug3("Failed to retrieve the module handle of advapi32.dll with error %d", GetLastError());
return FALSE;
}
}

if (func == NULL)
func = (LogonUserExExWType)GetProcAddress(hMod, "LogonUserExExW");

Expand Down
2 changes: 1 addition & 1 deletion contrib/win32/win32compat/w32fd.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ w32_fstat(int fd, struct w32_stat *buf)
}

long
w32_lseek(int fd, long offset, int origin)
w32_lseek(int fd, unsigned __int64 offset, int origin)
{
CHECK_FD(fd);
return fileio_lseek(fd_table.w32_ios[fd], offset, origin);
Expand Down
2 changes: 1 addition & 1 deletion contrib/win32/win32compat/w32fd.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,5 @@ int fileio_read(struct w32_io* pio, void *dst, size_t max);
int fileio_write(struct w32_io* pio, const void *buf, size_t max);
int fileio_fstat(struct w32_io* pio, struct _stat64 *buf);
int fileio_stat(const char *path, struct _stat64 *buf);
long fileio_lseek(struct w32_io* pio, long offset, int origin);
long fileio_lseek(struct w32_io* pio, unsigned __int64 offset, int origin);
FILE* fileio_fdopen(struct w32_io* pio, const char *mode);
7 changes: 4 additions & 3 deletions contrib/win32/win32compat/wmain_sshd.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,14 @@ int sshd_main(int argc, wchar_t **wargv) {
}

int wmain(int argc, wchar_t **wargv) {

if (!StartServiceCtrlDispatcherW(dispatch_table)) {
if (GetLastError() != ERROR_FAILED_SERVICE_CONTROLLER_CONNECT)
if (GetLastError() == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT)
return sshd_main(argc, wargv); /* sshd running NOT as service*/
else
return -1;
}

return sshd_main(argc, wargv);
return 0;
}

int scm_start_service(DWORD num, LPWSTR* args) {
Expand Down
188 changes: 0 additions & 188 deletions rsa.c

This file was deleted.

26 changes: 0 additions & 26 deletions rsa.h

This file was deleted.

Loading

0 comments on commit 1ad6c95

Please sign in to comment.