summaryrefslogtreecommitdiff
path: root/source3/registry/reg_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/registry/reg_api.c')
-rw-r--r--source3/registry/reg_api.c18
1 files changed, 18 insertions, 0 deletions
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; i<key->values->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)) {