summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-09-10 01:58:51 +0000
committerJeremy Allison <jra@samba.org>2002-09-10 01:58:51 +0000
commitdf920a60b5f207149cbc9dcb63d406abb0d0490c (patch)
treec2ef644a20a1675e8203949e3b6f023cf5f04c20 /source3/smbd
parent8de41d59482e7d66824c4a69563875d768f1f100 (diff)
downloadsamba-df920a60b5f207149cbc9dcb63d406abb0d0490c.tar.gz
samba-df920a60b5f207149cbc9dcb63d406abb0d0490c.tar.bz2
samba-df920a60b5f207149cbc9dcb63d406abb0d0490c.zip
Added final Steve French patch for "required" attributes with old
dir listings. Added regression test in smbtorture (in HEAD) also. Jeremy. (This used to be commit 3c9d24d7c3bad2beb641880a97f0eda5cd3e4ec7)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/dir.c21
-rw-r--r--source3/smbd/reply.c8
2 files changed, 24 insertions, 5 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index bdcb4b0461..396ecd98c4 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -553,9 +553,24 @@ void *dptr_fetch_lanman2(int dptr_num)
BOOL dir_check_ftype(connection_struct *conn,int mode,SMB_STRUCT_STAT *st,int dirtype)
{
- if (((mode & ~dirtype) & (aHIDDEN | aSYSTEM | aDIR)) != 0)
- return False;
- return True;
+ int mask;
+
+ /* Check the "may have" search bits. */
+ if (((mode & ~dirtype) & (aHIDDEN | aSYSTEM | aDIR)) != 0)
+ return False;
+
+ /* Check the "must have" bits, which are the may have bits shifted eight */
+ /* If must have bit is set, the file/dir can not be returned in search unless the matching
+ file attribute is set */
+ mask = ((dirtype >> 8) & (aDIR|aARCH|aRONLY|aHIDDEN|aSYSTEM)); /* & 0x37 */
+ if(mask) {
+ if((mask & (mode & (aDIR|aARCH|aRONLY|aHIDDEN|aSYSTEM))) == mask) /* check if matching attribute present */
+ return True;
+ else
+ return False;
+ }
+
+ return True;
}
static BOOL mangle_mask_match(connection_struct *conn, char *filename, char *mask)
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 01e7df282c..2b361fd43a 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -673,12 +673,16 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
if (strlen(directory) == 0)
pstrcpy(directory,"./");
memset((char *)status,'\0',21);
- SCVAL(status,0,dirtype);
+ SCVAL(status,0,(dirtype & 0x1F));
}
else
{
+ int status_dirtype;
memcpy(status,p,21);
- dirtype = CVAL(status,0) & 0x1F;
+ status_dirtype = CVAL(status,0) & 0x1F;
+ if (status_dirtype != (dirtype & 0x1F))
+ dirtype = status_dirtype;
+
conn->dirptr = dptr_fetch(status+12,&dptr_num);
if (!conn->dirptr)
goto SearchEmpty;