* path.cc (symlink_info::check_nfs_symlink): Reopen file with

FILE_READ_EA access since, surprisingly, you need it to read EAs even
	on NFS.
This commit is contained in:
Corinna Vinschen 2010-02-06 15:57:21 +00:00
parent b96600ef91
commit 38d9821daf
2 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2010-02-06 Corinna Vinschen <corinna@vinschen.de>
* path.cc (symlink_info::check_nfs_symlink): Reopen file with
FILE_READ_EA access since, surprisingly, you need it to read EAs even
on NFS.
2010-02-06 Corinna Vinschen <corinna@vinschen.de> 2010-02-06 Corinna Vinschen <corinna@vinschen.de>
* sec_auth.cc (get_full_privileged_inheritable_token): New function * sec_auth.cc (get_full_privileged_inheritable_token): New function

View File

@ -1884,6 +1884,7 @@ symlink_info::check_nfs_symlink (HANDLE h)
{ {
tmp_pathbuf tp; tmp_pathbuf tp;
NTSTATUS status; NTSTATUS status;
OBJECT_ATTRIBUTES attr;
IO_STATUS_BLOCK io; IO_STATUS_BLOCK io;
struct { struct {
FILE_GET_EA_INFORMATION fgei; FILE_GET_EA_INFORMATION fgei;
@ -1892,6 +1893,11 @@ symlink_info::check_nfs_symlink (HANDLE h)
PFILE_FULL_EA_INFORMATION pffei; PFILE_FULL_EA_INFORMATION pffei;
int res = 0; int res = 0;
InitializeObjectAttributes (&attr, &ro_u_empty, 0, h, NULL);
status = NtOpenFile (&h, FILE_READ_EA, &attr, &io, FILE_SHARE_VALID_FLAGS,
FILE_OPEN_REPARSE_POINT | FILE_OPEN_FOR_BACKUP_INTENT);
if (!NT_SUCCESS (status))
return 0;
/* To find out if the file is a symlink and to get the symlink target, /* To find out if the file is a symlink and to get the symlink target,
try to fetch the NfsSymlinkTargetName EA. */ try to fetch the NfsSymlinkTargetName EA. */
fgei_buf.fgei.NextEntryOffset = 0; fgei_buf.fgei.NextEntryOffset = 0;
@ -1900,6 +1906,7 @@ symlink_info::check_nfs_symlink (HANDLE h)
pffei = (PFILE_FULL_EA_INFORMATION) tp.w_get (); pffei = (PFILE_FULL_EA_INFORMATION) tp.w_get ();
status = NtQueryEaFile (h, &io, pffei, NT_MAX_PATH * sizeof (WCHAR), TRUE, status = NtQueryEaFile (h, &io, pffei, NT_MAX_PATH * sizeof (WCHAR), TRUE,
&fgei_buf.fgei, sizeof fgei_buf, NULL, TRUE); &fgei_buf.fgei, sizeof fgei_buf, NULL, TRUE);
NtClose (h);
if (NT_SUCCESS (status) && pffei->EaValueLength > 0) if (NT_SUCCESS (status) && pffei->EaValueLength > 0)
{ {
PWCHAR spath = (PWCHAR) PWCHAR spath = (PWCHAR)