}
- //
- // For Symlinks and Mount Points the reparse point attribute
- // must be associated with the directory entry. In addition,
- // for Symlinks it must be determined if the target object is
- // a directory or not. If so, the directory attribute must be
- // specified. Mount points always refer to directories and
- // must have the directory attribute set.
- //
-
- switch( pObjectInfo->FileType)
- {
-
- case AFS_FILE_TYPE_MOUNTPOINT:
- case AFS_FILE_TYPE_DFSLINK:
- {
-
- ulAdditionalAttributes = FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT;
-
- break;
- }
-
- case AFS_FILE_TYPE_SYMLINK:
+ switch ( FileInformationClass)
{
+ case FileIdBothDirectoryInformation:
+ case FileBothDirectoryInformation:
+ case FileIdFullDirectoryInformation:
+ case FileFullDirectoryInformation:
+ case FileDirectoryInformation:
//
- // Go grab the file information for this entry
- // No worries on failures since we will just display
- // pseudo information
+ // For Symlinks and Mount Points the reparse point attribute
+ // must be associated with the directory entry. In addition,
+ // for Symlinks it must be determined if the target object is
+ // a directory or not. If so, the directory attribute must be
+ // specified. Mount points always refer to directories and
+ // must have the directory attribute set.
//
- RtlZeroMemory( &stFileInfo,
- sizeof( AFSFileInfoCB));
-
- if( NT_SUCCESS( AFSRetrieveFileAttributes( pCcb->DirectoryCB,
- pDirEntry,
- &pCcb->FullFileName,
- pCcb->NameArray,
- &pCcb->AuthGroup,
- &stFileInfo)))
+ switch( pObjectInfo->FileType)
{
- if ( stFileInfo.FileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ case AFS_FILE_TYPE_MOUNTPOINT:
+ case AFS_FILE_TYPE_DFSLINK:
{
- ulAdditionalAttributes = FILE_ATTRIBUTE_DIRECTORY;
+ ulAdditionalAttributes = FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT;
+
+ break;
}
- }
- ulAdditionalAttributes |= FILE_ATTRIBUTE_REPARSE_POINT;
+ case AFS_FILE_TYPE_SYMLINK:
+ {
- break;
- }
+ //
+ // Go grab the file information for this entry
+ // No worries on failures since we will just display
+ // pseudo information
+ //
+
+ RtlZeroMemory( &stFileInfo,
+ sizeof( AFSFileInfoCB));
+
+ if( NT_SUCCESS( AFSRetrieveFileAttributes( pCcb->DirectoryCB,
+ pDirEntry,
+ &pCcb->FullFileName,
+ pCcb->NameArray,
+ &pCcb->AuthGroup,
+ &stFileInfo)))
+ {
+
+ if ( stFileInfo.FileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ {
+
+ ulAdditionalAttributes = FILE_ATTRIBUTE_DIRECTORY;
+ }
+ }
+
+ ulAdditionalAttributes |= FILE_ATTRIBUTE_REPARSE_POINT;
+
+ break;
+ }
+ }
}
//
PUCHAR pBuffer = NULL;
ULONG ulBaseLength = 0;
ULONG ulAdditionalAttributes = 0;
- AFSFileInfoCB stFileInfo;
ULONG ulBytesConverted = 0;
PFILE_DIRECTORY_INFORMATION pDirInfo;
PFILE_FULL_DIR_INFORMATION pFullDirInfo;
AFSReleaseResource( &pFcb->NPFcb->Resource);
+ //
+ // Its a reparse point regardless of whether the file attributes
+ // can be retrieved for the target.
+ //
+
+ if ( ulFileAttribs == FILE_ATTRIBUTE_NORMAL)
+ {
+
+ ulFileAttribs = FILE_ATTRIBUTE_REPARSE_POINT;
+ }
+ else
+ {
+
+ ulFileAttribs |= FILE_ATTRIBUTE_REPARSE_POINT;
+ }
+
if( NT_SUCCESS( AFSRetrieveFileAttributes( pParentDirectoryCB,
DirectoryCB,
&uniParentPath,
&stFileInfo)))
{
- if ( ulFileAttribs == FILE_ATTRIBUTE_NORMAL)
- {
-
- ulFileAttribs = FILE_ATTRIBUTE_REPARSE_POINT;
- }
- else
- {
-
- ulFileAttribs |= FILE_ATTRIBUTE_REPARSE_POINT;
- }
-
if ( stFileInfo.FileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
AFSReleaseResource( &pFcb->NPFcb->Resource);
+ //
+ // Its a reparse point regardless of whether or not the
+ // file attributes can be retrieved.
+ //
+
+ if ( ulFileAttribs == FILE_ATTRIBUTE_NORMAL)
+ {
+
+ ulFileAttribs = FILE_ATTRIBUTE_REPARSE_POINT;
+ }
+ else
+ {
+
+ ulFileAttribs |= FILE_ATTRIBUTE_REPARSE_POINT;
+ }
+
if( NT_SUCCESS( AFSRetrieveFileAttributes( pParentDirectoryCB,
DirectoryCB,
&uniParentPath,
&stFileInfo)))
{
- if ( ulFileAttribs == FILE_ATTRIBUTE_NORMAL)
- {
-
- ulFileAttribs = FILE_ATTRIBUTE_REPARSE_POINT;
- }
- else
- {
-
- ulFileAttribs |= FILE_ATTRIBUTE_REPARSE_POINT;
- }
-
if ( stFileInfo.FileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
AFSReleaseResource( &pFcb->NPFcb->Resource);
+ //
+ // Its a reparse point regardless of whether the file attributes
+ // can be retrieved for the target.
+ //
+
+ if ( ulFileAttribs == FILE_ATTRIBUTE_NORMAL)
+ {
+
+ ulFileAttribs = FILE_ATTRIBUTE_REPARSE_POINT;
+ }
+ else
+ {
+
+ ulFileAttribs |= FILE_ATTRIBUTE_REPARSE_POINT;
+ }
+
if( NT_SUCCESS( AFSRetrieveFileAttributes( pParentDirectoryCB,
DirectoryCB,
&uniParentPath,
&stFileInfo)))
{
- if ( ulFileAttribs == FILE_ATTRIBUTE_NORMAL)
- {
-
- ulFileAttribs = FILE_ATTRIBUTE_REPARSE_POINT;
- }
- else
- {
-
- ulFileAttribs |= FILE_ATTRIBUTE_REPARSE_POINT;
- }
-
if ( stFileInfo.FileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
AFSReleaseResource( &pFcb->NPFcb->Resource);
+ //
+ // Its a reparse point regardless of whether the file attributes
+ // can be retrieved for the target.
+ //
+
+ if ( ulFileAttribs == FILE_ATTRIBUTE_NORMAL)
+ {
+
+ ulFileAttribs = FILE_ATTRIBUTE_REPARSE_POINT;
+ }
+ else
+ {
+
+ ulFileAttribs |= FILE_ATTRIBUTE_REPARSE_POINT;
+ }
+
if( NT_SUCCESS( AFSRetrieveFileAttributes( pParentDirectoryCB,
DirectoryCB,
&uniParentPath,
&stFileInfo)))
{
- if ( ulFileAttribs == FILE_ATTRIBUTE_NORMAL)
- {
-
- ulFileAttribs = FILE_ATTRIBUTE_REPARSE_POINT;
- }
- else
- {
-
- ulFileAttribs |= FILE_ATTRIBUTE_REPARSE_POINT;
- }
-
if ( stFileInfo.FileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
pObjectInfoCB->FileAttributes = DirEnumEntry->FileAttributes;
- if( pObjectInfoCB->FileType == AFS_FILE_TYPE_MOUNTPOINT)
+ if( pObjectInfoCB->FileType == AFS_FILE_TYPE_MOUNTPOINT ||
+ pObjectInfoCB->FileType == AFS_FILE_TYPE_DFSLINK)
{
- pObjectInfoCB->FileAttributes = (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT);
+ pObjectInfoCB->FileAttributes |= (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT);
}
- if (pObjectInfoCB->FileType == AFS_FILE_TYPE_SYMLINK ||
- pObjectInfoCB->FileType == AFS_FILE_TYPE_DFSLINK)
+ if (pObjectInfoCB->FileType == AFS_FILE_TYPE_SYMLINK)
{
- pObjectInfoCB->FileAttributes = FILE_ATTRIBUTE_REPARSE_POINT;
+ if ( pObjectInfoCB->FileAttributes == FILE_ATTRIBUTE_NORMAL)
+ {
+
+ pObjectInfoCB->FileAttributes = FILE_ATTRIBUTE_REPARSE_POINT;
+ }
+ else
+ {
+
+ pObjectInfoCB->FileAttributes |= FILE_ATTRIBUTE_REPARSE_POINT;
+ }
}
pObjectInfoCB->EaSize = DirEnumEntry->EaSize;
DirEntry->ObjectInformation->FileAttributes = pDirEntry->FileAttributes;
- if( pDirEntry->FileType == AFS_FILE_TYPE_MOUNTPOINT)
+ if( pDirEntry->FileType == AFS_FILE_TYPE_MOUNTPOINT ||
+ pDirEntry->FileType == AFS_FILE_TYPE_DFSLINK)
{
- DirEntry->ObjectInformation->FileAttributes = (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT);
+ DirEntry->ObjectInformation->FileAttributes |= (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT);
}
- if( pDirEntry->FileType == AFS_FILE_TYPE_SYMLINK ||
- pDirEntry->FileType == AFS_FILE_TYPE_DFSLINK)
+ if( pDirEntry->FileType == AFS_FILE_TYPE_SYMLINK)
{
- DirEntry->ObjectInformation->FileAttributes = FILE_ATTRIBUTE_REPARSE_POINT;
+ if ( DirEntry->ObjectInformation->FileAttributes == FILE_ATTRIBUTE_NORMAL)
+ {
+
+ DirEntry->ObjectInformation->FileAttributes = FILE_ATTRIBUTE_REPARSE_POINT;
+ }
+ else
+ {
+
+ DirEntry->ObjectInformation->FileAttributes |= FILE_ATTRIBUTE_REPARSE_POINT;
+ }
}
DirEntry->ObjectInformation->EaSize = pDirEntry->EaSize;
DirEntry->ObjectInformation->FileAttributes = pDirEntry->FileAttributes;
- if( pDirEntry->FileType == AFS_FILE_TYPE_MOUNTPOINT)
+ if( pDirEntry->FileType == AFS_FILE_TYPE_MOUNTPOINT ||
+ pDirEntry->FileType == AFS_FILE_TYPE_DFSLINK)
{
- DirEntry->ObjectInformation->FileAttributes = (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT);
+ DirEntry->ObjectInformation->FileAttributes |= (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT);
}
- if( pDirEntry->FileType == AFS_FILE_TYPE_SYMLINK ||
- pDirEntry->FileType == AFS_FILE_TYPE_DFSLINK)
+ if( pDirEntry->FileType == AFS_FILE_TYPE_SYMLINK)
{
- DirEntry->ObjectInformation->FileAttributes = FILE_ATTRIBUTE_REPARSE_POINT;
+ if ( DirEntry->ObjectInformation->FileAttributes == FILE_ATTRIBUTE_NORMAL)
+ {
+
+ DirEntry->ObjectInformation->FileAttributes = FILE_ATTRIBUTE_REPARSE_POINT;
+ }
+ else
+ {
+
+ DirEntry->ObjectInformation->FileAttributes |= FILE_ATTRIBUTE_REPARSE_POINT;
+ }
}
DirEntry->ObjectInformation->EaSize = pDirEntry->EaSize;
pObjectInfo->FileAttributes = DirEnumEntry->FileAttributes;
- if( pObjectInfo->FileType == AFS_FILE_TYPE_MOUNTPOINT)
+ if( pObjectInfo->FileType == AFS_FILE_TYPE_MOUNTPOINT ||
+ pObjectInfo->FileType == AFS_FILE_TYPE_DFSLINK)
{
- pObjectInfo->FileAttributes = (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT);
+ pObjectInfo->FileAttributes |= (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT);
}
- if( pObjectInfo->FileType == AFS_FILE_TYPE_SYMLINK ||
- pObjectInfo->FileType == AFS_FILE_TYPE_DFSLINK)
+ if( pObjectInfo->FileType == AFS_FILE_TYPE_SYMLINK)
{
- pObjectInfo->FileAttributes = FILE_ATTRIBUTE_REPARSE_POINT;
+ if ( pObjectInfo->FileAttributes == FILE_ATTRIBUTE_NORMAL)
+ {
+
+ pObjectInfo->FileAttributes = FILE_ATTRIBUTE_REPARSE_POINT;
+ }
+ else
+ {
+
+ pObjectInfo->FileAttributes |= FILE_ATTRIBUTE_REPARSE_POINT;
+ }
}
pObjectInfo->EaSize = DirEnumEntry->EaSize;
// Check for the mount point being returned
//
- if( pDirectoryEntry->ObjectInformation->FileType == AFS_FILE_TYPE_MOUNTPOINT)
+ if( pDirectoryEntry->ObjectInformation->FileType == AFS_FILE_TYPE_MOUNTPOINT ||
+ pDirectoryEntry->ObjectInformation->FileType == AFS_FILE_TYPE_DFSLINK)
{
- FileInfo->FileAttributes = (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT);
+ FileInfo->FileAttributes |= (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT);
}
- else if( pDirectoryEntry->ObjectInformation->FileType == AFS_FILE_TYPE_SYMLINK ||
- pDirectoryEntry->ObjectInformation->FileType == AFS_FILE_TYPE_DFSLINK)
+ else if( pDirectoryEntry->ObjectInformation->FileType == AFS_FILE_TYPE_SYMLINK)
{
if ( FileInfo->FileAttributes == FILE_ATTRIBUTE_NORMAL)
break;
case CM_SCACHETYPE_MOUNTPOINT:
case CM_SCACHETYPE_INVALID:
+ case CM_SCACHETYPE_DFSLINK:
pCurrentEntry->FileAttributes = SMB_ATTR_DIRECTORY | SMB_ATTR_REPARSE_POINT;
break;
case CM_SCACHETYPE_SYMLINK:
pCurrentEntry->FileId.Unique = fidp->unique;
pCurrentEntry->FileId.Hash = fidp->hash;
- pCurrentEntry->FileType = CM_SCACHETYPE_UNKNOWN;
-
pCurrentEntry->DataVersion.QuadPart = CM_SCACHE_VERSION_BAD;
cm_LargeSearchTimeFromUnixTime(&ft, 0);
pCurrentEntry->EndOfFile.QuadPart = 0;
pCurrentEntry->AllocationSize.QuadPart = 0;
- pCurrentEntry->FileAttributes = 0;
+ if (fidp->vnode & 0x1) {
+ pCurrentEntry->FileType = CM_SCACHETYPE_DIRECTORY;
+ pCurrentEntry->FileAttributes = SMB_ATTR_DIRECTORY;
+ } else {
+ pCurrentEntry->FileType = CM_SCACHETYPE_UNKNOWN;
+ pCurrentEntry->FileAttributes = SMB_ATTR_NORMAL;
pCurrentEntry->EaSize = 0;
+ }
pCurrentEntry->Links = 0;
len = wcslen(shortName);