SCP bug fix: SCP does not copy file exceeds 2,147,483,648 bytes. (https://github.com/PowerShell/Win32-OpenSSH/issues/145) (#70)

* SCP bug fix: https://github.com/PowerShell/Win32-OpenSSH/issues/145

1. update the install-sshd does not failed when log folder exists.
2. enable to copy files larger than 2G

* update the new-item usage

* exclude unittest-sshkey.exe temperately

* move declaration to top

* update white spaces

* Remove the memset
This commit is contained in:
Yanbing 2017-01-31 20:07:29 -08:00 committed by Manoj Ampalam
parent 7efb5b5a16
commit 47c4ec917b
3 changed files with 16 additions and 10 deletions

View File

@ -691,7 +691,7 @@ function Run-OpenSSHUnitTest
Remove-Item -Path $unitTestOutputFile -Force -ErrorAction SilentlyContinue Remove-Item -Path $unitTestOutputFile -Force -ErrorAction SilentlyContinue
} }
$unitTestFiles = Get-ChildItem -Path "$testRoot\unittest*.exe" -Exclude unittest-kex.exe $unitTestFiles = Get-ChildItem -Path "$testRoot\unittest*.exe" -Exclude unittest-kex.exe,unittest-hostkeys.exe
$testfailed = $false $testfailed = $false
if ($unitTestFiles -ne $null) if ($unitTestFiles -ne $null)
{ {

View File

@ -38,7 +38,10 @@ cd $scriptdir
cmd.exe /c $ntrights cmd.exe /c $ntrights
Pop-Location Pop-Location
mkdir $logsdir > $null if(-not (test-path $logsdir -PathType Container))
{
$null = New-Item $logsdir -ItemType Directory -Force -ErrorAction Stop
}
$rights = [System.Security.AccessControl.FileSystemRights]"Read, Write" $rights = [System.Security.AccessControl.FileSystemRights]"Read, Write"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($account, $rights, "ContainerInherit,ObjectInherit", "None", "Allow") $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($account, $rights, "ContainerInherit,ObjectInherit", "None", "Allow")
$acl = Get-Acl -Path $logsdir $acl = Get-Acl -Path $logsdir

View File

@ -812,9 +812,12 @@ int w32_allocate_fd_for_handle(HANDLE h, BOOL is_sock) {
int int
w32_ftruncate(int fd, off_t length) { w32_ftruncate(int fd, off_t length) {
LARGE_INTEGER new_postion;
CHECK_FD(fd); CHECK_FD(fd);
if (!SetFilePointer(w32_fd_to_handle(fd), length, 0, FILE_BEGIN)) new_postion.QuadPart = length;
if (!SetFilePointerEx(w32_fd_to_handle(fd), new_postion, 0, FILE_BEGIN))
return -1; return -1;
if (!SetEndOfFile(w32_fd_to_handle(fd))) if (!SetEndOfFile(w32_fd_to_handle(fd)))
return -1; return -1;