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 | 91a3ccd3e790f980421c1ee93388e19e87026b29 (patch) | |
tree | 7371102d29ab1be2cbe78f46e410de851de10c8c /source/smbd/mangle_hash2.c | |
parent | 582f753eac7a111a93a8d6c049398a0998af848f (diff) | |
download | samba-91a3ccd3e790f980421c1ee93388e19e87026b29.tar.gz samba-91a3ccd3e790f980421c1ee93388e19e87026b29.tar.xz samba-91a3ccd3e790f980421c1ee93388e19e87026b29.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
Diffstat (limited to 'source/smbd/mangle_hash2.c')
-rw-r--r-- | source/smbd/mangle_hash2.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/smbd/mangle_hash2.c b/source/smbd/mangle_hash2.c index 0ecea59caf2..96ca7360b89 100644 --- a/source/smbd/mangle_hash2.c +++ b/source/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 |