diff options
author | Gerald Carter <jerry@samba.org> | 2002-07-19 22:16:03 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2002-07-19 22:16:03 +0000 |
commit | 3c0a9c46d8057b9499d7d48a67ba15f9942d558a (patch) | |
tree | 7f0d36ed16565c30afeba9f1dec14c2f3d486391 /source3 | |
parent | 12e237da6813ca6a40410c73c75152a840f4ea61 (diff) | |
download | samba-3c0a9c46d8057b9499d7d48a67ba15f9942d558a.tar.gz samba-3c0a9c46d8057b9499d7d48a67ba15f9942d558a.tar.bz2 samba-3c0a9c46d8057b9499d7d48a67ba15f9942d558a.zip |
fixed seg fault in registry frontend caused by trying to
use a destroyed TALLOC_CTX*
(This used to be commit 432b9f8d7c20fbf3b2a0906c8a93272abbe43fb6)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/adt_tree.c | 2 | ||||
-rw-r--r-- | source3/registry/reg_cachehook.c | 11 | ||||
-rw-r--r-- | source3/registry/reg_db.c | 6 | ||||
-rw-r--r-- | source3/registry/reg_frontend.c | 16 |
4 files changed, 23 insertions, 12 deletions
diff --git a/source3/lib/adt_tree.c b/source3/lib/adt_tree.c index 3a6e722c97..9c4ad423c1 100644 --- a/source3/lib/adt_tree.c +++ b/source3/lib/adt_tree.c @@ -420,6 +420,8 @@ void* sorted_tree_find( SORTED_TREE *tree, char *key ) } while ( base && current ); /* result should be the data_p from the lowest match node in the tree */ + if ( result ) + DEBUG(10,("sorted_tree_find: Found data_p!\n")); SAFE_FREE( keystr ); diff --git a/source3/registry/reg_cachehook.c b/source3/registry/reg_cachehook.c index 346ba20eb7..e2444d8d17 100644 --- a/source3/registry/reg_cachehook.c +++ b/source3/registry/reg_cachehook.c @@ -69,15 +69,20 @@ BOOL reghook_cache_add( REGISTRY_HOOK *hook ) REGISTRY_HOOK* reghook_cache_find( char *keyname ) { char *key; + int len; if ( !keyname ) return NULL; - - if ( (key = strdup( keyname )) == NULL ) { - DEBUG(0,("reghook_cache_find: strdup() failed for string [%s] !?!?!\n", + + len = strlen( keyname ); + if ( !(key = malloc( len + 2 )) ) { + DEBUG(0,("reghook_cache_find: malloc failed for string [%s] !?!?!\n", keyname)); return NULL; } + + *key = '\\'; + strncpy( key+1, keyname, len+1); string_sub( key, "\\", "/", 0 ); diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c index d44a8d004c..fb6ebdbf7c 100644 --- a/source3/registry/reg_db.c +++ b/source3/registry/reg_db.c @@ -43,12 +43,14 @@ static BOOL init_registry_data( void ) /* HKEY_LOCAL_MACHINE */ + regsubkey_ctr_init( &subkeys ); pstrcpy( keyname, KEY_HKLM ); regsubkey_ctr_addkey( &subkeys, "SYSTEM" ); if ( !regdb_store_reg_keys( keyname, &subkeys )) return False; regsubkey_ctr_destroy( &subkeys ); + regsubkey_ctr_init( &subkeys ); pstrcpy( keyname, KEY_HKLM ); pstrcat( keyname, "/SYSTEM" ); regsubkey_ctr_addkey( &subkeys, "CurrentControlSet" ); @@ -56,6 +58,7 @@ static BOOL init_registry_data( void ) return False; regsubkey_ctr_destroy( &subkeys ); + regsubkey_ctr_init( &subkeys ); pstrcpy( keyname, KEY_HKLM ); pstrcat( keyname, "/SYSTEM/CurrentControlSet" ); regsubkey_ctr_addkey( &subkeys, "Control" ); @@ -64,6 +67,7 @@ static BOOL init_registry_data( void ) return False; regsubkey_ctr_destroy( &subkeys ); + regsubkey_ctr_init( &subkeys ); pstrcpy( keyname, KEY_HKLM ); pstrcat( keyname, "/SYSTEM/CurrentControlSet/Control" ); regsubkey_ctr_addkey( &subkeys, "Print" ); @@ -77,6 +81,7 @@ static BOOL init_registry_data( void ) if ( !regdb_store_reg_keys( keyname, &subkeys )) return False; + regsubkey_ctr_init( &subkeys ); pstrcpy( keyname, KEY_HKLM ); pstrcat( keyname, "/SYSTEM/CurrentControlSet/services" ); regsubkey_ctr_addkey( &subkeys, "Netlogon" ); @@ -84,6 +89,7 @@ static BOOL init_registry_data( void ) return False; regsubkey_ctr_destroy( &subkeys ); + regsubkey_ctr_init( &subkeys ); pstrcpy( keyname, KEY_HKLM ); pstrcat( keyname, "/SYSTEM/CurrentControlSet/services/Netlogon" ); regsubkey_ctr_addkey( &subkeys, "parameters" ); diff --git a/source3/registry/reg_frontend.c b/source3/registry/reg_frontend.c index 3e3ec49425..6090245096 100644 --- a/source3/registry/reg_frontend.c +++ b/source3/registry/reg_frontend.c @@ -248,11 +248,10 @@ char* regsubkey_ctr_specific_key( REGSUBKEY_CTR *ctr, uint32 key_index ) void regsubkey_ctr_destroy( REGSUBKEY_CTR *ctr ) { - if ( ctr ) - talloc_destroy( ctr->ctx ); - - ctr->num_subkeys = 0; - ctr->subkeys = NULL; + if ( ctr ) { + talloc_destroy( ctr->ctx ); + ZERO_STRUCTP( ctr ); + } } @@ -285,10 +284,9 @@ int regval_ctr_numvals( REGVAL_CTR *ctr ) void regval_ctr_destroy( REGVAL_CTR *ctr ) { - if ( ctr ) + if ( ctr ) { talloc_destroy( ctr->ctx ); - - ctr->num_values = 0; - ctr->values = NULL; + ZERO_STRUCTP( ctr ); + } } |