From f3eeb2f1fa528b0d952d2519f719d30f4a2489fa Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 4 Mar 1998 22:24:07 +0000 Subject: Removed broken change I made to mangle.c (ooops. Andrew's original algorithm was correct). Finally (I think) fixed the mangled directory stack issue in scan_directory() correctly. Mangled & non-mangled names are now being checked correctly. Hurrah to Ulrik Dickow who helped isolate this one. Jeremy. (This used to be commit 37f5f7b557aa59c7eba4a9f2f2f323d7cec62fc7) --- source3/smbd/mangle.c | 2 +- source3/smbd/server.c | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/mangle.c b/source3/smbd/mangle.c index d0d5ada247..8aa53bc35a 100644 --- a/source3/smbd/mangle.c +++ b/source3/smbd/mangle.c @@ -42,7 +42,7 @@ int str_checksum(char *s) while( *s ) { c = *s; - res ^= (c << (15-(i%15))) ^ (c >> (i % 15)); + res ^= (c << (i % 15)) ^ (c >> (15-(i%15))); s++; i++; } return(res); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index e6807bdf31..e290027d0a 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -456,11 +456,7 @@ static BOOL scan_directory(char *path, char *name,int cnum,BOOL docache) return(True); } -#if 0 - /* - * This code I believe is incorrect - and commenting it out - * is the correct fix for the bug mentioned below in the - * comment 'name2 here was changed to dname - since 1.9.16p2 - not sure of reason (jra)'. + /* * The incoming name can be mangled, and if we de-mangle it * here it will not compare correctly against the filename (name2) * read from the directory and then mangled by the name_map_mangle() @@ -468,8 +464,7 @@ static BOOL scan_directory(char *path, char *name,int cnum,BOOL docache) * (JRA). */ if (mangled) - check_mangled_stack(name); -#endif + mangled = !check_mangled_stack(name); /* open the directory */ if (!(cur_dir = OpenDir(cnum, path, True))) @@ -489,7 +484,7 @@ static BOOL scan_directory(char *path, char *name,int cnum,BOOL docache) if (!name_map_mangle(name2,False,SNUM(cnum))) continue; if ((mangled && mangled_equal(name,name2)) - || fname_equal(name, name2)) /* name2 here was changed to dname - since 1.9.16p2 - not sure of reason (jra) */ + || fname_equal(name, name2)) { /* we've found the file, change it's name and return */ if (docache) DirCacheAdd(path,name,dname,SNUM(cnum)); -- cgit