diff options
author | Andrew Tridgell <tridge@samba.org> | 2002-04-11 14:20:18 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2002-04-11 14:20:18 +0000 |
commit | 5c0e682c4a2e8bb91911064c51bf4c690555cb33 (patch) | |
tree | 754c5b373f5baf8a933588db1bf39aafdf72526d | |
parent | 1ed0c5ea704a64a5ace6ba9ad600cb320c7d7ea4 (diff) | |
download | samba-5c0e682c4a2e8bb91911064c51bf4c690555cb33.tar.gz samba-5c0e682c4a2e8bb91911064c51bf4c690555cb33.tar.bz2 samba-5c0e682c4a2e8bb91911064c51bf4c690555cb33.zip |
- 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)
-rw-r--r-- | source3/smbd/mangle_hash2.c | 6 |
1 files 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 |