s3:registry accept windows like long hivenames
authorGregor Beck <gbeck@sernet.de>
Wed, 20 Mar 2013 12:00:26 +0000 (13:00 +0100)
committerChristian Ambach <ambi@samba.org>
Wed, 20 Mar 2013 16:08:51 +0000 (17:08 +0100)
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Christian Ambach <ambi@samba.org>
Autobuild-User(master): Christian Ambach <ambi@samba.org>
Autobuild-Date(master): Wed Mar 20 17:08:52 CET 2013 on sn-devel-104

source3/registry/reg_api.c

index c263174bc23bbc504540d939aa5f3b43ff6371f9..ca990e22f85d5ab040ffd4e7c21a002ce64f0a69 100644 (file)
@@ -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);
 }