From 36b95fee152d348926fad1bcdc9f05312bb2aad5 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 25 Jun 2010 17:26:34 +0200 Subject: s3:net [rpc] registry: be as user-friendly as possible wrt to the normalization change The registry has been changed to use '\' as a key delimiter instead of '/'. Originally, one could mix both characters in the specification of registry key for net [rpc] registry. Now this can not work any more, since '/' is generally treated as a valid character of a key name. Now, to be as user-friendly as possible, the net [rpc] registry code has been changed to still support '/' as a key name delimiter if no '\' character is found in the given registry path string. In that case, all '/' characters are converted to '\' characters before proceeding. If on the other hand, a '\' character is found in the path string, then no conversion is assumed, and it is hence assumed that the path is already in the correct form and '/' characters are supposed to be part of the key names. --- source3/utils/net_registry_util.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'source3/utils') 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; } -- cgit