diff options
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/dir.c | 20 | ||||
-rw-r--r-- | source3/smbd/trans2.c | 10 |
2 files changed, 20 insertions, 10 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 214b28dad0..32f2eb5e7d 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -412,6 +412,16 @@ void *dptr_fetch_lanman2(char *params,int dptr_num) } /**************************************************************************** +check a filetype for being valid +****************************************************************************/ +BOOL dir_check_ftype(int cnum,int mode,struct stat *st,int dirtype) +{ + if (((mode & ~dirtype) & (aHIDDEN | aSYSTEM | aDIR)) != 0) + return False; + return True; +} + +/**************************************************************************** get a directory entry ****************************************************************************/ BOOL get_dir_entry(int cnum,char *mask,int dirtype,char *fname,int *size,int *mode,time_t *date,BOOL check_descend) @@ -474,11 +484,11 @@ BOOL get_dir_entry(int cnum,char *mask,int dirtype,char *fname,int *size,int *mo *mode = dos_mode(cnum,pathreal,&sbuf); - if (((*mode & ~dirtype) & (aHIDDEN | aSYSTEM | aDIR)) != 0) - { - DEBUG(5,("[%s] attribs didn't match %x\n",filename,dirtype)); - continue; - } + if (!dir_check_ftype(cnum,*mode,&sbuf,dirtype)) { + DEBUG(5,("[%s] attribs didn't match %x\n",filename,dirtype)); + continue; + } + *size = sbuf.st_size; *date = sbuf.st_mtime; diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 36dd5eba3e..60e9ae2b29 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -325,11 +325,11 @@ static int get_lanman2_dir_entry(int cnum,char *path_mask,int dirtype,int info_l mode = dos_mode(cnum,pathreal,&sbuf); - if (((mode & ~dirtype) & (aHIDDEN | aSYSTEM | aDIR)) != 0) - { - DEBUG(5,("[%s] attribs didn't match %x\n",fname,dirtype)); - continue; - } + if (!dir_check_ftype(cnum,mode,&sbuf,dirtype)) { + DEBUG(5,("[%s] attribs didn't match %x\n",fname,dirtype)); + continue; + } + size = sbuf.st_size; mdate = sbuf.st_mtime; adate = sbuf.st_atime; |