From 077c788275bff6b17e5ba44d487135f74dbedaee Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 14 Jul 2008 14:10:19 +0000 Subject: [PATCH] windows-smb-misc-20080714 LICENSE MIT Fix declaration of smb_ParseStringBuf to be consistent with the prototype. If the fileType of a cm_scache_t is unknown and if the vnode is odd, then set the SMB_ATTR_DIRECTORY flag when reporting the DOS Extended Attributes. Fix the log message in smb_FindCMUserByName() to indicate "found" instead of "not found". --- src/WINNT/afsd/smb.c | 2 +- src/WINNT/afsd/smb3.c | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/WINNT/afsd/smb.c b/src/WINNT/afsd/smb.c index 562d107dc..2b6e12ec1 100644 --- a/src/WINNT/afsd/smb.c +++ b/src/WINNT/afsd/smb.c @@ -2512,7 +2512,7 @@ clientchar_t *smb_ParseStringCch(smb_packet_t * pktp, unsigned char * inp, } clientchar_t * -smb_ParseStringBuf(const char * bufbase, +smb_ParseStringBuf(const unsigned char * bufbase, cm_space_t ** stringspp, unsigned char *inp, size_t *pcb_max, char **chainpp, int flags) diff --git a/src/WINNT/afsd/smb3.c b/src/WINNT/afsd/smb3.c index 5c3932266..9bdcf0020 100644 --- a/src/WINNT/afsd/smb3.c +++ b/src/WINNT/afsd/smb3.c @@ -104,8 +104,11 @@ unsigned long smb_ExtAttributes(cm_scache_t *scp) #endif /* SPECIAL_FOLDERS */ } else if (scp->fileType == CM_SCACHETYPE_DFSLINK) { attrs = SMB_ATTR_DIRECTORY | SMB_ATTR_SPARSE_FILE; - } else + } else if (scp->fid.vnode & 0x1) + attrs = SMB_ATTR_DIRECTORY; + else attrs = 0; + /* * We used to mark a file RO if it was in an RO volume, but that * turns out to be impolitic in NT. See defect 10007. @@ -4073,7 +4076,6 @@ smb_ApplyV3DirListPatches(cm_scache_t *dscp,smb_dirListPatch_t **dirPatchespp, fa->extFileAttributes = SMB_ATTR_DIRECTORY; else fa->extFileAttributes = SMB_ATTR_NORMAL; - } /* merge in hidden attribute */ if ( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) { @@ -4096,8 +4098,19 @@ smb_ApplyV3DirListPatches(cm_scache_t *dscp,smb_dirListPatch_t **dirPatchespp, case CM_SCACHETYPE_SYMLINK: case CM_SCACHETYPE_INVALID: fa->attributes = SMB_ATTR_DIRECTORY; + break; default: - fa->attributes = SMB_ATTR_NORMAL; + /* 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. + */ + if (mustFake && (scp->fid.vnode & 0x1)) + fa->extFileAttributes = SMB_ATTR_DIRECTORY; + else + fa->extFileAttributes = SMB_ATTR_NORMAL; } /* merge in hidden (dot file) attribute */ if ( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) { @@ -8729,7 +8742,7 @@ cm_user_t *smb_FindCMUserByName(clientchar_t *usern, clientchar_t *machine, afs_ lock_ReleaseMutex(&unp->mx); osi_Log2(smb_logp,"smb_FindCMUserByName New user name[%S] machine[%S]",osi_LogSaveClientString(smb_logp,usern),osi_LogSaveClientString(smb_logp,machine)); } else { - osi_Log2(smb_logp,"smb_FindCMUserByName Not found name[%S] machine[%S]",osi_LogSaveClientString(smb_logp,usern),osi_LogSaveClientString(smb_logp,machine)); + osi_Log2(smb_logp,"smb_FindCMUserByName Found name[%S] machine[%S]",osi_LogSaveClientString(smb_logp,usern),osi_LogSaveClientString(smb_logp,machine)); } userp = unp->userp; cm_HoldUser(userp); -- 2.39.5