From 54551655d08c15220bfd3ddcbb3110d658ecd3b5 Mon Sep 17 00:00:00 2001 From: Olga Kornievskaia Date: Tue, 15 May 2012 18:01:09 -0400 Subject: [PATCH] [symlink] fixing getea for symlinktargetname on regular file cygwin does geteas for regular files and asks for nfssymlinktargetname for which we were doing an upcall and failing nfs41_readlink() with err_invalid. instead check that it's not a symlink in the driver and reply as we used to with 0 eavaluelenth --- sys/nfs41_driver.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c index c4bb943..fcb90c9 100644 --- a/sys/nfs41_driver.c +++ b/sys/nfs41_driver.c @@ -4746,8 +4746,28 @@ static NTSTATUS QueryCygwinEA( goto out; if (AnsiStrEq(&NfsSymlinkTargetName, query->EaName, query->EaNameLength)) { - status = QueryCygwinSymlink(RxContext, query, info); - goto out; + __notnull PNFS41_FCB nfs41_fcb = NFS41GetFcbExtension(RxContext->pFcb); + if (nfs41_fcb->BasicInfo.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) { + status = QueryCygwinSymlink(RxContext, query, info); + goto out; + } else { + const LONG LengthRequired = sizeof(FILE_FULL_EA_INFORMATION) + + NfsSymlinkTargetName.Length - sizeof(CHAR); + if (LengthRequired > RxContext->Info.LengthRemaining) { + status = STATUS_BUFFER_TOO_SMALL; + RxContext->InformationToReturn = LengthRequired; + goto out; + } + info->NextEntryOffset = 0; + info->Flags = 0; + info->EaValueLength = 0; + info->EaNameLength = (UCHAR)NfsActOnLink.Length; + RtlCopyMemory(info->EaName, NfsSymlinkTargetName.Buffer, + NfsSymlinkTargetName.Length); + RxContext->Info.LengthRemaining = LengthRequired; + status = STATUS_SUCCESS; + goto out; + } } if (AnsiStrEq(&NfsV3Attributes, query->EaName, query->EaNameLength)) {