From 0bf8ba9f267c073818d2d7b97556bdd9de6456bf Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 31 Mar 2008 17:20:07 +0200 Subject: registry: reg_deletevalue should return error, when the value does not exist. Michael (This used to be commit 04b48984bbf84c55bb41a74a11cbcc7358377fed) --- source3/registry/reg_api.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index e52aaacb4d..1a0bf2b16a 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -653,6 +653,19 @@ WERROR reg_setvalue(struct registry_key *key, const char *name, return WERR_OK; } +static WERROR reg_value_exists(struct registry_key *key, const char *name) +{ + int i; + + for (i=0; ivalues->num_values; i++) { + if (strequal(key->values->values[i]->valuename, name)) { + return WERR_OK; + } + } + + return WERR_BADFILE; +} + WERROR reg_deletevalue(struct registry_key *key, const char *name) { WERROR err; @@ -665,6 +678,11 @@ WERROR reg_deletevalue(struct registry_key *key, const char *name) return err; } + err = reg_value_exists(key, name); + if (!W_ERROR_IS_OK(err)) { + return err; + } + regval_ctr_delvalue(key->values, name); if (!store_reg_values(key->key, key->values)) { -- cgit