1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

s3:registry: Prevent creation of keys containing the '/' character.

This creates a broken registry that can only be fixed with
tdbtool, since the '/' sign is used as a key separator after
normalization at a lower level.

This makes e.g. "net conf setparm abc/def comment xyz" fail with
WERR_INVALID_PARAM, which is much more desirable than a broken
registry.tdb.

Michael
This commit is contained in:
Michael Adam 2009-04-17 11:40:17 +02:00
parent 0ba833f3ee
commit 8c023fea86

View File

@ -459,6 +459,16 @@ WERROR reg_createkey(TALLOC_CTX *ctx, struct registry_key *parent,
char *path, *end;
WERROR err;
/*
* We must refuse to handle subkey-paths containing
* a '/' character because at a lower level, after
* normalization, '/' is treated as a key separator
* just like '\\'.
*/
if (strchr(subkeypath, '/') != NULL) {
return WERR_INVALID_PARAM;
}
if (!(mem_ctx = talloc_new(ctx))) return WERR_NOMEM;
if (!(path = talloc_strdup(mem_ctx, subkeypath))) {