The branch, master has been updated via e287a72 add lib/param files to .gitignore via 4e1d9a6 build: run perl generators at autogen.sh time via 7703648 build: clean new generated param headers via a6faacd build: only regenerate param files when required via 73d0ab6 lib/param reduce the cost of loadparm_init_s3() via 01c934c lib/util: Add back control of mmap and hash size in tdb for top level build via 3cdb1fe s4-messaging: Pass the loadparm context, not just the messaging path via 5603dab libcli/auth: Provide a struct loadparm_context to schannel calls via 43d84aa lib/param Print error when mkdir of lock path fails via 4a89361 lib/param Add 'use mmap' parameter to control tdb use of mmap via ebf3ecd build: use lib/param loadparm code in source3 to get at lpcfg_ functions from d2a9e8d Another part of the fix for Bug 8473 - smb2_find uses a hard coded max reply size of 0x10000 instead of smb2_max_trans.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit e287a72e657988c87166b0b468836d94b073b14e Author: Andrew Bartlett <abart...@samba.org> Date: Thu Oct 13 22:58:26 2011 +1100 add lib/param files to .gitignore Autobuild-User: Andrew Bartlett <abart...@samba.org> Autobuild-Date: Thu Oct 13 15:40:16 CEST 2011 on sn-devel-104 commit 4e1d9a620b0ebbe9bca89de84f553f580295fc33 Author: Andrew Bartlett <abart...@samba.org> Date: Thu Oct 13 22:53:20 2011 +1100 build: run perl generators at autogen.sh time commit 77036483488c67ab498a1b5d19320a78dcfdc450 Author: Andrew Bartlett <abart...@samba.org> Date: Thu Oct 13 22:53:03 2011 +1100 build: clean new generated param headers commit a6faacd93c7d8e9677bf5c9ad6a6c11d68862fd8 Author: Andrew Bartlett <abart...@samba.org> Date: Thu Oct 13 22:51:30 2011 +1100 build: only regenerate param files when required commit 73d0ab6558fd6a3f07f6a96b99c89baa46e0d9c2 Author: Andrew Bartlett <abart...@samba.org> Date: Thu Oct 13 20:16:28 2011 +1100 lib/param reduce the cost of loadparm_init_s3() The parameter redirection covers most things now, so this should be safe. Andrew Bartlett commit 01c934c81e55b79601122d8e0740c7946077c37e Author: Andrew Bartlett <abart...@samba.org> Date: Wed Oct 12 23:01:08 2011 +1100 lib/util: Add back control of mmap and hash size in tdb for top level build This passes down a struct loadparm_context to allow these parameters to be checked. This may be s3 or s4 context, allowing the #if _SAMBA_BUILD_ macro to go away safely. Andrew Bartlett commit 3cdb1fe4404e26ae383cfb73bfa8af36cb1d7f7c Author: Andrew Bartlett <abart...@samba.org> Date: Thu Oct 13 20:01:56 2011 +1100 s4-messaging: Pass the loadparm context, not just the messaging path This will allow the TDB layer to get at the lp_ctx for tdb options. Andrew Bartlett commit 5603dab6478fbb40206a8664a308b5db5b1863e8 Author: Andrew Bartlett <abart...@samba.org> Date: Wed Oct 12 22:55:34 2011 +1100 libcli/auth: Provide a struct loadparm_context to schannel calls This will allow us to pass this down to the tdb_wrap layer. Andrew Bartlett commit 43d84aa619be5851acea82bef77164f0dc3e9f7e Author: Andrew Bartlett <abart...@samba.org> Date: Wed Oct 12 22:37:24 2011 +1100 lib/param Print error when mkdir of lock path fails This matches the s3 code for lock_path(). Andrew Bartlett commit 4a89361af465227c96b07d009e67689c44b16e4e Author: Andrew Bartlett <abart...@samba.org> Date: Wed Oct 12 22:36:40 2011 +1100 lib/param Add 'use mmap' parameter to control tdb use of mmap commit ebf3ecd986bbb5a84418b8519537054ac4fa0dc1 Author: Andrew Bartlett <abart...@samba.org> Date: Sat Oct 8 12:18:09 2011 +1100 build: use lib/param loadparm code in source3 to get at lpcfg_ functions ----------------------------------------------------------------------- Summary of changes: .gitignore | 4 ++ lib/param/loadparm.c | 14 +++++- lib/param/util.c | 4 +- lib/util/tdb_wrap.c | 21 +++----- lib/util/tdb_wrap.h | 5 ++- lib/util/wscript_build | 2 +- libcli/auth/schannel_proto.h | 2 +- libcli/auth/schannel_state.h | 6 +- libcli/auth/schannel_state_tdb.c | 19 ++++--- libcli/auth/wscript_build | 2 +- source3/Makefile.in | 18 ++++++- source3/auth/auth_samba4.c | 2 +- source3/autogen.sh | 6 ++ source3/lib/dbwrap/dbwrap_tdb.c | 8 ++- source3/lib/messages_local.c | 21 +++++++- source3/lib/server_mutex.c | 13 ++++- source3/lib/serverid.c | 11 ++++- source3/param/loadparm_ctx.c | 3 + source3/rpc_server/netlogon/srv_netlog_nt.c | 55 ++++++++++++++++++-- source3/rpc_server/srv_pipe.c | 13 ++++- source3/smbd/notify_internal.c | 13 ++++- source3/smbd/server.c | 5 ++- source4/auth/gensec/schannel.c | 2 +- source4/cluster/local.c | 2 +- source4/dsdb/samdb/ldb_modules/ridalloc.c | 2 +- source4/dsdb/samdb/ldb_modules/rootdse.c | 2 +- source4/lib/messaging/messaging.c | 22 ++++++-- source4/lib/messaging/messaging.h | 4 +- source4/lib/messaging/pymessaging.c | 27 +++++----- source4/lib/messaging/tests/irpc.c | 4 +- source4/lib/messaging/tests/messaging.c | 4 +- source4/librpc/rpc/pyrpc_util.c | 2 +- source4/ntvfs/posix/python/pyxattr_tdb.c | 6 ++- source4/ntvfs/posix/vfs_posix.c | 3 +- source4/param/secrets.c | 2 +- source4/rpc_server/netlogon/dcerpc_netlogon.c | 6 +- source4/scripting/python/samba/tests/messaging.py | 1 - source4/smbd/server.c | 4 +- source4/smbd/service_stream.c | 2 +- source4/smbd/service_task.c | 2 +- source4/torture/local/dbspeed.c | 2 +- source4/utils/ntlm_auth.c | 2 +- 42 files changed, 252 insertions(+), 96 deletions(-) Changeset truncated at 500 lines: diff --git a/.gitignore b/.gitignore index 309dfad..d6d3e81 100644 --- a/.gitignore +++ b/.gitignore @@ -94,6 +94,10 @@ source3/smbd/build_options.c source3/param/param_global.h source3/param/param_local.h source3/setup +lib/param/param_global.h +lib/param/param_local.h +lib/param/param_proto.h +lib/param/s3_param.h pidl/blib pidl/cover_db pidl/Makefile diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 880b521..c130a19 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -866,6 +866,15 @@ static struct parm_struct parm_table[] = { .enum_list = NULL }, { + .label = "use mmap", + .type = P_BOOL, + .p_class = P_GLOBAL, + .offset = GLOBAL_VAR(bUseMmap), + .special = NULL, + .enum_list = NULL, + .flags = FLAG_ADVANCED, + }, + { .label = "case insensitive filesystem", .type = P_BOOL, .p_class = P_LOCAL, @@ -1549,6 +1558,7 @@ FN_GLOBAL_BOOL(client_use_spnego_principal, client_use_spnego_principal) FN_GLOBAL_BOOL(host_msdfs, bHostMSDfs) FN_GLOBAL_BOOL(unix_extensions, bUnixExtensions) FN_GLOBAL_BOOL(use_spnego, bUseSpnego) +FN_GLOBAL_BOOL(use_mmap, bUseMmap) FN_GLOBAL_BOOL(rpc_big_endian, bRpcBigEndian) FN_GLOBAL_INTEGER(max_wins_ttl, max_wins_ttl) FN_GLOBAL_INTEGER(min_wins_ttl, min_wins_ttl) @@ -3384,6 +3394,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) lpcfg_do_global_parameter(lp_ctx, "use spnego", "True"); + lpcfg_do_global_parameter(lp_ctx, "use mmap", "True"); + lpcfg_do_global_parameter(lp_ctx, "smb ports", "445 139"); lpcfg_do_global_parameter(lp_ctx, "nbt port", "137"); lpcfg_do_global_parameter(lp_ctx, "dgram port", "138"); @@ -3446,7 +3458,7 @@ struct loadparm_context *loadparm_init_global(bool load_default) struct loadparm_context *loadparm_init_s3(TALLOC_CTX *mem_ctx, const struct loadparm_s3_context *s3_fns) { - struct loadparm_context *loadparm_context = loadparm_init(mem_ctx); + struct loadparm_context *loadparm_context = talloc_zero(mem_ctx, struct loadparm_context); if (!loadparm_context) { return NULL; } diff --git a/lib/param/util.c b/lib/param/util.c index a385c4d..3a6a004 100644 --- a/lib/param/util.c +++ b/lib/param/util.c @@ -90,7 +90,9 @@ char *lpcfg_lock_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx, trim_string(dname,"","/"); if (!directory_exist(dname)) { - mkdir(dname,0755); + if (!mkdir(dname,0755)) + DEBUG(1, ("Unable to create directory %s for file %s. " + "Error was %s\n", dname, name, strerror(errno))); } fname = talloc_asprintf(mem_ctx, "%s/%s", dname, name); diff --git a/lib/util/tdb_wrap.c b/lib/util/tdb_wrap.c index a3dc76d..7c3318b 100644 --- a/lib/util/tdb_wrap.c +++ b/lib/util/tdb_wrap.c @@ -22,6 +22,7 @@ #include "includes.h" #include "lib/util/dlinklist.h" #include "lib/util/tdb_wrap.h" +#include "lib/param/param.h" /* FIXME: TDB2 does this internally, so no need to wrap multiple opens! */ #if BUILD_TDB2 @@ -114,7 +115,8 @@ static struct tdb_wrap_private *tdb_wrap_private_open(TALLOC_CTX *mem_ctx, int hash_size, int tdb_flags, int open_flags, - mode_t mode) + mode_t mode, + struct loadparm_context *lp_ctx) { struct tdb_wrap_private *result; @@ -127,14 +129,7 @@ static struct tdb_wrap_private *tdb_wrap_private_open(TALLOC_CTX *mem_ctx, goto fail; } -#if _SAMBA_BUILD_ == 3 - /* This #if _SAMBA_BUILD == 3 is very unfortunate, as it means - * that in the top level build, these options are not - * available for these databases. However, having two - * different tdb_wrap lists is a worse fate, so this will do - * for now */ - - if (!lp_use_mmap()) { + if (!lpcfg_use_mmap(lp_ctx)) { tdb_flags |= TDB_NOMMAP; } @@ -147,9 +142,8 @@ static struct tdb_wrap_private *tdb_wrap_private_open(TALLOC_CTX *mem_ctx, } else { base = name; } - hash_size = lp_parm_int(-1, "tdb_hashsize", base, 0); + hash_size = lpcfg_parm_int(lp_ctx, NULL, "tdb_hashsize", base, 0); } -#endif result->tdb = tdb_open_compat(name, hash_size, tdb_flags, open_flags, mode, tdb_wrap_log, NULL); @@ -171,7 +165,8 @@ fail: */ struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, const char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode) + int open_flags, mode_t mode, + struct loadparm_context *lp_ctx) { struct tdb_wrap *result; struct tdb_wrap_private *w; @@ -189,7 +184,7 @@ struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, if (w == NULL) { w = tdb_wrap_private_open(result, name, hash_size, tdb_flags, - open_flags, mode); + open_flags, mode, lp_ctx); } else { /* * Correctly use talloc_reference: The tdb will be diff --git a/lib/util/tdb_wrap.h b/lib/util/tdb_wrap.h index 6f9f383..81e77e7 100644 --- a/lib/util/tdb_wrap.h +++ b/lib/util/tdb_wrap.h @@ -35,8 +35,11 @@ struct tdb_wrap { struct tdb_context *tdb; }; +struct loadparm_context; + struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, const char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode); + int open_flags, mode_t mode, + struct loadparm_context *lp_ctx); #endif /* _TDB_WRAP_H_ */ diff --git a/lib/util/wscript_build b/lib/util/wscript_build index 8b4901a..1dc65fa 100755 --- a/lib/util/wscript_build +++ b/lib/util/wscript_build @@ -88,7 +88,7 @@ bld.SAMBA_SUBSYSTEM('UTIL_PW', bld.SAMBA_LIBRARY('tdb-wrap', source='tdb_wrap.c', - deps='tdb_compat talloc samba-util', + deps='tdb_compat talloc samba-util samba-hostconfig', private_library=True, local_include=False ) diff --git a/libcli/auth/schannel_proto.h b/libcli/auth/schannel_proto.h index e3aeb5a..7ee4c1c 100644 --- a/libcli/auth/schannel_proto.h +++ b/libcli/auth/schannel_proto.h @@ -26,7 +26,7 @@ struct schannel_state; struct tdb_wrap *open_schannel_session_store(TALLOC_CTX *mem_ctx, - const char *private_dir); + struct loadparm_context *lp_ctx); NTSTATUS netsec_incoming_packet(struct schannel_state *state, bool do_unseal, diff --git a/libcli/auth/schannel_state.h b/libcli/auth/schannel_state.h index 017fdbe..f9d02dd 100644 --- a/libcli/auth/schannel_state.h +++ b/libcli/auth/schannel_state.h @@ -24,16 +24,16 @@ #define _LIBCLI_AUTH_SCHANNEL_STATE_H__ NTSTATUS schannel_get_creds_state(TALLOC_CTX *mem_ctx, - const char *db_priv_dir, + struct loadparm_context *lp_ctx, const char *computer_name, struct netlogon_creds_CredentialState **creds); NTSTATUS schannel_save_creds_state(TALLOC_CTX *mem_ctx, - const char *db_priv_dir, + struct loadparm_context *lp_ctx, struct netlogon_creds_CredentialState *creds); NTSTATUS schannel_check_creds_state(TALLOC_CTX *mem_ctx, - const char *db_priv_dir, + struct loadparm_context *lp_ctx, const char *computer_name, struct netr_Authenticator *received_authenticator, struct netr_Authenticator *return_authenticator, diff --git a/libcli/auth/schannel_state_tdb.c b/libcli/auth/schannel_state_tdb.c index 76110b8..f2b9188 100644 --- a/libcli/auth/schannel_state_tdb.c +++ b/libcli/auth/schannel_state_tdb.c @@ -25,6 +25,7 @@ #include "system/filesys.h" #include "../lib/tdb_compat/tdb_compat.h" #include "../lib/util/util_tdb.h" +#include "../lib/param/param.h" #include "../libcli/auth/schannel.h" #include "../librpc/gen_ndr/ndr_schannel.h" #include "lib/util/tdb_wrap.h" @@ -37,16 +38,16 @@ *******************************************************************************/ struct tdb_wrap *open_schannel_session_store(TALLOC_CTX *mem_ctx, - const char *private_dir) + struct loadparm_context *lp_ctx) { struct tdb_wrap *tdb_sc = NULL; - char *fname = talloc_asprintf(mem_ctx, "%s/schannel_store.tdb", private_dir); + char *fname = lpcfg_private_path(mem_ctx, lp_ctx, "schannel_store.tdb"); if (!fname) { return NULL; } - tdb_sc = tdb_wrap_open(mem_ctx, fname, 0, TDB_CLEAR_IF_FIRST|TDB_NOSYNC, O_RDWR|O_CREAT, 0600); + tdb_sc = tdb_wrap_open(mem_ctx, fname, 0, TDB_CLEAR_IF_FIRST|TDB_NOSYNC, O_RDWR|O_CREAT, 0600, lp_ctx); if (!tdb_sc) { DEBUG(0,("open_schannel_session_store: Failed to open %s - %s\n", @@ -201,7 +202,7 @@ NTSTATUS schannel_fetch_session_key_tdb(struct tdb_wrap *tdb_sc, *******************************************************************************/ NTSTATUS schannel_get_creds_state(TALLOC_CTX *mem_ctx, - const char *db_priv_dir, + struct loadparm_context *lp_ctx, const char *computer_name, struct netlogon_creds_CredentialState **_creds) { @@ -215,7 +216,7 @@ NTSTATUS schannel_get_creds_state(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - tdb_sc = open_schannel_session_store(tmpctx, db_priv_dir); + tdb_sc = open_schannel_session_store(tmpctx, lp_ctx); if (!tdb_sc) { return NT_STATUS_ACCESS_DENIED; } @@ -239,7 +240,7 @@ NTSTATUS schannel_get_creds_state(TALLOC_CTX *mem_ctx, *******************************************************************************/ NTSTATUS schannel_save_creds_state(TALLOC_CTX *mem_ctx, - const char *db_priv_dir, + struct loadparm_context *lp_ctx, struct netlogon_creds_CredentialState *creds) { TALLOC_CTX *tmpctx; @@ -251,7 +252,7 @@ NTSTATUS schannel_save_creds_state(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - tdb_sc = open_schannel_session_store(tmpctx, db_priv_dir); + tdb_sc = open_schannel_session_store(tmpctx, lp_ctx); if (!tdb_sc) { return NT_STATUS_ACCESS_DENIED; } @@ -273,7 +274,7 @@ NTSTATUS schannel_save_creds_state(TALLOC_CTX *mem_ctx, ********************************************************************/ NTSTATUS schannel_check_creds_state(TALLOC_CTX *mem_ctx, - const char *db_priv_dir, + struct loadparm_context *lp_ctx, const char *computer_name, struct netr_Authenticator *received_authenticator, struct netr_Authenticator *return_authenticator, @@ -290,7 +291,7 @@ NTSTATUS schannel_check_creds_state(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - tdb_sc = open_schannel_session_store(tmpctx, db_priv_dir); + tdb_sc = open_schannel_session_store(tmpctx, lp_ctx); if (!tdb_sc) { status = NT_STATUS_ACCESS_DENIED; goto done; diff --git a/libcli/auth/wscript_build b/libcli/auth/wscript_build index acb1ce3..2afab44 100644 --- a/libcli/auth/wscript_build +++ b/libcli/auth/wscript_build @@ -26,7 +26,7 @@ bld.SAMBA_SUBSYSTEM('LIBCLI_AUTH', bld.SAMBA_SUBSYSTEM('COMMON_SCHANNEL', source='schannel_state_tdb.c schannel_sign.c', - deps='tdb-wrap UTIL_TDB' + deps='tdb-wrap UTIL_TDB samba-hostconfig' ) diff --git a/source3/Makefile.in b/source3/Makefile.in index 27c3393..6b979d4 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -494,7 +494,7 @@ READLINE_OBJ = ../libcli/smbreadline/smbreadline.o # Be sure to include them into your application POPT_LIB_OBJ = lib/popt_common.o -PARAM_WITHOUT_REG_OBJ = ../dynconfig/dynconfig.o param/loadparm.o param/loadparm_server_role.o param/util.o lib/sharesec.o lib/ldap_debug_handler.o +PARAM_WITHOUT_REG_OBJ = ../dynconfig/dynconfig.o param/loadparm.o param/loadparm_ctx.o param/loadparm_server_role.o param/util.o lib/sharesec.o lib/ldap_debug_handler.o ../lib/param/loadparm.o ../lib/param/util.o PARAM_REG_ADD_OBJ = $(REG_SMBCONF_OBJ) $(LIBSMBCONF_OBJ) $(PRIVILEGES_BASIC_OBJ) PARAM_OBJ = $(PARAM_WITHOUT_REG_OBJ) $(PARAM_REG_ADD_OBJ) @@ -1654,9 +1654,19 @@ idl_full:: @PIDL_OUTPUTDIR="librpc/gen_ndr" PIDL_ARGS="$(PIDL_ARGS)" CPP="$(CPP)" PIDL="../pidl/pidl" \ srcdir="$(srcdir)" $(srcdir)/script/build_idl.sh --full $(IDL_FILES) -mkparam: +mkparam: ../lib/param/param_local.h ../lib/param/param_global.h param/param_global.h ../lib/param/param_proto.h ../lib/param/s3_param.h + +../lib/param/param_local.h: $(PERL) ../script/mkparamdefs.pl $(srcdir)/../lib/param/param_functions.c --file ../lib/param/param_local.h --generate-scope=LOCAL +../lib/param/param_global.h: + $(PERL) ../script/mkparamdefs.pl $(srcdir)/../lib/param/loadparm.c --file ../lib/param/param_global.h --generate-scope=GLOBAL +param/param_global.h: $(PERL) ../script/mkparamdefs.pl $(srcdir)/param/loadparm.c --file param/param_global.h --generate-scope=GLOBAL +../lib/param/param_proto.h: + $(PERL) ../source4/script/mkproto.pl $(srcdir)/../lib/param/loadparm.c --public ../lib/param/param_proto.h --private ../lib/param/param_proto.h +../lib/param/s3_param.h: + $(PERL) ../script/mks3param.pl $(srcdir)/../lib/param/loadparm.c --file ../lib/param/s3_param.h + ##################################################################### @@ -3416,6 +3426,10 @@ clean:: cleanlibs -rm -f smbd/build_options.c -rm -f param/param_local.h -rm -f param/param_global.h + -rm -f ../lib/param/param_local.h + -rm -f ../lib/param/param_global.h + -rm -f ../lib/param/param_proto.h + -rm -f ../lib/param/s3_param.h -rm -f $(PRECOMPILED_HEADER) -rm -f core */*~ *~ \ */*.o */*/*.o */*/*/*.o */*/*/*/*.o \ diff --git a/source3/auth/auth_samba4.c b/source3/auth/auth_samba4.c index 994bde1..21c7b44 100644 --- a/source3/auth/auth_samba4.c +++ b/source3/auth/auth_samba4.c @@ -122,7 +122,7 @@ static NTSTATUS prepare_gensec(TALLOC_CTX *mem_ctx, } msg_ctx = imessaging_client_init(frame, - lpcfg_imessaging_path(frame, lp_ctx), + lp_ctx, event_ctx); if (msg_ctx == NULL) { DEBUG(1, ("imessaging_init failed\n")); diff --git a/source3/autogen.sh b/source3/autogen.sh index d9f6030..e5aea32 100755 --- a/source3/autogen.sh +++ b/source3/autogen.sh @@ -86,6 +86,12 @@ else echo "some autconf tests might not work properly" fi +perl ../script/mkparamdefs.pl ../lib/param/param_functions.c --file ../lib/param/param_local.h --generate-scope=LOCAL +perl ../script/mkparamdefs.pl ../lib/param/loadparm.c --file ../lib/param/param_global.h --generate-scope=GLOBAL +perl ../script/mkparamdefs.pl param/loadparm.c --file param/param_global.h --generate-scope=GLOBAL +perl ../source4/script/mkproto.pl ../lib/param/loadparm.c --public ../lib/param/param_proto.h --private ../lib/param/param_proto.h +perl ../script/mks3param.pl ../lib/param/loadparm.c --file ../lib/param/s3_param.h + echo "Now run ./configure (or ./configure.developer) and then make." exit 0 diff --git a/source3/lib/dbwrap/dbwrap_tdb.c b/source3/lib/dbwrap/dbwrap_tdb.c index 4330c96..e9e4900 100644 --- a/source3/lib/dbwrap/dbwrap_tdb.c +++ b/source3/lib/dbwrap/dbwrap_tdb.c @@ -22,6 +22,7 @@ #include "dbwrap/dbwrap_private.h" #include "dbwrap/dbwrap_tdb.h" #include "lib/util/tdb_wrap.h" +#include "lib/param/param.h" struct db_tdb_ctx { struct tdb_wrap *wtdb; @@ -359,12 +360,14 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, { struct db_context *result = NULL; struct db_tdb_ctx *db_tdb; - + struct loadparm_context *lp_ctx; + result = talloc_zero(mem_ctx, struct db_context); if (result == NULL) { DEBUG(0, ("talloc failed\n")); goto fail; } + lp_ctx = loadparm_init_s3(result, loadparm_s3_context()); result->private_data = db_tdb = talloc(result, struct db_tdb_ctx); if (db_tdb == NULL) { @@ -373,7 +376,8 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, } db_tdb->wtdb = tdb_wrap_open(db_tdb, name, hash_size, tdb_flags, - open_flags, mode); + open_flags, mode, lp_ctx); + talloc_unlink(result, lp_ctx); if (db_tdb->wtdb == NULL) { DEBUG(3, ("Could not open tdb: %s\n", strerror(errno))); goto fail; diff --git a/source3/lib/messages_local.c b/source3/lib/messages_local.c index 67234d4..9b4e3c5 100644 --- a/source3/lib/messages_local.c +++ b/source3/lib/messages_local.c @@ -46,6 +46,7 @@ #include "system/filesys.h" #include "messages.h" #include "lib/util/tdb_wrap.h" +#include "lib/param/param.h" struct messaging_tdb_context { struct messaging_context *msg_ctx; @@ -86,12 +87,19 @@ NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx, { struct messaging_backend *result; struct messaging_tdb_context *ctx; + struct loadparm_context *lp_ctx; if (!(result = talloc(mem_ctx, struct messaging_backend))) { DEBUG(0, ("talloc failed\n")); return NT_STATUS_NO_MEMORY; } + lp_ctx = loadparm_init_s3(result, loadparm_s3_context()); + if (lp_ctx == NULL) { + DEBUG(0, ("loadparm_init_s3 failed\n")); + return NT_STATUS_INTERNAL_ERROR; + } + ctx = talloc_zero(result, struct messaging_tdb_context); if (!ctx) { DEBUG(0, ("talloc failed\n")); @@ -105,7 +113,8 @@ NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx, ctx->tdb = tdb_wrap_open(ctx, lock_path("messages.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT|TDB_VOLATILE|TDB_INCOMPATIBLE_HASH, - O_RDWR|O_CREAT,0600); + O_RDWR|O_CREAT,0600, lp_ctx); + talloc_unlink(result, lp_ctx); if (!ctx->tdb) { NTSTATUS status = map_nt_error_from_unix(errno); @@ -137,6 +146,13 @@ NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx, bool messaging_tdb_parent_init(TALLOC_CTX *mem_ctx) { struct tdb_wrap *db; + struct loadparm_context *lp_ctx; + + lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_context()); + if (lp_ctx == NULL) { + DEBUG(0, ("loadparm_init_s3 failed\n")); + return false; + } /* * Open the tdb in the parent process (smbd) so that our @@ -146,7 +162,8 @@ bool messaging_tdb_parent_init(TALLOC_CTX *mem_ctx) db = tdb_wrap_open(mem_ctx, lock_path("messages.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT|TDB_VOLATILE|TDB_INCOMPATIBLE_HASH, - O_RDWR|O_CREAT,0600); + O_RDWR|O_CREAT,0600, lp_ctx); + talloc_unlink(mem_ctx, lp_ctx); if (db == NULL) { DEBUG(1, ("could not open messaging.tdb: %s\n", strerror(errno))); diff --git a/source3/lib/server_mutex.c b/source3/lib/server_mutex.c index dc65819..7ceecfe 100644 --- a/source3/lib/server_mutex.c +++ b/source3/lib/server_mutex.c @@ -22,6 +22,7 @@ #include "system/filesys.h" #include "lib/util/tdb_wrap.h" #include "util_tdb.h" +#include "lib/param/param.h" /* For reasons known only to MS, many of their NT/Win2k versions -- Samba Shared Repository