summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/smb_macros.h1
-rw-r--r--source3/smbd/dir.c109
-rw-r--r--source3/smbd/filename.c18
-rw-r--r--source3/smbd/service.c2
4 files changed, 3 insertions, 127 deletions
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index bcbaa64f86..a9e911c066 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -26,7 +26,6 @@
/* Misc bit macros */
#define BOOLSTR(b) ((b) ? "Yes" : "No")
-#define BITSETB(ptr,bit) ((((char *)ptr)[0] & (1<<(bit)))!=0)
#define BITSETW(ptr,bit) ((SVAL(ptr,0) & (1<<(bit)))!=0)
/* for readability... */
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index b88f687766..2bda42f76d 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -986,112 +986,3 @@ int TellDir(void *p)
return(dirp->pos);
}
-
-/*******************************************************************************
- This section manages a global directory cache.
- (It should probably be split into a separate module. crh)
-********************************************************************************/
-
-typedef struct {
- ubi_dlNode node;
- char *path;
- char *name;
- char *dname;
- int snum;
-} dir_cache_entry;
-
-static ubi_dlNewList( dir_cache );
-
-/*****************************************************************************
- Add an entry to the directory cache.
- Input: path -
- name -
- dname -
- snum -
- Output: None.
-*****************************************************************************/
-
-void DirCacheAdd( const char *path, const char *name, const char *dname, int snum )
-{
- int pathlen;
- int namelen;
- dir_cache_entry *entry;
-
- /*
- * Allocate the structure & string space in one go so that it can be freed
- * in one call to free().
- */
- pathlen = strlen(path) + 1; /* Bytes required to store path (with nul). */
- namelen = strlen(name) + 1; /* Bytes required to store name (with nul). */
- entry = (dir_cache_entry *)malloc( sizeof( dir_cache_entry )
- + pathlen
- + namelen
- + strlen( dname ) +1 );
- if( NULL == entry ) /* Not adding to the cache is not fatal, */
- return; /* so just return as if nothing happened. */
-
- /* Set pointers correctly and load values. */
- entry->path = memcpy( (char *)&entry[1], path, strlen(path)+1 );
- entry->name = memcpy( &(entry->path[pathlen]), name, strlen(name)+1 );
- entry->dname = memcpy( &(entry->name[namelen]), dname, strlen(dname)+1 );
- entry->snum = snum;
-
- /* Add the new entry to the linked list. */
- (void)ubi_dlAddHead( dir_cache, entry );
- DEBUG( 4, ("Added dir cache entry %s %s -> %s\n", path, name, dname ) );
-
- /* Free excess cache entries. */
- while( DIRCACHESIZE < dir_cache->count )
- safe_free( ubi_dlRemTail( dir_cache ) );
-}
-
-/*****************************************************************************
- Search for an entry to the directory cache.
- Input: path -
- name -
- snum -
- Output: The dname string of the located entry, or NULL if the entry was
- not found.
-
- Notes: This uses a linear search, which is is okay because of
- the small size of the cache. Use a splay tree or hash
- for large caches.
-*****************************************************************************/
-
-char *DirCacheCheck( const char *path, const char *name, int snum )
-{
- dir_cache_entry *entry;
-
- for( entry = (dir_cache_entry *)ubi_dlFirst( dir_cache );
- NULL != entry;
- entry = (dir_cache_entry *)ubi_dlNext( entry ) ) {
- if( entry->snum == snum
- && entry->name && 0 == strcmp( name, entry->name )
- && entry->path && 0 == strcmp( path, entry->path ) ) {
- DEBUG(4, ("Got dir cache hit on %s %s -> %s\n",path,name,entry->dname));
- return( entry->dname );
- }
- }
-
- return(NULL);
-}
-
-/*****************************************************************************
- Remove all cache entries which have an snum that matches the input.
- Input: snum -
- Output: None.
-*****************************************************************************/
-
-void DirCacheFlush(int snum)
-{
- dir_cache_entry *entry;
- ubi_dlNodePtr next;
-
- for(entry = (dir_cache_entry *)ubi_dlFirst( dir_cache );
- NULL != entry; ) {
- next = ubi_dlNext( entry );
- if( entry->snum == snum )
- safe_free( ubi_dlRemThis( dir_cache, entry ) );
- entry = (dir_cache_entry *)next;
- }
-}
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index cc1c0a40b6..e12cfb1388 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -26,8 +26,7 @@
#include "includes.h"
-static BOOL scan_directory(const char *path, char *name,size_t maxlength,
- connection_struct *conn,BOOL docache);
+static BOOL scan_directory(connection_struct *conn, const char *path, char *name,size_t maxlength);
/****************************************************************************
Check if two filenames are equal.
@@ -282,10 +281,7 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen
*/
if (ms_has_wild(start) ||
- !scan_directory(dirpath, start,
- sizeof(pstring) - 1 - (start - name),
- conn,
- end?True:False)) {
+ !scan_directory(conn, dirpath, start, sizeof(pstring) - 1 - (start - name))) {
if (end) {
/*
* An intermediate part of the name can't be found.
@@ -450,8 +446,7 @@ BOOL check_name(pstring name,connection_struct *conn)
If the name looks like a mangled name then try via the mangling functions
****************************************************************************/
-static BOOL scan_directory(const char *path, char *name, size_t maxlength,
- connection_struct *conn,BOOL docache)
+static BOOL scan_directory(connection_struct *conn, const char *path, char *name, size_t maxlength)
{
void *cur_dir;
const char *dname;
@@ -463,11 +458,6 @@ static BOOL scan_directory(const char *path, char *name, size_t maxlength,
if (*path == 0)
path = ".";
- if (docache && (dname = DirCacheCheck(path,name,SNUM(conn)))) {
- safe_strcpy(name, dname, maxlength);
- return(True);
- }
-
/*
* The incoming name can be mangled, and if we de-mangle it
* here it will not compare correctly against the filename (name2)
@@ -505,8 +495,6 @@ static BOOL scan_directory(const char *path, char *name, size_t maxlength,
if ((mangled && mangled_equal(name,dname,SNUM(conn))) || fname_equal(name, dname, conn->case_sensitive)) {
/* we've found the file, change it's name and return */
- if (docache)
- DirCacheAdd(path,name,dname,SNUM(conn));
safe_strcpy(name, dname, maxlength);
CloseDir(cur_dir);
return(True);
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 794b5332ac..5ebd772aa1 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -821,8 +821,6 @@ close a cnum
****************************************************************************/
void close_cnum(connection_struct *conn, uint16 vuid)
{
- DirCacheFlush(SNUM(conn));
-
if (IS_IPC(conn)) {
pipe_close_conn(conn);
} else {