From d1ded271b6e8f8ff7f09c4830411e389d26b1b10 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 9 Apr 2011 18:15:12 +0200 Subject: s3: Wrap creating the svcctl keys in a transaction This makes the startup of smbd in make test much quicker and thus more reliable (cherry picked from commit f1aa38b414e97d8687d0bebf65baa384f75301b4) Autobuild-User: Volker Lendecke Autobuild-Date: Mon Apr 11 22:09:58 CEST 2011 on sn-devel-104 --- source3/rpc_server/svcctl/srv_svcctl_reg.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/svcctl/srv_svcctl_reg.c b/source3/rpc_server/svcctl/srv_svcctl_reg.c index d262ff83b7..eb0c2bddb6 100644 --- a/source3/rpc_server/svcctl/srv_svcctl_reg.c +++ b/source3/rpc_server/svcctl/srv_svcctl_reg.c @@ -30,6 +30,7 @@ #include "rpc_client/cli_winreg.h" #include "rpc_server/svcctl/srv_svcctl_reg.h" #include "auth.h" +#include "registry/reg_backend_db.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_REGISTRY @@ -575,6 +576,19 @@ bool svcctl_init_winreg(struct messaging_context *msg_ctx) goto done; } + result = regdb_open(); + if (!W_ERROR_IS_OK(result)) { + DEBUG(10, ("regdb_open failed: %s\n", + win_errstr(result))); + goto done; + } + result = regdb_transaction_start(); + if (!W_ERROR_IS_OK(result)) { + DEBUG(10, ("regdb_transaction_start failed: %s\n", + win_errstr(result))); + goto done; + } + status = dcerpc_winreg_int_hklm_openkey(tmp_ctx, get_session_info_system(), msg_ctx, @@ -674,6 +688,20 @@ done: dcerpc_winreg_CloseKey(h, tmp_ctx, &key_hnd, &result); } + if (ok) { + result = regdb_transaction_commit(); + if (!W_ERROR_IS_OK(result)) { + DEBUG(10, ("regdb_transaction_commit failed: %s\n", + win_errstr(result))); + } + } else { + result = regdb_transaction_cancel(); + if (!W_ERROR_IS_OK(result)) { + DEBUG(10, ("regdb_transaction_cancel failed: %s\n", + win_errstr(result))); + } + } + regdb_close(); return ok; } -- cgit