summaryrefslogtreecommitdiff
path: root/source3/services
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-10-07 12:14:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:04:54 -0500
commit01a1e5cdb0339a7cb3a85280b118985562bb2d7f (patch)
tree34067426544a5cdfe872943db9a80d1da36f82c1 /source3/services
parent5b32737374419525dd57216f595440847bb3c619 (diff)
downloadsamba-01a1e5cdb0339a7cb3a85280b118985562bb2d7f.tar.gz
samba-01a1e5cdb0339a7cb3a85280b118985562bb2d7f.tar.bz2
samba-01a1e5cdb0339a7cb3a85280b118985562bb2d7f.zip
r10819: merging a couple of fixes from trunk
* only keep the registry,tdb file open when we have an open key handle * tpot's setup.py fix * removing files that no longer exist in trunk and copying some that were missing in 3.0 (This used to be commit 6c6bf6ca5fd430a7a20bf20ed08050328660e570)
Diffstat (limited to 'source3/services')
-rw-r--r--source3/services/services_db.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/source3/services/services_db.c b/source3/services/services_db.c
index 7c75d41352..e1b2f88865 100644
--- a/source3/services/services_db.c
+++ b/source3/services/services_db.c
@@ -325,6 +325,7 @@ static void add_new_svc_name( REGISTRY_KEY *key_parent, REGSUBKEY_CTR *subkeys,
if ( !(svc_subkeys = TALLOC_ZERO_P( key_service, REGSUBKEY_CTR )) ) {
DEBUG(0,("add_new_svc_name: talloc() failed!\n"));
+ regkey_close_internal( key_service );
return;
}
@@ -336,6 +337,7 @@ static void add_new_svc_name( REGISTRY_KEY *key_parent, REGSUBKEY_CTR *subkeys,
if ( !(values = TALLOC_ZERO_P( key_service, REGVAL_CTR )) ) {
DEBUG(0,("add_new_svc_name: talloc() failed!\n"));
+ regkey_close_internal( key_service );
return;
}
@@ -344,7 +346,7 @@ static void add_new_svc_name( REGISTRY_KEY *key_parent, REGSUBKEY_CTR *subkeys,
/* cleanup the service key*/
- TALLOC_FREE( key_service );
+ regkey_close_internal( key_service );
/* now add the security descriptor */
@@ -354,17 +356,19 @@ static void add_new_svc_name( REGISTRY_KEY *key_parent, REGSUBKEY_CTR *subkeys,
if ( !W_ERROR_IS_OK(wresult) ) {
DEBUG(0,("add_new_svc_name: key lookup failed! [%s] (%s)\n",
path, dos_errstr(wresult)));
+ regkey_close_internal( key_secdesc );
return;
}
if ( !(values = TALLOC_ZERO_P( key_secdesc, REGVAL_CTR )) ) {
DEBUG(0,("add_new_svc_name: talloc() failed!\n"));
+ regkey_close_internal( key_secdesc );
return;
}
if ( !(sd = construct_service_sd(key_secdesc)) ) {
DEBUG(0,("add_new_svc_name: Failed to create default sec_desc!\n"));
- TALLOC_FREE( key_secdesc );
+ regkey_close_internal( key_secdesc );
return;
}
@@ -381,7 +385,7 @@ static void add_new_svc_name( REGISTRY_KEY *key_parent, REGSUBKEY_CTR *subkeys,
/* finally cleanup the Security key */
prs_mem_free( &ps );
- TALLOC_FREE( key_secdesc );
+ regkey_close_internal( key_secdesc );
return;
}
@@ -413,6 +417,7 @@ void svcctl_init_keys( void )
if ( !(subkeys = TALLOC_ZERO_P( key, REGSUBKEY_CTR )) ) {
DEBUG(0,("init_services_keys: talloc() failed!\n"));
+ regkey_close_internal( key );
return;
}
@@ -436,7 +441,7 @@ void svcctl_init_keys( void )
new_services = True;
}
- TALLOC_FREE( key );
+ regkey_close_internal( key );
/* initialize the control hooks */
@@ -474,7 +479,7 @@ SEC_DESC* svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *
if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) {
DEBUG(0,("add_new_svc_name: talloc() failed!\n"));
- TALLOC_FREE( key );
+ regkey_close_internal( key );
return NULL;
}
@@ -483,7 +488,7 @@ SEC_DESC* svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *
if ( !(val = regval_ctr_getvalue( values, "Security" )) ) {
DEBUG(6,("svcctl_get_secdesc: constructing default secdesc for service [%s]\n",
name));
- TALLOC_FREE( key );
+ regkey_close_internal( key );
return construct_service_sd( ctx );
}
@@ -494,7 +499,7 @@ SEC_DESC* svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *
prs_give_memory( &ps, regval_data_p(val), regval_size(val), False );
if ( !sec_io_desc("sec_desc", &sd, &ps, 0 ) ) {
- TALLOC_FREE( key );
+ regkey_close_internal( key );
return construct_service_sd( ctx );
}
@@ -503,7 +508,7 @@ SEC_DESC* svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *
/* finally cleanup the Security key */
prs_mem_free( &ps );
- TALLOC_FREE( key );
+ regkey_close_internal( key );
return ret_sd;
}
@@ -532,7 +537,7 @@ char* svcctl_lookup_dispname( const char *name, NT_USER_TOKEN *token )
if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) {
DEBUG(0,("svcctl_lookup_dispname: talloc() failed!\n"));
- TALLOC_FREE( key );
+ regkey_close_internal( key );
goto fail;
}
@@ -543,12 +548,13 @@ char* svcctl_lookup_dispname( const char *name, NT_USER_TOKEN *token )
rpcstr_pull( display_name, regval_data_p(val), sizeof(display_name), regval_size(val), 0 );
- TALLOC_FREE( key );
+ regkey_close_internal( key );
return display_name;
fail:
/* default to returning the service name */
+ regkey_close_internal( key );
fstrcpy( display_name, name );
return display_name;
}
@@ -577,7 +583,7 @@ char* svcctl_lookup_description( const char *name, NT_USER_TOKEN *token )
if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) {
DEBUG(0,("svcctl_lookup_dispname: talloc() failed!\n"));
- TALLOC_FREE( key );
+ regkey_close_internal( key );
return NULL;
}
@@ -588,7 +594,7 @@ char* svcctl_lookup_description( const char *name, NT_USER_TOKEN *token )
else
rpcstr_pull( description, regval_data_p(val), sizeof(description), regval_size(val), 0 );
- TALLOC_FREE( key );
+ regkey_close_internal( key );
return description;
}
@@ -616,13 +622,13 @@ REGVAL_CTR* svcctl_fetch_regvalues( const char *name, NT_USER_TOKEN *token )
if ( !(values = TALLOC_ZERO_P( NULL, REGVAL_CTR )) ) {
DEBUG(0,("svcctl_fetch_regvalues: talloc() failed!\n"));
- TALLOC_FREE( key );
+ regkey_close_internal( key );
return NULL;
}
fetch_reg_values( key, values );
- TALLOC_FREE( key );
+ regkey_close_internal( key );
return values;
}