diff options
Diffstat (limited to 'source/registry/reg_util.c')
-rw-r--r-- | source/registry/reg_util.c | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/source/registry/reg_util.c b/source/registry/reg_util.c index 714a39f307..e72353e7c5 100644 --- a/source/registry/reg_util.c +++ b/source/registry/reg_util.c @@ -83,38 +83,19 @@ bool reg_split_key(char *path, char **base, char **key) return true; } -/** - * The full path to the registry key is used as database key - * after the \'s are converted to /'s. - * Leading and trailing '/' and '\' characters are stripped. - * Key string is also normalized to UPPER case. - */ +/********************************************************************** + The full path to the registry key is used as database after the + \'s are converted to /'s. Key string is also normalized to UPPER + case. +**********************************************************************/ char *normalize_reg_path(TALLOC_CTX *ctx, const char *keyname ) { - char *p; - char *nkeyname; - - /* skip leading '/' and '\' chars */ - p = (char *)keyname; - while ((*p == '/') || (*p == '\\')) { - p++; - } - - nkeyname = talloc_string_sub(ctx, p, "\\", "/"); - if (nkeyname == NULL) { + char *nkeyname = talloc_string_sub(ctx, keyname, "\\", "/"); + if (!nkeyname) { return NULL; } - - /* strip trailing '/' chars */ - p = strrchr(nkeyname, '/'); - while ((p != NULL) && (p[1] == '\0')) { - *p = '\0'; - p = strrchr(nkeyname, '/'); - } - strupper_m(nkeyname); - return nkeyname; } |