Author: gd
Date: 2007-08-14 15:29:42 +0000 (Tue, 14 Aug 2007)
New Revision: 24418

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24418

Log:
Adding reg_deleteallvalues().

Guenther

Modified:
   branches/SAMBA_3_2/source/registry/reg_api.c
   branches/SAMBA_3_2_0/source/registry/reg_api.c


Changeset:
Modified: branches/SAMBA_3_2/source/registry/reg_api.c
===================================================================
--- branches/SAMBA_3_2/source/registry/reg_api.c        2007-08-14 15:26:54 UTC 
(rev 24417)
+++ branches/SAMBA_3_2/source/registry/reg_api.c        2007-08-14 15:29:42 UTC 
(rev 24418)
@@ -618,7 +618,31 @@
        return WERR_OK;
 }
 
+WERROR reg_deleteallvalues(struct registry_key *key)
+{
+       WERROR err;
+       int i;
 
+       if (!(key->key->access_granted & SEC_RIGHTS_SET_VALUE)) {
+               return WERR_ACCESS_DENIED;
+       }
+
+       if (!W_ERROR_IS_OK(err = fill_value_cache(key))) {
+               return err;
+       }
+
+       for (i=0; i<key->values->num_values; i++) {
+               regval_ctr_delvalue(key->values, 
key->values->values[i]->valuename);
+       }
+
+       if (!store_reg_values(key->key, key->values)) {
+               TALLOC_FREE(key->values);
+               return WERR_REG_IO_FAILURE;
+       }
+
+       return WERR_OK;
+}
+
 /*
  * Utility function to open a complete registry path including the hive
  * prefix. This should become the replacement function for

Modified: branches/SAMBA_3_2_0/source/registry/reg_api.c
===================================================================
--- branches/SAMBA_3_2_0/source/registry/reg_api.c      2007-08-14 15:26:54 UTC 
(rev 24417)
+++ branches/SAMBA_3_2_0/source/registry/reg_api.c      2007-08-14 15:29:42 UTC 
(rev 24418)
@@ -618,7 +618,31 @@
        return WERR_OK;
 }
 
+WERROR reg_deleteallvalues(struct registry_key *key)
+{
+       WERROR err;
+       int i;
 
+       if (!(key->key->access_granted & SEC_RIGHTS_SET_VALUE)) {
+               return WERR_ACCESS_DENIED;
+       }
+
+       if (!W_ERROR_IS_OK(err = fill_value_cache(key))) {
+               return err;
+       }
+
+       for (i=0; i<key->values->num_values; i++) {
+               regval_ctr_delvalue(key->values, 
key->values->values[i]->valuename);
+       }
+
+       if (!store_reg_values(key->key, key->values)) {
+               TALLOC_FREE(key->values);
+               return WERR_REG_IO_FAILURE;
+       }
+
+       return WERR_OK;
+}
+
 /*
  * Utility function to open a complete registry path including the hive
  * prefix. This should become the replacement function for

Reply via email to