summaryrefslogtreecommitdiffstats
path: root/source/smbd/mangle.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/smbd/mangle.c')
-rw-r--r--source/smbd/mangle.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/source/smbd/mangle.c b/source/smbd/mangle.c
index 3d214d46589..ee1f24931a5 100644
--- a/source/smbd/mangle.c
+++ b/source/smbd/mangle.c
@@ -125,8 +125,8 @@ static BOOL ct_initialized = False;
static ubi_cacheRoot mangled_cache[1] = { { { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0 } };
static BOOL mc_initialized = False;
-#define MANGLED_CACHE_MAX_ENTRIES 0
-#define MANGLED_CACHE_MAX_MEMORY 16384
+#define MANGLED_CACHE_MAX_ENTRIES 1024
+#define MANGLED_CACHE_MAX_MEMORY 0
/* -------------------------------------------------------------------------- **
@@ -289,23 +289,27 @@ static BOOL is_illegal_name( char *name )
* ************************************************************************** **
*/
BOOL is_mangled( char *s )
- {
- char *magic;
+{
+ char *magic;
+ BOOL ret = False;
+
+ if( !ct_initialized )
+ init_chartest();
+
+ magic = strchr( s, magic_char );
+ while( magic && magic[1] && magic[2] ) {
+ /* 3 chars, 1st is magic. */
+ if( ('.' == magic[3] || '/' == magic[3] || !(magic[3])) /* Ends with '.' or nul or '/' ? */
+ && isbasechar( toupper(magic[1]) ) /* is 2nd char basechar? */
+ && isbasechar( toupper(magic[2]) ) ) /* is 3rd char basechar? */
+ ret = ( True ); /* If all above, then true, */
+ magic = strchr( magic+1, magic_char ); /* else seek next magic. */
+ }
- if( !ct_initialized )
- init_chartest();
+ DEBUG(10,("is_mangled: %s : %s\n", s, ret ? "True" : "False"));
- magic = strchr( s, magic_char );
- while( magic && magic[1] && magic[2] ) /* 3 chars, 1st is magic. */
- {
- if( ('.' == magic[3] || '/' == magic[3] || !(magic[3])) /* Ends with '.' or nul or '/' ? */
- && isbasechar( toupper(magic[1]) ) /* is 2nd char basechar? */
- && isbasechar( toupper(magic[2]) ) ) /* is 3rd char basechar? */
- return( True ); /* If all above, then true, */
- magic = strchr( magic+1, magic_char ); /* else seek next magic. */
- }
- return( False );
- } /* is_mangled */
+ return ret;
+} /* is_mangled */
/* ************************************************************************** **
* Return True if the name is a valid DOS name in 8.3 DOS format.
@@ -446,6 +450,8 @@ static signed int cache_compare( ubi_btItemPtr ItemPtr, ubi_btNodePtr NodePtr )
char *Key1 = (char *)ItemPtr;
char *Key2 = (char *)(((ubi_cacheEntryPtr)NodePtr) + 1);
+ DEBUG(100,("cache_compare: %s %s\n", Key1, Key2));
+
return( StrCaseCmp( Key1, Key2 ) );
} /* cache_compare */
@@ -555,7 +561,7 @@ static void cache_mangled_name( char *mangled_name, char *raw_name )
if( s1 && (s2 = strrchr( raw_name, '.' )) )
{
i = 1;
- while( s1[i] && (tolower( s1[1] ) == s2[i]) )
+ while( s1[i] && (tolower( s1[i] ) == s2[i]) )
i++;
if( !s1[i] && !s2[i] )
{