diff options
author | Michael Adam <obnox@samba.org> | 2010-06-25 17:26:34 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2010-06-25 17:35:42 +0200 |
commit | 36b95fee152d348926fad1bcdc9f05312bb2aad5 (patch) | |
tree | b7084d25ee742b4a442cafeb7d5a846edd98fdb2 /source3 | |
parent | 8e4f8128234f0015c9d63bb18821487bb3e7b06e (diff) | |
download | samba-36b95fee152d348926fad1bcdc9f05312bb2aad5.tar.gz samba-36b95fee152d348926fad1bcdc9f05312bb2aad5.tar.bz2 samba-36b95fee152d348926fad1bcdc9f05312bb2aad5.zip |
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.
Diffstat (limited to 'source3')
-rw-r--r-- | source3/utils/net_registry_util.c | 11 |
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; } |