From 26787c7b29d3612c78306e2a9ea0382f089b5a2b Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 19 Aug 2015 23:31:19 +0000 Subject: win32.c: support known reparse points only * dir.c (replace_real_basename), win32/win32.c (opendir_internal): check reparse point tags and treat supported tags only as symbolic links. [ruby-core:70454] [Bug #11462] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- dir.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'dir.c') diff --git a/dir.c b/dir.c index b75e6d63c5..abb5295dc8 100644 --- a/dir.c +++ b/dir.c @@ -1512,6 +1512,7 @@ replace_real_basename(char *path, long base, rb_encoding *enc, int norm_p, int f } #elif defined _WIN32 VALUE rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc); +int rb_w32_reparse_symlink_p(const WCHAR *path); static char * replace_real_basename(char *path, long base, rb_encoding *enc, int norm_p, int flags, rb_pathtype_t *type) @@ -1539,6 +1540,10 @@ replace_real_basename(char *path, long base, rb_encoding *enc, int norm_p, int f h = FindFirstFileW(wplain, &fd); e = rb_w32_map_errno(GetLastError()); } + if (fa.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) { + if (!rb_w32_reparse_symlink_p(wplain)) + fa.dwFileAttributes &= ~FILE_ATTRIBUTE_REPARSE_POINT; + } free(wplain); if (h == INVALID_HANDLE_VALUE) { *type = path_noent; -- cgit v1.2.3