[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
This commit is contained in:
Olga Kornievskaia 2012-05-15 18:01:09 -04:00
parent 192a502785
commit 54551655d0

View file

@ -4746,8 +4746,28 @@ static NTSTATUS QueryCygwinEA(
goto out; goto out;
if (AnsiStrEq(&NfsSymlinkTargetName, query->EaName, query->EaNameLength)) { if (AnsiStrEq(&NfsSymlinkTargetName, query->EaName, query->EaNameLength)) {
__notnull PNFS41_FCB nfs41_fcb = NFS41GetFcbExtension(RxContext->pFcb);
if (nfs41_fcb->BasicInfo.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
status = QueryCygwinSymlink(RxContext, query, info); status = QueryCygwinSymlink(RxContext, query, info);
goto out; 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)) { if (AnsiStrEq(&NfsV3Attributes, query->EaName, query->EaNameLength)) {