- the 36^6 hash space gives 31 bits, not 32 bits. We need to mask the
authorAndrew Tridgell <tridge@samba.org>
Thu, 11 Apr 2002 14:20:18 +0000 (14:20 +0000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 11 Apr 2002 14:20:18 +0000 (14:20 +0000)
  hash to suit
- the prefix ends at the last dot, not the first
(This used to be commit 91a3ccd3e790f980421c1ee93388e19e87026b29)

source3/smbd/mangle_hash2.c

index 0ecea59caf2c96362c7611d686ccd878743c2297..96ca7360b89d0d0dbd93934e6603aab896ef6f58 100644 (file)
@@ -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