* path.cc (symlink_info::check_shortcut): Use ro_u_empty rather than
local UNICODE_STRING object. (symlink_info::check_sysfile): Ditto. Return immediately if NtOpenFile failed to avoid closing random handle. Improve debug output in case NtReadFile failed.
This commit is contained in:
parent
b5efabb284
commit
03c991fed4
|
@ -1,3 +1,11 @@
|
||||||
|
2010-06-09 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* path.cc (symlink_info::check_shortcut): Use ro_u_empty rather than
|
||||||
|
local UNICODE_STRING object.
|
||||||
|
(symlink_info::check_sysfile): Ditto. Return immediately if NtOpenFile
|
||||||
|
failed to avoid closing random handle. Improve debug output in case
|
||||||
|
NtReadFile failed.
|
||||||
|
|
||||||
2010-06-08 Corinna Vinschen <corinna@vinschen.de>
|
2010-06-08 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* path.cc (symlink_info::check): Set h to NULL after closing handle
|
* path.cc (symlink_info::check): Set h to NULL after closing handle
|
||||||
|
|
|
@ -1685,14 +1685,13 @@ symlink_info::check_shortcut (HANDLE in_h)
|
||||||
char *buf, *cp;
|
char *buf, *cp;
|
||||||
unsigned short len;
|
unsigned short len;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
UNICODE_STRING same = { 0, 0, (PWCHAR) L"" };
|
|
||||||
OBJECT_ATTRIBUTES attr;
|
OBJECT_ATTRIBUTES attr;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
IO_STATUS_BLOCK io;
|
IO_STATUS_BLOCK io;
|
||||||
FILE_STANDARD_INFORMATION fsi;
|
FILE_STANDARD_INFORMATION fsi;
|
||||||
|
|
||||||
InitializeObjectAttributes (&attr, &same, 0, in_h, NULL);
|
InitializeObjectAttributes (&attr, &ro_u_empty, 0, in_h, NULL);
|
||||||
status = NtOpenFile (&h, FILE_READ_DATA | SYNCHRONIZE,
|
status = NtOpenFile (&h, FILE_READ_DATA | SYNCHRONIZE,
|
||||||
&attr, &io, FILE_SHARE_VALID_FLAGS,
|
&attr, &io, FILE_SHARE_VALID_FLAGS,
|
||||||
FILE_OPEN_FOR_BACKUP_INTENT
|
FILE_OPEN_FOR_BACKUP_INTENT
|
||||||
|
@ -1773,25 +1772,24 @@ symlink_info::check_sysfile (HANDLE in_h)
|
||||||
char cookie_buf[sizeof (SYMLINK_COOKIE) - 1];
|
char cookie_buf[sizeof (SYMLINK_COOKIE) - 1];
|
||||||
char *srcbuf = tp.c_get ();
|
char *srcbuf = tp.c_get ();
|
||||||
int res = 0;
|
int res = 0;
|
||||||
UNICODE_STRING same = { 0, 0, (PWCHAR) L"" };
|
|
||||||
OBJECT_ATTRIBUTES attr;
|
OBJECT_ATTRIBUTES attr;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
IO_STATUS_BLOCK io;
|
IO_STATUS_BLOCK io;
|
||||||
bool interix_symlink = false;
|
bool interix_symlink = false;
|
||||||
|
|
||||||
InitializeObjectAttributes (&attr, &same, 0, in_h, NULL);
|
InitializeObjectAttributes (&attr, &ro_u_empty, 0, in_h, NULL);
|
||||||
status = NtOpenFile (&h, FILE_READ_DATA | SYNCHRONIZE,
|
status = NtOpenFile (&h, FILE_READ_DATA | SYNCHRONIZE,
|
||||||
&attr, &io, FILE_SHARE_VALID_FLAGS,
|
&attr, &io, FILE_SHARE_VALID_FLAGS,
|
||||||
FILE_OPEN_FOR_BACKUP_INTENT
|
FILE_OPEN_FOR_BACKUP_INTENT
|
||||||
| FILE_SYNCHRONOUS_IO_NONALERT);
|
| FILE_SYNCHRONOUS_IO_NONALERT);
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
;
|
return 0;
|
||||||
else if (!NT_SUCCESS (status = NtReadFile (h, NULL, NULL, NULL, &io,
|
else if (!NT_SUCCESS (status = NtReadFile (h, NULL, NULL, NULL, &io,
|
||||||
cookie_buf, sizeof (cookie_buf),
|
cookie_buf, sizeof (cookie_buf),
|
||||||
NULL, NULL)))
|
NULL, NULL)))
|
||||||
{
|
{
|
||||||
debug_printf ("ReadFile1 failed");
|
debug_printf ("ReadFile1 failed %p", status);
|
||||||
if (status != STATUS_END_OF_FILE)
|
if (status != STATUS_END_OF_FILE)
|
||||||
set_error (EIO);
|
set_error (EIO);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue