]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:registry: Prevent creation of keys containing the '/' character.
authorMichael Adam <obnox@samba.org>
Fri, 17 Apr 2009 09:40:17 +0000 (11:40 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 17 Apr 2009 12:47:33 +0000 (14:47 +0200)
Even though "net conf setparm abc/def comment xyz" does not
create a broken registry we do not want such keys to be created.
Since we get problems accessing these with "net registry" since
the registry code treats the '/' sign as a separator as 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

source/registry/reg_api.c

index e9a71452556fb198ef1b7eb7001b91481beafb34..4678636b817825f538cd83384085cb1e6cbc29a6 100644 (file)
@@ -455,6 +455,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))) {