summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/utils/net_registry_util.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source3/utils/net_registry_util.c b/source3/utils/net_registry_util.c
index 5bb289335e..a3b84a344f 100644
--- a/source3/utils/net_registry_util.c
+++ b/source3/utils/net_registry_util.c
@@ -98,7 +98,9 @@ void print_registry_value_with_name(const char *valname,
/**
* Split path into hive name and subkeyname
* normalizations performed:
- * - convert '/' to '\\'
+ * - if the path contains no '\\' characters,
+ * assume that the legacy format of using '/'
+ * as a separator is used and convert '/' to '\\'
* - strip trailing '\\' chars
*/
WERROR split_hive_key(TALLOC_CTX *ctx, const char *path, char **hivename,
@@ -115,7 +117,12 @@ WERROR split_hive_key(TALLOC_CTX *ctx, const char *path, char **hivename,
return WERR_INVALID_PARAM;
}
- *hivename = talloc_string_sub(ctx, path, "/", "\\");
+ if (strchr(path, '\\') == NULL) {
+ *hivename = talloc_string_sub(ctx, path, "/", "\\");
+ } else {
+ *hivename = talloc_strdup(ctx, path);
+ }
+
if (*hivename == NULL) {
return WERR_NOMEM;
}