Skip to content

Commit cf06f99

Browse files
authored
CHROOT - fix symbolic link that refers to a network share (#596)
1 parent 4833dda commit cf06f99

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

contrib/win32/openssh/OpenSSH-build.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,4 @@ try
4646
finally
4747
{
4848
Pop-Location
49-
}
50-
49+
}

contrib/win32/win32compat/fileio.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,14 @@ file_in_chroot_jail(HANDLE handle) {
427427
if (!final_path)
428428
return 0;
429429

430+
const wchar_t* uncPrefix = L"UNC\\";
431+
int isUNCPath = memcmp(final_path, uncPrefix, 2 * wcslen(uncPrefix));
432+
433+
if (0 == isUNCPath) {
434+
debug3("symlink points to UNCPath");
435+
return 1;
436+
}
437+
430438
to_wlower_case(final_path);
431439
if ((wcslen(final_path) < wcslen(chroot_pathw)) ||
432440
memcmp(final_path, chroot_pathw, 2 * wcslen(chroot_pathw)) != 0 ||

0 commit comments

Comments
 (0)