secur32.lib \
ole32.lib \
oleaut32.lib \
- iphlpapi.lib shell32.lib
+ iphlpapi.lib shell32.lib shlwapi.lib
AFSD_EXELIBS =\
$(DESTDIR)\lib\libosi.lib \
#include <errno.h>
#include <windows.h>
+#include <shlwapi.h>
#include <winsock2.h>
#ifndef EWOULDBLOCK
#define EWOULDBLOCK WSAEWOULDBLOCK
return retval;
}
+BOOL
+cm_TargetPerceivedAsDirectory(const fschar_t *target)
+{
+ char * ext;
+
+ ext = PathFindExtension(target);
+ if (!ext[0])
+ return TRUE;
+
+ return FALSE;
+}
extern int cm_MatchMask(clientchar_t *namep, clientchar_t *maskp, int flags);
+extern BOOL cm_TargetPerceivedAsDirectory(const fschar_t *target);
+
#endif /* __CM_UTILS_H_ENV__ */
switch (scp->fileType) {
case CM_SCACHETYPE_DIRECTORY:
case CM_SCACHETYPE_MOUNTPOINT:
- case CM_SCACHETYPE_SYMLINK:
case CM_SCACHETYPE_INVALID:
attr = SMB_ATTR_DIRECTORY;
break;
+ case CM_SCACHETYPE_SYMLINK:
+ if (cm_TargetPerceivedAsDirectory(scp->mountPointStringp))
+ attr = SMB_ATTR_DIRECTORY;
+ else
+ attr = SMB_ATTR_NORMAL;
+ break;
default:
/* if we get here we either have a normal file
* or we have a file for which we have never
* received status info. In this case, we can
* check the even/odd value of the entry's vnode.
- * even means it is to be treated as a directory
- * and odd means it is to be treated as a file.
+ * odd means it is to be treated as a directory
+ * and even means it is to be treated as a file.
*/
if (mustFake && (scp->fid.vnode & 0x1))
attr = SMB_ATTR_DIRECTORY;
cm_SyncOpDone(newScp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
-#ifdef undef
- /* use smb_Attributes instead. Also the fact that a file is
- * in a readonly volume doesn't mean it shojuld be marked as RO
- */
- if (newScp->fileType == CM_SCACHETYPE_DIRECTORY ||
- newScp->fileType == CM_SCACHETYPE_MOUNTPOINT ||
- newScp->fileType == CM_SCACHETYPE_INVALID)
- attrs = SMB_ATTR_DIRECTORY;
- else
- attrs = 0;
- if ((newScp->unixModeBits & 0222) == 0 || (newScp->flags & CM_SCACHEFLAG_RO))
- attrs |= SMB_ATTR_READONLY; /* turn on read-only flag */
-#else
attrs = smb_Attributes(newScp);
-#endif
smb_SetSMBParm(outp, 0, attrs);
switch (scp->fileType) {
case CM_SCACHETYPE_DIRECTORY:
case CM_SCACHETYPE_MOUNTPOINT:
- case CM_SCACHETYPE_SYMLINK:
case CM_SCACHETYPE_INVALID:
fa->extFileAttributes = SMB_ATTR_DIRECTORY;
break;
+ case CM_SCACHETYPE_SYMLINK:
+ if (cm_TargetPerceivedAsDirectory(scp->mountPointStringp))
+ fa->extFileAttributes = SMB_ATTR_DIRECTORY;
+ else
+ fa->extFileAttributes = SMB_ATTR_NORMAL;
+ break;
default:
/* if we get here we either have a normal file
* or we have a file for which we have never
* received status info. In this case, we can
* check the even/odd value of the entry's vnode.
- * even means it is to be treated as a directory
- * and odd means it is to be treated as a file.
+ * odd means it is to be treated as a directory
+ * and even means it is to be treated as a file.
*/
if (mustFake && (scp->fid.vnode & 0x1))
fa->extFileAttributes = SMB_ATTR_DIRECTORY;
switch (scp->fileType) {
case CM_SCACHETYPE_DIRECTORY:
case CM_SCACHETYPE_MOUNTPOINT:
- case CM_SCACHETYPE_SYMLINK:
case CM_SCACHETYPE_INVALID:
fa->attributes = SMB_ATTR_DIRECTORY;
break;
+ case CM_SCACHETYPE_SYMLINK:
+ if (cm_TargetPerceivedAsDirectory(scp->mountPointStringp))
+ fa->attributes = SMB_ATTR_DIRECTORY;
+ else
+ fa->attributes = SMB_ATTR_NORMAL;
+ break;
default:
/* if we get here we either have a normal file
* or we have a file for which we have never
/* Copy attributes */
lattr = smb_ExtAttributes(scp);
- if (code == CM_ERROR_NOSUCHPATH && scp->fileType == CM_SCACHETYPE_SYMLINK ||
+ if ((code == CM_ERROR_NOSUCHPATH &&
+ (scp->fileType == CM_SCACHETYPE_SYMLINK &&
+ cm_TargetPerceivedAsDirectory(scp->mountPointStringp))) ||
code == CM_ERROR_PATH_NOT_COVERED && scp->fileType == CM_SCACHETYPE_DFSLINK) {
if (lattr == SMB_ATTR_NORMAL)
lattr = SMB_ATTR_DIRECTORY;