From a8599a126513548bac790a2cbe4cbd1153312ef5 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 16 Mar 2013 01:13:01 -0400 Subject: [PATCH] Windows: add RDR_ExtAttributes Add RDR_ExtAttributes to compute the file attributes for redirector queries. The attributes reported via the RDR interface need to be different from the SMB interface because the SMB interface does not support reparse points nor does it support DFSLinks. Change-Id: I5d5172f5afc1d50e2622e2068e20447cd1098fbb Reviewed-on: http://gerrit.openafs.org/9611 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsrdr/user/RDRFunction.c | 34 ++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/WINNT/afsrdr/user/RDRFunction.c b/src/WINNT/afsrdr/user/RDRFunction.c index cb678bb92..7d86f5c00 100644 --- a/src/WINNT/afsrdr/user/RDRFunction.c +++ b/src/WINNT/afsrdr/user/RDRFunction.c @@ -108,6 +108,38 @@ RDR_FID2fid( AFSFileID *FileId, cm_fid_t *fid) fid->hash = FileId->Hash; } +unsigned long +RDR_ExtAttributes(cm_scache_t *scp) +{ + unsigned long attrs; + + if (scp->fileType == CM_SCACHETYPE_DIRECTORY || + scp->fid.vnode & 0x1) + { + attrs = SMB_ATTR_DIRECTORY; +#ifdef SPECIAL_FOLDERS + attrs |= SMB_ATTR_SYSTEM; /* FILE_ATTRIBUTE_SYSTEM */ +#endif /* SPECIAL_FOLDERS */ + } else if ( scp->fileType == CM_SCACHETYPE_MOUNTPOINT || + scp->fileType == CM_SCACHETYPE_DFSLINK || + scp->fileType == CM_SCACHETYPE_INVALID) + { + attrs = SMB_ATTR_DIRECTORY | SMB_ATTR_REPARSE_POINT; + } else if ( scp->fileType == CM_SCACHETYPE_SYMLINK) { + attrs = SMB_ATTR_REPARSE_POINT; + } else { + attrs = 0; + } + + if ((scp->unixModeBits & 0200) == 0) + attrs |= SMB_ATTR_READONLY; /* Read-only */ + + if (attrs == 0) + attrs = SMB_ATTR_NORMAL; /* FILE_ATTRIBUTE_NORMAL */ + + return attrs; +} + DWORD RDR_SetInitParams( OUT AFSRedirectorInitInfo **ppRedirInitInfo, OUT DWORD * pRedirInitInfoLen ) { @@ -530,7 +562,7 @@ RDR_PopulateCurrentEntry( IN AFSDirEnumEntry * pCurrentEntry, pCurrentEntry->FileAttributes = SMB_ATTR_NORMAL; } } else - pCurrentEntry->FileAttributes = smb_ExtAttributes(scp); + pCurrentEntry->FileAttributes = RDR_ExtAttributes(scp); pCurrentEntry->EaSize = 0; pCurrentEntry->Links = scp->linkCount; -- 2.39.5