mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
smb_share_modes: don't use tdb_jenkins_hash.
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>
This commit is contained in:
parent
754c677b0b
commit
20687dcd7b
@ -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)
|
LIBSMBSHAREMODES_OBJ = $(LIBSMBSHAREMODES_OBJ0)
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "system/filesys.h"
|
#include "system/filesys.h"
|
||||||
#include "smb_share_modes.h"
|
#include "smb_share_modes.h"
|
||||||
#include <tdb.h>
|
#include <tdb.h>
|
||||||
|
#include <ccan/hash/hash.h>
|
||||||
|
|
||||||
/* Database context handle. */
|
/* Database context handle. */
|
||||||
struct smbdb_ctx {
|
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)
|
static uint32_t smb_name_hash(const char *sharepath, const char *filename, int *err)
|
||||||
{
|
{
|
||||||
TDB_DATA key;
|
|
||||||
char *fullpath = NULL;
|
char *fullpath = NULL;
|
||||||
size_t sharepath_size = strlen(sharepath);
|
size_t sharepath_size = strlen(sharepath);
|
||||||
size_t filename_size = strlen(filename);
|
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] = '/';
|
fullpath[sharepath_size] = '/';
|
||||||
memcpy(&fullpath[sharepath_size + 1], filename, filename_size + 1);
|
memcpy(&fullpath[sharepath_size + 1], filename, filename_size + 1);
|
||||||
|
|
||||||
key.dptr = (uint8_t *)fullpath;
|
name_hash = hash(fullpath, strlen(fullpath) + 1, 0);
|
||||||
key.dsize = strlen(fullpath) + 1;
|
|
||||||
name_hash = tdb_jenkins_hash(&key);
|
|
||||||
free(fullpath);
|
free(fullpath);
|
||||||
return name_hash;
|
return name_hash;
|
||||||
}
|
}
|
||||||
|
@ -684,6 +684,7 @@ bld.SAMBA3_LIBRARY('libsmb/smbclient',
|
|||||||
bld.SAMBA3_LIBRARY('smbsharemodes',
|
bld.SAMBA3_LIBRARY('smbsharemodes',
|
||||||
source=LIBSMBSHAREMODES_SRC,
|
source=LIBSMBSHAREMODES_SRC,
|
||||||
public_deps='''talloc tdb''',
|
public_deps='''talloc tdb''',
|
||||||
|
deps='''ccan''',
|
||||||
public_headers='include/smb_share_modes.h',
|
public_headers='include/smb_share_modes.h',
|
||||||
vnum='0',
|
vnum='0',
|
||||||
vars=locals())
|
vars=locals())
|
||||||
|
Loading…
Reference in New Issue
Block a user