From de8a339cdf95f6737a8b1d34aa2aa9287bae0e46 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Tue, 29 Jun 2010 16:10:32 +0200 Subject: s4:registry - move some common constraint checks to the "local" backend They should also be enforced when we don't use "ldb". --- source4/lib/registry/local.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'source4/lib/registry/local.c') diff --git a/source4/lib/registry/local.c b/source4/lib/registry/local.c index 3078518539..98791743ae 100644 --- a/source4/lib/registry/local.c +++ b/source4/lib/registry/local.c @@ -80,6 +80,10 @@ static WERROR local_open_key(TALLOC_CTX *mem_ctx, const char **elements = NULL; int el; + if (path == NULL) { + return WERR_INVALID_PARAM; + } + orig = talloc_strdup(mem_ctx, path); W_ERROR_HAVE_NO_MEMORY(orig); curbegin = orig; @@ -180,6 +184,10 @@ static WERROR local_create_key(TALLOC_CTX *mem_ctx, const char **elements = NULL; int el; + if (path == NULL) { + return WERR_INVALID_PARAM; + } + orig = talloc_strdup(mem_ctx, path); W_ERROR_HAVE_NO_MEMORY(orig); curbegin = orig; @@ -240,6 +248,10 @@ static WERROR local_set_value(struct registry_key *key, const char *name, { struct local_key *local = (struct local_key *)key; + if (name == NULL) { + return WERR_INVALID_PARAM; + } + return hive_key_set_value(local->hive_key, name, type, data); } @@ -249,6 +261,10 @@ static WERROR local_get_value(TALLOC_CTX *mem_ctx, { const struct local_key *local = (const struct local_key *)key; + if (name == NULL) { + return WERR_INVALID_PARAM; + } + return hive_get_value(mem_ctx, local->hive_key, name, type, data); } @@ -269,6 +285,10 @@ static WERROR local_delete_key(TALLOC_CTX *mem_ctx, struct registry_key *key, { const struct local_key *local = (const struct local_key *)key; + if (name == NULL) { + return WERR_INVALID_PARAM; + } + return hive_key_del(mem_ctx, local->hive_key, name); } @@ -277,6 +297,10 @@ static WERROR local_delete_value(TALLOC_CTX *mem_ctx, struct registry_key *key, { const struct local_key *local = (const struct local_key *)key; + if (name == NULL) { + return WERR_INVALID_PARAM; + } + return hive_key_del_value(mem_ctx, local->hive_key, name); } -- cgit