From 1fe89d0b716ccd9fca4abe4daf89df063b38f4b3 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Sun, 6 Jul 1997 13:48:10 +0000 Subject: added, tested and debugged new "hide files" option. lkcl (This used to be commit 60af320a436c3a26230fd7ac71856e67ef64e819) --- source3/smbd/dir.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'source3/smbd/dir.c') diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 1d0228864c..2a219e0281 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -108,7 +108,7 @@ static void dptr_idleoldest(void) /**************************************************************************** get the dir ptr for a dir index ****************************************************************************/ -static void *dptr_get(int key,uint32 lastused) +static void *dptr_get(int snum, int key,uint32 lastused) { if (dirptrs[key].valid) { if (lastused) dirptrs[key].lastused = lastused; @@ -116,7 +116,7 @@ static void *dptr_get(int key,uint32 lastused) if (dptrs_open >= MAXDIR) dptr_idleoldest(); DEBUG(4,("Reopening dptr key %d\n",key)); - if ((dirptrs[key].ptr = OpenDir(dirptrs[key].path, True))) + if ((dirptrs[key].ptr = OpenDir(snum, dirptrs[key].path, True))) dptrs_open++; } return(dirptrs[key].ptr); @@ -259,7 +259,7 @@ static BOOL start_dir(int cnum,char *directory) if (! *directory) directory = "."; - Connections[cnum].dirptr = OpenDir(directory, True); + Connections[cnum].dirptr = OpenDir(SNUM(cnum), directory, True); if (Connections[cnum].dirptr) { dptrs_open++; string_set(&Connections[cnum].dirpath,directory); @@ -345,10 +345,10 @@ int dptr_create(int cnum,char *path, BOOL expect_close,int pid) /**************************************************************************** fill the 5 byte server reserved dptr field ****************************************************************************/ -BOOL dptr_fill(char *buf1,unsigned int key) +BOOL dptr_fill(int snum, char *buf1,unsigned int key) { unsigned char *buf = (unsigned char *)buf1; - void *p = dptr_get(key,0); + void *p = dptr_get(snum, key,0); uint32 offset; if (!p) { DEBUG(1,("filling null dirptr %d\n",key)); @@ -373,10 +373,10 @@ BOOL dptr_zero(char *buf) /**************************************************************************** fetch the dir ptr and seek it given the 5 byte server field ****************************************************************************/ -void *dptr_fetch(char *buf,int *num) +void *dptr_fetch(int snum, char *buf,int *num) { unsigned int key = *(unsigned char *)buf; - void *p = dptr_get(key,dircounter++); + void *p = dptr_get(snum, key,dircounter++); uint32 offset; if (!p) { DEBUG(3,("fetched null dirptr %d\n",key)); @@ -393,9 +393,9 @@ void *dptr_fetch(char *buf,int *num) /**************************************************************************** fetch the dir ptr and seek it given the lanman2 parameter block ****************************************************************************/ -void *dptr_fetch_lanman2(char *params,int dptr_num) +void *dptr_fetch_lanman2(int snum, char *params,int dptr_num) { - void *p = dptr_get(dptr_num,dircounter++); + void *p = dptr_get(snum, dptr_num,dircounter++); uint32 resume_key = SVAL(params,6); BOOL uses_resume_key = BITSETW(params+10,2); BOOL continue_bit = BITSETW(params+10,3); @@ -520,7 +520,7 @@ typedef struct /******************************************************************* open a directory ********************************************************************/ -void *OpenDir(char *name, BOOL use_veto) +void *OpenDir(int snum, char *name, BOOL use_veto) { Dir *dirp; char *n; @@ -536,11 +536,13 @@ void *OpenDir(char *name, BOOL use_veto) dirp->pos = dirp->numentries = dirp->mallocsize = 0; dirp->data = dirp->current = NULL; - while ((n = readdirname(p))) { + while ((n = readdirname(p))) + { int l = strlen(n)+1; + /* If it's a vetoed file, pretend it doesn't even exist */ - if(use_veto && is_vetoed_name(n)) - continue; + if (use_veto && is_vetoed_name(snum, n)) continue; + if (used + l > dirp->mallocsize) { int s = MAX(used+l,used+2000); char *r; -- cgit