summaryrefslogtreecommitdiff
path: root/source3/registry/reg_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/registry/reg_api.c')
-rw-r--r--source3/registry/reg_api.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c
index c263174bc2..ca990e22f8 100644
--- a/source3/registry/reg_api.c
+++ b/source3/registry/reg_api.c
@@ -70,6 +70,7 @@
#include "reg_dispatcher.h"
#include "reg_objects.h"
#include "../librpc/gen_ndr/ndr_security.h"
+#include "reg_parse_internal.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_REGISTRY
@@ -232,12 +233,17 @@ WERROR reg_openhive(TALLOC_CTX *mem_ctx, const char *hive,
const struct security_token *token,
struct registry_key **pkey)
{
+ const struct hive_info *hi;
SMB_ASSERT(hive != NULL);
- SMB_ASSERT(hive[0] != '\0');
SMB_ASSERT(strchr(hive, '\\') == NULL);
- return regkey_open_onelevel(mem_ctx, NULL, hive, token, desired_access,
- pkey);
+ hi = hive_info(hive);
+ if (hi == NULL) {
+ return WERR_BADFILE;
+ }
+
+ return regkey_open_onelevel(mem_ctx, NULL, hi->short_name, token,
+ desired_access, pkey);
}