From 5c0e682c4a2e8bb91911064c51bf4c690555cb33 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 11 Apr 2002 14:20:18 +0000 Subject: - the 36^6 hash space gives 31 bits, not 32 bits. We need to mask the hash to suit - the prefix ends at the last dot, not the first (This used to be commit 91a3ccd3e790f980421c1ee93388e19e87026b29) --- source3/smbd/mangle_hash2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c index 0ecea59caf..96ca7360b8 100644 --- a/source3/smbd/mangle_hash2.c +++ b/source3/smbd/mangle_hash2.c @@ -124,7 +124,9 @@ static u32 mangle_hash(const char *key, unsigned length) value = (value + (((unsigned char)str[i]) << (i*5 % 24))); } - return (1103515243 * value + 12345); + /* note that we force it to a 31 bit hash, to keep within the limits + of the 36^6 mangle space */ + return (1103515243 * value + 12345) & ~0x80000000; } /* @@ -431,7 +433,7 @@ static BOOL name_map(char *name, BOOL need83, BOOL cache83) } /* find the '.' if any */ - dot_p = strchr(name, '.'); + dot_p = strrchr(name, '.'); /* the leading character in the mangled name is taken from the first character of the name, if it is ascii -- cgit