diff options
Diffstat (limited to 'source3/registry/reg_db.c')
-rw-r--r-- | source3/registry/reg_db.c | 60 |
1 files changed, 26 insertions, 34 deletions
diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c index 741bc4127b..ce9d68a264 100644 --- a/source3/registry/reg_db.c +++ b/source3/registry/reg_db.c @@ -29,14 +29,6 @@ static TDB_CONTEXT *tdb_reg; #define VALUE_PREFIX "SAMBA_REGVAL" -static BOOL regdb_store_reg_keys( const char *keyname, REGSUBKEY_CTR *subkeys ); -static BOOL regdb_store_reg_values( const char *keyname, REGVAL_CTR *values); -static int regdb_fetch_reg_keys( const char* key, REGSUBKEY_CTR *subkeys ); -static int regdb_fetch_reg_values( const char* key, REGVAL_CTR *values ); - - - - /* List the deepest path into the registry. All part components will be created.*/ /* If you want to have a part of the path controlled by the tdb abd part by @@ -129,10 +121,10 @@ static BOOL init_registry_data( void ) regsubkey_ctr_init( &subkeys ); - regdb_fetch_reg_keys( base, &subkeys ); + regdb_fetch_keys( base, &subkeys ); if ( *subkeyname ) regsubkey_ctr_addkey( &subkeys, subkeyname ); - if ( !regdb_store_reg_keys( base, &subkeys )) + if ( !regdb_store_keys( base, &subkeys )) return False; regsubkey_ctr_destroy( &subkeys ); @@ -144,7 +136,7 @@ static BOOL init_registry_data( void ) for ( i=0; builtin_registry_values[i].path != NULL; i++ ) { regval_ctr_init( &values ); - regdb_fetch_reg_values( builtin_registry_values[i].path, &values ); + regdb_fetch_values( builtin_registry_values[i].path, &values ); switch( builtin_registry_values[i].type ) { case REG_DWORD: regval_ctr_addvalue( &values, @@ -167,7 +159,7 @@ static BOOL init_registry_data( void ) DEBUG(0,("init_registry_data: invalid value type in builtin_registry_values [%d]\n", builtin_registry_values[i].type)); } - regdb_store_reg_values( builtin_registry_values[i].path, &values ); + regdb_store_values( builtin_registry_values[i].path, &values ); regval_ctr_destroy( &values ); } @@ -223,7 +215,7 @@ BOOL init_registry_db( void ) fstrings ***********************************************************************/ -static BOOL regdb_store_reg_keys_internal( const char *key, REGSUBKEY_CTR *ctr ) +static BOOL regdb_store_keys_internal( const char *key, REGSUBKEY_CTR *ctr ) { TDB_DATA kbuf, dbuf; char *buffer, *tmpbuf; @@ -256,7 +248,7 @@ static BOOL regdb_store_reg_keys_internal( const char *key, REGSUBKEY_CTR *ctr ) if ( len > buflen ) { /* allocate some extra space */ if ((tmpbuf = SMB_REALLOC( buffer, len*2 )) == NULL) { - DEBUG(0,("regdb_store_reg_keys: Failed to realloc memory of size [%d]\n", len*2)); + DEBUG(0,("regdb_store_keys: Failed to realloc memory of size [%d]\n", len*2)); ret = False; goto done; } @@ -289,7 +281,7 @@ done: do not currently exist ***********************************************************************/ -static BOOL regdb_store_reg_keys( const char *key, REGSUBKEY_CTR *ctr ) +BOOL regdb_store_keys( const char *key, REGSUBKEY_CTR *ctr ) { int num_subkeys, i; pstring path; @@ -299,12 +291,12 @@ static BOOL regdb_store_reg_keys( const char *key, REGSUBKEY_CTR *ctr ) /* fetch a list of the old subkeys so we can determine if any were deleted */ regsubkey_ctr_init( &old_subkeys ); - regdb_fetch_reg_keys( key, &old_subkeys ); + regdb_fetch_keys( key, &old_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 )); + if ( !regdb_store_keys_internal( key, ctr ) ) { + DEBUG(0,("regdb_store_keys: Failed to store new subkey list for parent [%s}\n", key )); return False; } @@ -328,10 +320,10 @@ static BOOL regdb_store_reg_keys( const char *key, REGSUBKEY_CTR *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 ) { + if ( regdb_fetch_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 )); + if ( !regdb_store_keys_internal( path, &subkeys ) ) { + DEBUG(0,("regdb_store_keys: Failed to store new record for key [%s}\n", path )); regsubkey_ctr_destroy( &subkeys ); return False; } @@ -348,7 +340,7 @@ static BOOL regdb_store_reg_keys( const char *key, REGSUBKEY_CTR *ctr ) released by the caller. ***********************************************************************/ -static int regdb_fetch_reg_keys( const char* key, REGSUBKEY_CTR *ctr ) +int regdb_fetch_keys( const char* key, REGSUBKEY_CTR *ctr ) { pstring path; uint32 num_items; @@ -358,7 +350,7 @@ static int regdb_fetch_reg_keys( const char* key, REGSUBKEY_CTR *ctr ) int i; fstring subkeyname; - DEBUG(10,("regdb_fetch_reg_keys: Enter key => [%s]\n", key ? key : "NULL")); + DEBUG(10,("regdb_fetch_keys: Enter key => [%s]\n", key ? key : "NULL")); pstrcpy( path, key ); @@ -372,7 +364,7 @@ static int regdb_fetch_reg_keys( const char* key, REGSUBKEY_CTR *ctr ) buflen = dbuf.dsize; if ( !buf ) { - DEBUG(5,("regdb_fetch_reg_keys: tdb lookup failed to locate key [%s]\n", key)); + DEBUG(5,("regdb_fetch_keys: tdb lookup failed to locate key [%s]\n", key)); return -1; } @@ -385,7 +377,7 @@ static int regdb_fetch_reg_keys( const char* key, REGSUBKEY_CTR *ctr ) SAFE_FREE( dbuf.dptr ); - DEBUG(10,("regdb_fetch_reg_keys: Exit [%d] items\n", num_items)); + DEBUG(10,("regdb_fetch_keys: Exit [%d] items\n", num_items)); return num_items; } @@ -472,13 +464,13 @@ static int regdb_pack_values(REGVAL_CTR *values, char *buf, int buflen) released by the caller. ***********************************************************************/ -static int regdb_fetch_reg_values( const char* key, REGVAL_CTR *values ) +int regdb_fetch_values( const char* key, REGVAL_CTR *values ) { TDB_DATA data; pstring keystr; int len; - DEBUG(10,("regdb_fetch_reg_values: Looking for value of key [%s] \n", key)); + DEBUG(10,("regdb_fetch_values: Looking for value of key [%s] \n", key)); pstr_sprintf( keystr, "%s/%s", VALUE_PREFIX, key ); normalize_reg_path( keystr ); @@ -502,19 +494,19 @@ static int regdb_fetch_reg_values( const char* key, REGVAL_CTR *values ) values in the registry.tdb ***********************************************************************/ -static BOOL regdb_store_reg_values( const char *key, REGVAL_CTR *values ) +BOOL regdb_store_values( const char *key, REGVAL_CTR *values ) { TDB_DATA data; pstring keystr; int len, ret; - DEBUG(10,("regdb_store_reg_values: Looking for value of key [%s] \n", key)); + DEBUG(10,("regdb_store_values: Looking for value of key [%s] \n", key)); ZERO_STRUCT( data ); len = regdb_pack_values( values, data.dptr, data.dsize ); if ( len <= 0 ) { - DEBUG(0,("regdb_store_reg_values: unable to pack values. len <= 0\n")); + DEBUG(0,("regdb_store_values: unable to pack values. len <= 0\n")); return False; } @@ -541,10 +533,10 @@ static BOOL regdb_store_reg_values( const char *key, REGVAL_CTR *values ) */ REGISTRY_OPS regdb_ops = { - regdb_fetch_reg_keys, - regdb_fetch_reg_values, - regdb_store_reg_keys, - regdb_store_reg_values, + regdb_fetch_keys, + regdb_fetch_values, + regdb_store_keys, + regdb_store_values, NULL }; |