]> git.samba.org - garming/samba-autobuild/.git/commitdiff
s3-amend: Don't overwrite existing values
authorVolker Lendecke <vl@samba.org>
Tue, 15 Feb 2011 17:16:43 +0000 (18:16 +0100)
committerVolker Lendecke <vlendec@samba.org>
Tue, 15 Feb 2011 18:11:25 +0000 (19:11 +0100)
This saves a ton of tdb transactions on smbd startup

Andreas, Günther, please check!

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Tue Feb 15 19:11:25 CET 2011 on sn-devel-104

source3/registry/reg_api.c

index acce7ab1b475c519ac7b35a38b29726ccb17ad39..7c2e01dccc594fcaa6be30d2704ad47930e2e4c0 100644 (file)
@@ -659,6 +659,7 @@ done:
 WERROR reg_setvalue(struct registry_key *key, const char *name,
                    const struct registry_value *val)
 {
+       struct regval_blob *existing;
        WERROR err;
        int res;
 
@@ -670,6 +671,15 @@ WERROR reg_setvalue(struct registry_key *key, const char *name,
                return err;
        }
 
+       existing = regval_ctr_getvalue(key->values, name);
+
+       if ((existing != NULL) &&
+           (regval_size(existing) == val->data.length) &&
+           (memcmp(regval_data_p(existing), val->data.data,
+                   val->data.length) == 0)) {
+               return WERR_OK;
+       }
+
        res = regval_ctr_addvalue(key->values, name, val->type,
                                  val->data.data, val->data.length);