From 178c430821e5c564d5a50bc067424a428e6350ca Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 22 Mar 2008 02:05:53 +0100 Subject: registry: add reg_init_basic() - init registry with only the db backend. Michael (This used to be commit 1831042bdcbfe569ae39177058dfe1d914416513) --- source3/registry/reg_init_basic.c | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 source3/registry/reg_init_basic.c (limited to 'source3/registry/reg_init_basic.c') diff --git a/source3/registry/reg_init_basic.c b/source3/registry/reg_init_basic.c new file mode 100644 index 0000000000..13f3c93383 --- /dev/null +++ b/source3/registry/reg_init_basic.c @@ -0,0 +1,45 @@ +/* + * Unix SMB/CIFS implementation. + * Registry helper routines + * Copyright (C) Michael Adam 2008 + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 3 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, see . + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_REGISTRY + +bool registry_init_basic(void) +{ + int saved_errno = 0; + + DEBUG(10, ("registry_init_basic called\n")); + + if (!regdb_init()) { + saved_errno = errno; + DEBUG(1, ("Can't open the registry")); + if (saved_errno) { + DEBUGADD(1, (": %s", strerror(saved_errno))); + } + DEBUGADD(1, (".\n")); + return false; + } + regdb_close(); + + reghook_cache_init(); + + return true; +} -- cgit From 6b85938f275aad0fbb329ee46ed718ce8b101930 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Apr 2008 12:41:34 +0200 Subject: registry: change regdb_init() to return WERROR instead of bool. Michael (This used to be commit c312852abce72bc167abee8b29fc699c4a643ca7) --- source3/registry/reg_init_basic.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'source3/registry/reg_init_basic.c') diff --git a/source3/registry/reg_init_basic.c b/source3/registry/reg_init_basic.c index 13f3c93383..9098bc4aec 100644 --- a/source3/registry/reg_init_basic.c +++ b/source3/registry/reg_init_basic.c @@ -24,17 +24,13 @@ bool registry_init_basic(void) { - int saved_errno = 0; + WERROR werr; DEBUG(10, ("registry_init_basic called\n")); - if (!regdb_init()) { - saved_errno = errno; - DEBUG(1, ("Can't open the registry")); - if (saved_errno) { - DEBUGADD(1, (": %s", strerror(saved_errno))); - } - DEBUGADD(1, (".\n")); + werr = regdb_init(); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(1, ("Can't open the registry: %s\n", dos_errstr(werr))); return false; } regdb_close(); -- cgit From cb624c40573b10fbb93c14a1aa436780ffd6caa4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Apr 2008 12:46:21 +0200 Subject: registry: unify debug output in the registry init functions. Michael (This used to be commit 4fd9b45ffc08e7deeae58be3129832148748af13) --- source3/registry/reg_init_basic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/registry/reg_init_basic.c') diff --git a/source3/registry/reg_init_basic.c b/source3/registry/reg_init_basic.c index 9098bc4aec..e72765bdf2 100644 --- a/source3/registry/reg_init_basic.c +++ b/source3/registry/reg_init_basic.c @@ -30,7 +30,8 @@ bool registry_init_basic(void) werr = regdb_init(); if (!W_ERROR_IS_OK(werr)) { - DEBUG(1, ("Can't open the registry: %s\n", dos_errstr(werr))); + DEBUG(1, ("Failed to initialize the registry: %s\n", + dos_errstr(werr))); return false; } regdb_close(); -- cgit From 4b4306eb4a55ae1c705464e3220d963651ce9b91 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Apr 2008 14:18:06 +0200 Subject: registry: change reghook_cache_init() to return WERROR and use it in the callers. Michael (This used to be commit 2f4ca62dce50225d67ba8643afba4199e1845c5f) --- source3/registry/reg_init_basic.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source3/registry/reg_init_basic.c') diff --git a/source3/registry/reg_init_basic.c b/source3/registry/reg_init_basic.c index e72765bdf2..72ab9d1e65 100644 --- a/source3/registry/reg_init_basic.c +++ b/source3/registry/reg_init_basic.c @@ -36,7 +36,12 @@ bool registry_init_basic(void) } regdb_close(); - reghook_cache_init(); + werr = reghook_cache_init(); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(1, ("Failed to initialize the reghook cache: %s\n", + dos_errstr(werr))); + return false; + } return true; } -- cgit From 3f01e05a77eec61f367e5cce7908bdcf02d1749a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Apr 2008 15:12:04 +0200 Subject: registry: change registry_init_basic() to return WERROR instead of bool Michael (This used to be commit 6a31e659cb371395dff0906786f3c6ef0cc2b3de) --- source3/registry/reg_init_basic.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/registry/reg_init_basic.c') diff --git a/source3/registry/reg_init_basic.c b/source3/registry/reg_init_basic.c index 72ab9d1e65..cdf172c289 100644 --- a/source3/registry/reg_init_basic.c +++ b/source3/registry/reg_init_basic.c @@ -22,7 +22,7 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_REGISTRY -bool registry_init_basic(void) +WERROR registry_init_basic(void) { WERROR werr; @@ -32,16 +32,16 @@ bool registry_init_basic(void) if (!W_ERROR_IS_OK(werr)) { DEBUG(1, ("Failed to initialize the registry: %s\n", dos_errstr(werr))); - return false; + goto done; } - regdb_close(); werr = reghook_cache_init(); if (!W_ERROR_IS_OK(werr)) { DEBUG(1, ("Failed to initialize the reghook cache: %s\n", dos_errstr(werr))); - return false; } - return true; +done: + regdb_close(); + return werr; } -- cgit From 4ae2e8c7ba7f4bf12e83c68eacd9cb4c1b914be5 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Apr 2008 15:21:31 +0200 Subject: registry: refactor common part of registry initialization out. into a new function registry_init_common(). Michael (This used to be commit 5da52b95ac69e4abfbc44335df2447bec8f16e13) --- source3/registry/reg_init_basic.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'source3/registry/reg_init_basic.c') diff --git a/source3/registry/reg_init_basic.c b/source3/registry/reg_init_basic.c index cdf172c289..c5e2c346b0 100644 --- a/source3/registry/reg_init_basic.c +++ b/source3/registry/reg_init_basic.c @@ -22,26 +22,34 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_REGISTRY -WERROR registry_init_basic(void) +WERROR registry_init_common(void) { WERROR werr; - DEBUG(10, ("registry_init_basic called\n")); - werr = regdb_init(); if (!W_ERROR_IS_OK(werr)) { - DEBUG(1, ("Failed to initialize the registry: %s\n", + DEBUG(0, ("Failed to initialize the registry: %s\n", dos_errstr(werr))); goto done; } werr = reghook_cache_init(); if (!W_ERROR_IS_OK(werr)) { - DEBUG(1, ("Failed to initialize the reghook cache: %s\n", + DEBUG(0, ("Failed to initialize the reghook cache: %s\n", dos_errstr(werr))); } done: + return werr; +} + +WERROR registry_init_basic(void) +{ + WERROR werr; + + DEBUG(10, ("registry_init_basic called\n")); + + werr = registry_init_common(); regdb_close(); return werr; } -- cgit