smb_share_modes: don't use tdb_jenkins_hash.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 20 Jun 2011 07:25:15 +0000 (16:55 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 20 Jun 2011 09:18:34 +0000 (11:18 +0200)
It's a nice hash, but this usage has nothing to do with TDB.  So use the
Jenkins hash directly from CCAN instead (it's the same one).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
source3/Makefile.in
source3/libsmb/smb_share_modes.c
source3/wscript_build

index 9dd0a45c42ff360591312474181cdb8447ded464..5b36fe25332141e81a3257dcb48581fbeb3b5e4f 100644 (file)
@@ -2584,7 +2584,7 @@ showlibs:: showlibsmbclient
 #
 #-------------------------------------------------------------------
 
-LIBSMBSHAREMODES_OBJ0 = libsmb/smb_share_modes.o
+LIBSMBSHAREMODES_OBJ0 = libsmb/smb_share_modes.o ../lib/ccan/hash/hash.o
 
 LIBSMBSHAREMODES_OBJ = $(LIBSMBSHAREMODES_OBJ0)
 
index 76e63e6968987aeb31c6b16d30ba38b9b6fc9c1e..133b5b82f0fb21f83da9b0e4dbf713f11e49afb5 100644 (file)
@@ -28,6 +28,7 @@
 #include "system/filesys.h"
 #include "smb_share_modes.h"
 #include <tdb.h>
+#include <ccan/hash/hash.h>
 
 /* Database context handle. */
 struct smbdb_ctx {
@@ -267,7 +268,6 @@ int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx,
 
 static uint32_t smb_name_hash(const char *sharepath, const char *filename, int *err)
 {
-       TDB_DATA key;
        char *fullpath = NULL;
        size_t sharepath_size = strlen(sharepath);
        size_t filename_size = strlen(filename);
@@ -283,9 +283,7 @@ static uint32_t smb_name_hash(const char *sharepath, const char *filename, int *
        fullpath[sharepath_size] = '/';
        memcpy(&fullpath[sharepath_size + 1], filename, filename_size + 1);
 
-       key.dptr = (uint8_t *)fullpath;
-       key.dsize = strlen(fullpath) + 1;
-       name_hash = tdb_jenkins_hash(&key);
+       name_hash = hash(fullpath, strlen(fullpath) + 1, 0);
        free(fullpath);
        return name_hash;
 }
index df38e4c9dbdfd960b448f8c82c495a9f88df0a59..1aefad0b672a860950452c63ab75b2481108438d 100755 (executable)
@@ -684,6 +684,7 @@ bld.SAMBA3_LIBRARY('libsmb/smbclient',
 bld.SAMBA3_LIBRARY('smbsharemodes',
                     source=LIBSMBSHAREMODES_SRC,
                     public_deps='''talloc tdb''',
+                    deps='''ccan''',
                     public_headers='include/smb_share_modes.h',
                     vnum='0',
                     vars=locals())