diff options
Diffstat (limited to 'source4/lib/registry/common')
-rw-r--r-- | source4/lib/registry/common/reg_interface.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/source4/lib/registry/common/reg_interface.c b/source4/lib/registry/common/reg_interface.c index e748c836cf..93e5b60984 100644 --- a/source4/lib/registry/common/reg_interface.c +++ b/source4/lib/registry/common/reg_interface.c @@ -58,7 +58,19 @@ NTSTATUS registry_register(void *_function) /* Find a backend in the list of available backends */ static struct reg_init_function_entry *reg_find_backend_entry(const char *name) { - struct reg_init_function_entry *entry = backends; + struct reg_init_function_entry *entry; + static BOOL reg_first_init = True; + + if(reg_first_init) { + status = register_subsystem("registry", registry_register); + if (!NT_STATUS_IS_OK(status)) + return WERR_GENERAL_FAILURE; + + static_init_registry; + reg_first_init = False; + } + + entry = backends; while(entry) { if (strcmp(entry->functions->name, name)==0) return entry; @@ -68,25 +80,20 @@ static struct reg_init_function_entry *reg_find_backend_entry(const char *name) return NULL; } +BOOL reg_has_backend(const char *backend) +{ + return reg_find_backend_entry(backend)?True:False; +} + /* Open a registry file/host/etc */ WERROR reg_open(const char *backend, const char *location, const char *credentials, REG_HANDLE **h) { struct reg_init_function_entry *entry; - static BOOL reg_first_init = True; TALLOC_CTX *mem_ctx; REG_HANDLE *ret; NTSTATUS status; WERROR werr; - - if(reg_first_init) { - status = register_subsystem("registry", registry_register); - if (!NT_STATUS_IS_OK(status)) - return WERR_GENERAL_FAILURE; - - static_init_registry; - reg_first_init = False; - } - + entry = reg_find_backend_entry(backend); if (!entry) { |