summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-03-31 17:20:07 +0200
committerMichael Adam <obnox@samba.org>2008-03-31 17:22:02 +0200
commit0bf8ba9f267c073818d2d7b97556bdd9de6456bf (patch)
tree7ec128a49dec4394b6957259826afe657fc5ec36 /source3/registry
parentf4a1e30be537844e38b0be9a80d1d94fc6578383 (diff)
downloadsamba-0bf8ba9f267c073818d2d7b97556bdd9de6456bf.tar.gz
samba-0bf8ba9f267c073818d2d7b97556bdd9de6456bf.tar.bz2
samba-0bf8ba9f267c073818d2d7b97556bdd9de6456bf.zip
registry: reg_deletevalue should return error, when the value does not exist.
Michael (This used to be commit 04b48984bbf84c55bb41a74a11cbcc7358377fed)
Diffstat (limited to 'source3/registry')
-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)) {