registry: add reg_init_basic() - init registry with only the db backend.
[amitay/samba.git] / source3 / registry / reg_init_basic.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * Registry helper routines
4  * Copyright (C) Michael Adam 2008
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation; either version 3 of the License, or (at your option)
9  * any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * this program; if not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #include "includes.h"
21
22 #undef DBGC_CLASS
23 #define DBGC_CLASS DBGC_REGISTRY
24
25 bool registry_init_basic(void)
26 {
27         int saved_errno = 0;
28
29         DEBUG(10, ("registry_init_basic called\n"));
30
31         if (!regdb_init()) {
32                 saved_errno = errno;
33                 DEBUG(1, ("Can't open the registry"));
34                 if (saved_errno) {
35                         DEBUGADD(1, (": %s", strerror(saved_errno)));
36                 }
37                 DEBUGADD(1, (".\n"));
38                 return false;
39         }
40         regdb_close();
41
42         reghook_cache_init();
43
44         return true;
45 }