From cabd9e70e2f3ce3f617975a4d005d79121313b5f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 3 May 2011 13:52:06 -0700 Subject: Simple +1 changes in hardcoded lengths when changing from safe_strcpy to strlcpy. --- source3/smbd/mangle_hash.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/smbd/mangle_hash.c') diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c index d98b350a37..0451809cac 100644 --- a/source3/smbd/mangle_hash.c +++ b/source3/smbd/mangle_hash.c @@ -473,7 +473,7 @@ static void cache_mangled_name( const char mangled_name[13], return; /* Init the string lengths. */ - safe_strcpy(mangled_name_key, mangled_name, sizeof(mangled_name_key)-1); + strlcpy(mangled_name_key, mangled_name, sizeof(mangled_name_key)); /* See if the extensions are unmangled. If so, store the entry * without the extension, thus creating a "group" reverse map. @@ -638,7 +638,7 @@ static bool to_8_3(char magic_char, const char *in, char out[13], int default_ca if( p ) { if( p == s ) - safe_strcpy( extension, "___", 3 ); + strlcpy( extension, "___", 4); else { *p++ = 0; while( *p && extlen < 3 ) { @@ -670,7 +670,7 @@ static bool to_8_3(char magic_char, const char *in, char out[13], int default_ca if( *extension ) { out[baselen+3] = '.'; - safe_strcpy(&out[baselen+4], extension, 3); + strlcpy(&out[baselen+4], extension, 4); } SAFE_FREE(s); @@ -738,7 +738,7 @@ static bool hash_name_to_8_3(const char *in, if (NT_STATUS_IS_OK(is_valid_name(in_ucs2, False, False)) && NT_STATUS_IS_OK(is_8_3_w(in_ucs2, False))) { TALLOC_FREE(in_ucs2); - safe_strcpy(out, in, 12); + strlcpy(out, in, 13); return True; } -- cgit From d8cfca3a9bd2b6b6c562fd202377d95a98eb5472 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 5 May 2011 11:25:29 +0200 Subject: s3: only include tdb headers where needed. Guenther --- source3/smbd/mangle_hash.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/smbd/mangle_hash.c') diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c index 0451809cac..575c35e458 100644 --- a/source3/smbd/mangle_hash.c +++ b/source3/smbd/mangle_hash.c @@ -25,6 +25,7 @@ #include "smbd/smbd.h" #include "smbd/globals.h" #include "mangle.h" +#include "util_tdb.h" /* -------------------------------------------------------------------------- ** * Other stuff... -- cgit From de46ad9084aff4384f33660acf91da3b81554a88 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 6 Jun 2011 14:37:06 +1000 Subject: lib/util use modules_path(), data_path() and shlib_ext() from source3 This brings these helpful utility functions in common, as they are not based on either loadparm system. (The 'modules dir' parameter from Samba4 will shortly be removed, so there is no loss in functionality) Andrew Bartlett --- source3/smbd/mangle_hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/mangle_hash.c') diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c index 575c35e458..988251e878 100644 --- a/source3/smbd/mangle_hash.c +++ b/source3/smbd/mangle_hash.c @@ -87,7 +87,7 @@ static void init_valid_table(void) return; } - valid_table = (uint8 *)map_file(data_path("valid.dat"), 0x10000); + valid_table = (uint8 *)map_file(data_path(talloc_tos(), "valid.dat"), 0x10000); if (!valid_table) { smb_panic("Could not load valid.dat file required for mangle method=hash"); return; -- cgit From ca1936fbb26af0ee8d0421ae6a4e07a0f62311d9 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 20 Jun 2011 18:40:32 +0930 Subject: tdb_compat: use tdb_open_compat. This is a helper for the common case of opening a tdb with a logging function, but it doesn't do all the work, since TDB1 and TDB2's log functions are different types. Signed-off-by: Rusty Russell --- source3/smbd/mangle_hash.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source3/smbd/mangle_hash.c') diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c index 988251e878..c196a13ed0 100644 --- a/source3/smbd/mangle_hash.c +++ b/source3/smbd/mangle_hash.c @@ -773,8 +773,13 @@ const struct mangle_fns *mangle_hash_init(void) mangle_reset(); /* Create the in-memory tdb using our custom hash function. */ +#ifndef BUILD_TDB2 tdb_mangled_cache = tdb_open_ex("mangled_cache", 1031, TDB_INTERNAL, (O_RDWR|O_CREAT), 0644, NULL, fast_string_hash); +#else + /* FIXME: We should *never* open a tdb without logging! */ + tdb_mangled_cache = tdb_open("mangled_cache", TDB_INTERNAL, 0, 0, NULL); +#endif return &mangle_hash_fns; } -- cgit