summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2009-04-17 11:40:17 +0200
committerMichael Adam <obnox@samba.org>2009-04-17 11:46:14 +0200
commit8c023fea86d48ff2fd7990003ce2511b4263b762 (patch)
tree22780783ab40016881a7aedda09ca59172591bc6
parent0ba833f3eedff5dec272eb71f3b09becd8707156 (diff)
downloadsamba-8c023fea86d48ff2fd7990003ce2511b4263b762.tar.gz
samba-8c023fea86d48ff2fd7990003ce2511b4263b762.tar.bz2
samba-8c023fea86d48ff2fd7990003ce2511b4263b762.zip
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
-rw-r--r--source3/registry/reg_api.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c
index 67767a2e56..c1a78c14dc 100644
--- a/source3/registry/reg_api.c
+++ b/source3/registry/reg_api.c
@@ -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))) {