Open the registry database
***********************************************************************/
-bool regdb_init(void)
+WERROR regdb_init(void)
{
const char *vstring = "INFO/version";
uint32 vers_id;
+ WERROR werr;
if (regdb) {
DEBUG(10, ("regdb_init: incrementing refcount (%d)\n",
regdb_refcount));
regdb_refcount++;
- return true;
+ return WERR_OK;
}
regdb = db_open_trans(NULL, state_path("registry.tdb"), 0,
regdb = db_open_trans(NULL, state_path("registry.tdb"), 0,
REG_TDB_FLAGS, O_RDWR|O_CREAT, 0600);
if (!regdb) {
+ werr = ntstatus_to_werror(map_nt_error_from_unix(errno));
DEBUG(0,("regdb_init: Failed to open registry %s (%s)\n",
state_path("registry.tdb"), strerror(errno) ));
- return false;
+ return werr;
}
DEBUG(10,("regdb_init: Successfully created registry tdb\n"));
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("regdb_init: error storing %s = %d: %s\n",
vstring, REGVER_V1, nt_errstr(status)));
- return false;
+ return ntstatus_to_werror(status);
} else {
DEBUG(10, ("regdb_init: stored %s = %d\n",
vstring, REGVER_V1));
}
}
- return true;
+ return WERR_OK;
}
/***********************************************************************
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();
bool init_registry( void )
{
int i;
+ WERROR werr;
bool ret = false;
- if ( !regdb_init() ) {
+ werr = regdb_init();
+ if (!W_ERROR_IS_OK(werr)) {
DEBUG(0, ("init_registry: failed to initialize the registry "
- "tdb!\n"));
+ "(%s)\n", dos_errstr(werr)));
goto fail;
}
*/
bool registry_init_smbconf(const char *keyname)
{
+ WERROR werr;
bool ret = false;
- int saved_errno = 0;
DEBUG(10, ("registry_init_smbconf called\n"));
keyname = KEY_SMBCONF;
}
- 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)));
goto done;
}
if (!init_registry_key(keyname)) {