summaryrefslogtreecommitdiff
path: root/source3/registry/reg_db.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-06-17 15:35:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:57:19 -0500
commit2129d3c711a109b47c3c1596a6a639520d2f72d2 (patch)
tree4627816c5ff9085a1f87c7e981f6f21f3693899f /source3/registry/reg_db.c
parent2102f6bff9641eeec3b593529be7bf8d9ec784d4 (diff)
downloadsamba-2129d3c711a109b47c3c1596a6a639520d2f72d2.tar.gz
samba-2129d3c711a109b47c3c1596a6a639520d2f72d2.tar.bz2
samba-2129d3c711a109b47c3c1596a6a639520d2f72d2.zip
r7691: * add .gdbinit to the svn:ignore files
* start adding write support to the Samba registry Flesh out the server implementations of RegCreateKey(), RegSetValue(), RegDeleteKey() and RegDeleteValue() I can create a new key using regedit.exe now but the 'New Key #1' key cannot be deleted yet. (This used to be commit e188fdbef8f0ad202b0ecf3c30be2941ebe6d5b1)
Diffstat (limited to 'source3/registry/reg_db.c')
-rw-r--r--source3/registry/reg_db.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c
index 7efa032e39..a459aa5f5f 100644
--- a/source3/registry/reg_db.c
+++ b/source3/registry/reg_db.c
@@ -68,8 +68,6 @@ static BOOL init_registry_data( void )
int i;
const char *p, *p2;
- ZERO_STRUCTP( &subkeys );
-
/* loop over all of the predefined paths and add each component */
for ( i=0; builtin_registry_paths[i] != NULL; i++ ) {
@@ -168,10 +166,10 @@ BOOL init_registry_db( void )
The full path to the registry key is used as database after the
\'s are converted to /'s. Key string is also normalized to UPPER
- case.
+ case.
***********************************************************************/
-static BOOL regdb_store_reg_keys( char *key, REGSUBKEY_CTR *ctr )
+static BOOL regdb_store_reg_keys_internal( char *key, REGSUBKEY_CTR *ctr )
{
TDB_DATA kbuf, dbuf;
char *buffer, *tmpbuf;
@@ -237,6 +235,44 @@ done:
}
/***********************************************************************
+ Store the new subkey record and create any child key records that
+ do not currently exist
+ ***********************************************************************/
+
+static BOOL regdb_store_reg_keys( char *key, REGSUBKEY_CTR *ctr )
+{
+ int num_subkeys, i;
+ pstring path;
+ REGSUBKEY_CTR subkeys;
+
+ /* store the subkey list for the parent */
+
+ if ( !regdb_store_reg_keys_internal( key, ctr ) ) {
+ DEBUG(0,("regdb_store_reg_keys: Failed to store new subkey list for parent [%s}\n", key ));
+ return False;
+ }
+
+ /* now create records for any subkeys that don't already exist */
+
+ num_subkeys = regsubkey_ctr_numkeys( ctr );
+ for ( i=0; i<num_subkeys; i++ ) {
+ pstr_sprintf( path, "%s%c%s", key, '/', regsubkey_ctr_specific_key( ctr, i ) );
+ regsubkey_ctr_init( &subkeys );
+ if ( regdb_fetch_reg_keys( path, &subkeys ) == -1 ) {
+ /* create a record with 0 subkeys */
+ if ( !regdb_store_reg_keys_internal( path, &subkeys ) ) {
+ DEBUG(0,("regdb_store_reg_keys: Failed to store new record for key [%s}\n", path ));
+ return False;
+ }
+ }
+ regsubkey_ctr_destroy( &subkeys );
+ }
+
+ return True;
+}
+
+
+/***********************************************************************
Retrieve an array of strings containing subkeys. Memory should be
released by the caller. The subkeys are stored in a catenated string
of null terminated character strings