1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-03 12:58:35 +03:00

r19947: Change regkey_open_internal to take the parent key and a talloc_ctx as

arguments. This also replaces regkey_close_internal by TALLOC_FREE.

Volker
(This used to be commit a177bbb2d5611f03cec25b7577c2e6a542f94a69)
This commit is contained in:
Volker Lendecke 2006-11-29 10:51:00 +00:00 committed by Gerald (Jerry) Carter
parent 443421828a
commit 1c91cca86e
4 changed files with 92 additions and 91 deletions

View File

@ -290,44 +290,67 @@ BOOL regkey_access_check( REGISTRY_KEY *key, uint32 requested, uint32 *granted,
/*********************************************************************** /***********************************************************************
***********************************************************************/ ***********************************************************************/
WERROR regkey_open_internal( REGISTRY_KEY **regkey, const char *path, static int regkey_destructor(REGISTRY_KEY *key)
{
return regdb_close();
}
WERROR regkey_open_internal( TALLOC_CTX *mem_ctx, REGISTRY_KEY *parent,
REGISTRY_KEY **regkey, const char *name,
NT_USER_TOKEN *token, uint32 access_desired ) NT_USER_TOKEN *token, uint32 access_desired )
{ {
WERROR result = WERR_OK; WERROR result = WERR_OK;
REGISTRY_KEY *keyinfo; REGISTRY_KEY *key;
REGSUBKEY_CTR *subkeys = NULL; REGSUBKEY_CTR *subkeys = NULL;
uint32 access_granted; size_t path_len;
DEBUG(7,("regkey_open_internal: name = [%s]\n", name));
if ( !(key = TALLOC_ZERO_P(mem_ctx, REGISTRY_KEY)) ) {
return WERR_NOMEM;
}
if ( !(W_ERROR_IS_OK(result = regdb_open()) ) ) if ( !(W_ERROR_IS_OK(result = regdb_open()) ) )
return result; return result;
DEBUG(7,("regkey_open_internal: name = [%s]\n", path)); talloc_set_destructor(key, regkey_destructor);
if ( !(*regkey = TALLOC_ZERO_P(NULL, REGISTRY_KEY)) ) {
regdb_close();
return WERR_NOMEM;
}
keyinfo = *regkey;
/* initialization */ /* initialization */
keyinfo->type = REG_KEY_GENERIC; key->type = REG_KEY_GENERIC;
if (!(keyinfo->name = talloc_strdup(keyinfo, path))) { if (!(key->name = talloc_strdup(key, name))) {
result = WERR_NOMEM; result = WERR_NOMEM;
goto done; goto done;
} }
if (parent != NULL) {
char *tmp;
if (!(tmp = talloc_asprintf(key, "%s%s%s",
parent ? parent->name : "",
parent ? "\\" : "",
key->name))) {
result = WERR_NOMEM;
goto done;
}
TALLOC_FREE(key->name);
key->name = tmp;
}
path_len = strlen( key->name );
if ( (path_len != 0) && (key->name[path_len-1] == '\\') ) {
key->name[path_len-1] = '\0';
}
/* Tag this as a Performance Counter Key */ /* Tag this as a Performance Counter Key */
if( StrnCaseCmp(path, KEY_HKPD, strlen(KEY_HKPD)) == 0 ) if( StrnCaseCmp(key->name, KEY_HKPD, strlen(KEY_HKPD)) == 0 )
keyinfo->type = REG_KEY_HKPD; key->type = REG_KEY_HKPD;
/* Look up the table of registry I/O operations */ /* Look up the table of registry I/O operations */
if ( !(keyinfo->hook = reghook_cache_find( keyinfo->name )) ) { if ( !(key->hook = reghook_cache_find( key->name )) ) {
DEBUG(0,("open_registry_key: Failed to assigned a REGISTRY_HOOK to [%s]\n", DEBUG(0,("open_registry_key: Failed to assigned a "
keyinfo->name )); "REGISTRY_HOOK to [%s]\n", key->name ));
result = WERR_BADFILE; result = WERR_BADFILE;
goto done; goto done;
} }
@ -335,40 +358,31 @@ WERROR regkey_open_internal( REGISTRY_KEY **regkey, const char *path,
/* check if the path really exists; failed is indicated by -1 */ /* check if the path really exists; failed is indicated by -1 */
/* if the subkey count failed, bail out */ /* if the subkey count failed, bail out */
if ( !(subkeys = TALLOC_ZERO_P( keyinfo, REGSUBKEY_CTR )) ) { if ( !(subkeys = TALLOC_ZERO_P( key, REGSUBKEY_CTR )) ) {
result = WERR_NOMEM; result = WERR_NOMEM;
goto done; goto done;
} }
if ( fetch_reg_keys( keyinfo, subkeys ) == -1 ) { if ( fetch_reg_keys( key, subkeys ) == -1 ) {
result = WERR_BADFILE; result = WERR_BADFILE;
goto done; goto done;
} }
TALLOC_FREE( subkeys ); TALLOC_FREE( subkeys );
if ( !regkey_access_check( keyinfo, access_desired, &access_granted, token ) ) { if ( !regkey_access_check( key, access_desired, &key->access_granted,
token ) ) {
result = WERR_ACCESS_DENIED; result = WERR_ACCESS_DENIED;
goto done; goto done;
} }
keyinfo->access_granted = access_granted; *regkey = key;
result = WERR_OK;
done: done:
if ( !W_ERROR_IS_OK(result) ) { if ( !W_ERROR_IS_OK(result) ) {
regkey_close_internal( *regkey ); TALLOC_FREE(key);
} }
return result; return result;
} }
/*******************************************************************
*******************************************************************/
WERROR regkey_close_internal( REGISTRY_KEY *key )
{
TALLOC_FREE( key );
regdb_close();
return WERR_OK;
}

View File

@ -411,9 +411,8 @@ static BOOL sync_eventlog_params( EVENTLOG_INFO *info )
pstr_sprintf( path, "%s/%s", KEY_EVENTLOG, elogname ); pstr_sprintf( path, "%s/%s", KEY_EVENTLOG, elogname );
wresult = wresult = regkey_open_internal( NULL, NULL, &keyinfo, path,
regkey_open_internal( &keyinfo, path, get_root_nt_token( ), get_root_nt_token( ), REG_KEY_READ );
REG_KEY_READ );
if ( !W_ERROR_IS_OK( wresult ) ) { if ( !W_ERROR_IS_OK( wresult ) ) {
DEBUG( 4, DEBUG( 4,
@ -436,7 +435,7 @@ static BOOL sync_eventlog_params( EVENTLOG_INFO *info )
if ( ( val = regval_ctr_getvalue( values, "MaxSize" ) ) != NULL ) if ( ( val = regval_ctr_getvalue( values, "MaxSize" ) ) != NULL )
uiMaxSize = IVAL( regval_data_p( val ), 0 ); uiMaxSize = IVAL( regval_data_p( val ), 0 );
regkey_close_internal( keyinfo ); TALLOC_FREE( keyinfo );
tdb_store_int32( ELOG_TDB_CTX(info->etdb), EVT_MAXSIZE, uiMaxSize ); tdb_store_int32( ELOG_TDB_CTX(info->etdb), EVT_MAXSIZE, uiMaxSize );
tdb_store_int32( ELOG_TDB_CTX(info->etdb), EVT_RETENTION, uiRetention ); tdb_store_int32( ELOG_TDB_CTX(info->etdb), EVT_RETENTION, uiRetention );

View File

@ -43,7 +43,6 @@ struct regkey_info {
static void free_regkey_info(void *ptr) static void free_regkey_info(void *ptr)
{ {
struct regkey_info *info = (struct regkey_info *)ptr; struct regkey_info *info = (struct regkey_info *)ptr;
regkey_close_internal( info->key );
TALLOC_FREE(info); TALLOC_FREE(info);
} }
@ -107,36 +106,21 @@ static WERROR open_registry_key( pipes_struct *p, POLICY_HND *hnd,
const char *subkeyname, const char *subkeyname,
uint32 access_desired ) uint32 access_desired )
{ {
char *keypath;
int path_len;
WERROR result = WERR_OK; WERROR result = WERR_OK;
struct regkey_info *info; struct regkey_info *info;
/* create a full registry path and strip any trailing '\' /* create a full registry path and strip any trailing '\'
characters */ characters */
if (asprintf(&keypath, "%s%s%s",
parent ? parent->name : "",
parent ? "\\" : "",
subkeyname) == -1) {
return WERR_NOMEM;
}
path_len = strlen( keypath );
if ( path_len && keypath[path_len-1] == '\\' )
keypath[path_len-1] = '\0';
if (!(info = TALLOC_ZERO_P(NULL, struct regkey_info))) { if (!(info = TALLOC_ZERO_P(NULL, struct regkey_info))) {
SAFE_FREE(keypath);
return WERR_NOMEM; return WERR_NOMEM;
} }
/* now do the internal open */ /* now do the internal open */
result = regkey_open_internal( &info->key, keypath, result = regkey_open_internal( info, parent, &info->key, subkeyname,
p->pipe_user.nt_user_token, p->pipe_user.nt_user_token,
access_desired ); access_desired );
SAFE_FREE(keypath);
if ( !W_ERROR_IS_OK(result) ) { if ( !W_ERROR_IS_OK(result) ) {
TALLOC_FREE(info); TALLOC_FREE(info);
@ -144,7 +128,6 @@ static WERROR open_registry_key( pipes_struct *p, POLICY_HND *hnd,
} }
if ( !create_policy_hnd( p, hnd, free_regkey_info, info ) ) { if ( !create_policy_hnd( p, hnd, free_regkey_info, info ) ) {
regkey_close_internal( info->key );
TALLOC_FREE(info); TALLOC_FREE(info);
return WERR_BADFILE; return WERR_BADFILE;
} }

View File

@ -322,8 +322,8 @@ static void add_new_svc_name( REGISTRY_KEY *key_parent, REGSUBKEY_CTR *subkeys,
/* open the new service key */ /* open the new service key */
pstr_sprintf( path, "%s\\%s", KEY_SERVICES, name ); pstr_sprintf( path, "%s\\%s", KEY_SERVICES, name );
wresult = regkey_open_internal( &key_service, path, get_root_nt_token(), wresult = regkey_open_internal( NULL, NULL, &key_service, path,
REG_KEY_ALL ); get_root_nt_token(), REG_KEY_ALL );
if ( !W_ERROR_IS_OK(wresult) ) { if ( !W_ERROR_IS_OK(wresult) ) {
DEBUG(0,("add_new_svc_name: key lookup failed! [%s] (%s)\n", DEBUG(0,("add_new_svc_name: key lookup failed! [%s] (%s)\n",
path, dos_errstr(wresult))); path, dos_errstr(wresult)));
@ -334,7 +334,7 @@ static void add_new_svc_name( REGISTRY_KEY *key_parent, REGSUBKEY_CTR *subkeys,
if ( !(svc_subkeys = TALLOC_ZERO_P( key_service, REGSUBKEY_CTR )) ) { if ( !(svc_subkeys = TALLOC_ZERO_P( key_service, REGSUBKEY_CTR )) ) {
DEBUG(0,("add_new_svc_name: talloc() failed!\n")); DEBUG(0,("add_new_svc_name: talloc() failed!\n"));
regkey_close_internal( key_service ); TALLOC_FREE( key_service );
return; return;
} }
@ -346,7 +346,7 @@ static void add_new_svc_name( REGISTRY_KEY *key_parent, REGSUBKEY_CTR *subkeys,
if ( !(values = TALLOC_ZERO_P( key_service, REGVAL_CTR )) ) { if ( !(values = TALLOC_ZERO_P( key_service, REGVAL_CTR )) ) {
DEBUG(0,("add_new_svc_name: talloc() failed!\n")); DEBUG(0,("add_new_svc_name: talloc() failed!\n"));
regkey_close_internal( key_service ); TALLOC_FREE( key_service );
return; return;
} }
@ -355,29 +355,29 @@ static void add_new_svc_name( REGISTRY_KEY *key_parent, REGSUBKEY_CTR *subkeys,
/* cleanup the service key*/ /* cleanup the service key*/
regkey_close_internal( key_service ); TALLOC_FREE( key_service );
/* now add the security descriptor */ /* now add the security descriptor */
pstr_sprintf( path, "%s\\%s\\%s", KEY_SERVICES, name, "Security" ); pstr_sprintf( path, "%s\\%s\\%s", KEY_SERVICES, name, "Security" );
wresult = regkey_open_internal( &key_secdesc, path, get_root_nt_token(), wresult = regkey_open_internal( NULL, NULL, &key_secdesc, path,
REG_KEY_ALL ); get_root_nt_token(), REG_KEY_ALL );
if ( !W_ERROR_IS_OK(wresult) ) { if ( !W_ERROR_IS_OK(wresult) ) {
DEBUG(0,("add_new_svc_name: key lookup failed! [%s] (%s)\n", DEBUG(0,("add_new_svc_name: key lookup failed! [%s] (%s)\n",
path, dos_errstr(wresult))); path, dos_errstr(wresult)));
regkey_close_internal( key_secdesc ); TALLOC_FREE( key_secdesc );
return; return;
} }
if ( !(values = TALLOC_ZERO_P( key_secdesc, REGVAL_CTR )) ) { if ( !(values = TALLOC_ZERO_P( key_secdesc, REGVAL_CTR )) ) {
DEBUG(0,("add_new_svc_name: talloc() failed!\n")); DEBUG(0,("add_new_svc_name: talloc() failed!\n"));
regkey_close_internal( key_secdesc ); TALLOC_FREE( key_secdesc );
return; return;
} }
if ( !(sd = construct_service_sd(key_secdesc)) ) { if ( !(sd = construct_service_sd(key_secdesc)) ) {
DEBUG(0,("add_new_svc_name: Failed to create default sec_desc!\n")); DEBUG(0,("add_new_svc_name: Failed to create default sec_desc!\n"));
regkey_close_internal( key_secdesc ); TALLOC_FREE( key_secdesc );
return; return;
} }
@ -394,7 +394,7 @@ static void add_new_svc_name( REGISTRY_KEY *key_parent, REGSUBKEY_CTR *subkeys,
/* finally cleanup the Security key */ /* finally cleanup the Security key */
prs_mem_free( &ps ); prs_mem_free( &ps );
regkey_close_internal( key_secdesc ); TALLOC_FREE( key_secdesc );
return; return;
} }
@ -412,8 +412,8 @@ void svcctl_init_keys( void )
/* bad mojo here if the lookup failed. Should not happen */ /* bad mojo here if the lookup failed. Should not happen */
wresult = regkey_open_internal( &key, KEY_SERVICES, get_root_nt_token(), wresult = regkey_open_internal( NULL, NULL, &key, KEY_SERVICES,
REG_KEY_ALL ); get_root_nt_token(), REG_KEY_ALL );
if ( !W_ERROR_IS_OK(wresult) ) { if ( !W_ERROR_IS_OK(wresult) ) {
DEBUG(0,("init_services_keys: key lookup failed! (%s)\n", DEBUG(0,("init_services_keys: key lookup failed! (%s)\n",
@ -425,7 +425,7 @@ void svcctl_init_keys( void )
if ( !(subkeys = TALLOC_ZERO_P( key, REGSUBKEY_CTR )) ) { if ( !(subkeys = TALLOC_ZERO_P( key, REGSUBKEY_CTR )) ) {
DEBUG(0,("init_services_keys: talloc() failed!\n")); DEBUG(0,("init_services_keys: talloc() failed!\n"));
regkey_close_internal( key ); TALLOC_FREE( key );
return; return;
} }
@ -447,7 +447,7 @@ void svcctl_init_keys( void )
add_new_svc_name( key, subkeys, service_list[i] ); add_new_svc_name( key, subkeys, service_list[i] );
} }
regkey_close_internal( key ); TALLOC_FREE( key );
/* initialize the control hooks */ /* initialize the control hooks */
@ -476,7 +476,8 @@ SEC_DESC* svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *
/* now add the security descriptor */ /* now add the security descriptor */
pstr_sprintf( path, "%s\\%s\\%s", KEY_SERVICES, name, "Security" ); pstr_sprintf( path, "%s\\%s\\%s", KEY_SERVICES, name, "Security" );
wresult = regkey_open_internal( &key, path, token, REG_KEY_ALL ); wresult = regkey_open_internal( NULL, NULL, &key, path, token,
REG_KEY_ALL );
if ( !W_ERROR_IS_OK(wresult) ) { if ( !W_ERROR_IS_OK(wresult) ) {
DEBUG(0,("svcctl_get_secdesc: key lookup failed! [%s] (%s)\n", DEBUG(0,("svcctl_get_secdesc: key lookup failed! [%s] (%s)\n",
path, dos_errstr(wresult))); path, dos_errstr(wresult)));
@ -485,7 +486,7 @@ SEC_DESC* svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *
if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) { if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) {
DEBUG(0,("add_new_svc_name: talloc() failed!\n")); DEBUG(0,("add_new_svc_name: talloc() failed!\n"));
regkey_close_internal( key ); TALLOC_FREE( key );
return NULL; return NULL;
} }
@ -494,7 +495,7 @@ SEC_DESC* svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *
if ( !(val = regval_ctr_getvalue( values, "Security" )) ) { if ( !(val = regval_ctr_getvalue( values, "Security" )) ) {
DEBUG(6,("svcctl_get_secdesc: constructing default secdesc for service [%s]\n", DEBUG(6,("svcctl_get_secdesc: constructing default secdesc for service [%s]\n",
name)); name));
regkey_close_internal( key ); TALLOC_FREE( key );
return construct_service_sd( ctx ); return construct_service_sd( ctx );
} }
@ -505,7 +506,7 @@ SEC_DESC* svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *
prs_give_memory( &ps, (char *)regval_data_p(val), regval_size(val), False ); prs_give_memory( &ps, (char *)regval_data_p(val), regval_size(val), False );
if ( !sec_io_desc("sec_desc", &sd, &ps, 0 ) ) { if ( !sec_io_desc("sec_desc", &sd, &ps, 0 ) ) {
regkey_close_internal( key ); TALLOC_FREE( key );
return construct_service_sd( ctx ); return construct_service_sd( ctx );
} }
@ -514,7 +515,7 @@ SEC_DESC* svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *
/* finally cleanup the Security key */ /* finally cleanup the Security key */
prs_mem_free( &ps ); prs_mem_free( &ps );
regkey_close_internal( key ); TALLOC_FREE( key );
return ret_sd; return ret_sd;
} }
@ -535,7 +536,8 @@ BOOL svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, SEC_DESC *sec_desc,
/* now add the security descriptor */ /* now add the security descriptor */
pstr_sprintf( path, "%s\\%s\\%s", KEY_SERVICES, name, "Security" ); pstr_sprintf( path, "%s\\%s\\%s", KEY_SERVICES, name, "Security" );
wresult = regkey_open_internal( &key, path, token, REG_KEY_ALL ); wresult = regkey_open_internal( NULL, NULL, &key, path, token,
REG_KEY_ALL );
if ( !W_ERROR_IS_OK(wresult) ) { if ( !W_ERROR_IS_OK(wresult) ) {
DEBUG(0,("svcctl_get_secdesc: key lookup failed! [%s] (%s)\n", DEBUG(0,("svcctl_get_secdesc: key lookup failed! [%s] (%s)\n",
path, dos_errstr(wresult))); path, dos_errstr(wresult)));
@ -544,7 +546,7 @@ BOOL svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, SEC_DESC *sec_desc,
if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) { if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) {
DEBUG(0,("add_new_svc_name: talloc() failed!\n")); DEBUG(0,("add_new_svc_name: talloc() failed!\n"));
regkey_close_internal( key ); TALLOC_FREE( key );
return False; return False;
} }
@ -561,7 +563,7 @@ BOOL svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, SEC_DESC *sec_desc,
/* cleanup */ /* cleanup */
prs_mem_free( &ps ); prs_mem_free( &ps );
regkey_close_internal( key); TALLOC_FREE( key);
return ret; return ret;
} }
@ -581,7 +583,8 @@ char* svcctl_lookup_dispname( const char *name, NT_USER_TOKEN *token )
/* now add the security descriptor */ /* now add the security descriptor */
pstr_sprintf( path, "%s\\%s", KEY_SERVICES, name ); pstr_sprintf( path, "%s\\%s", KEY_SERVICES, name );
wresult = regkey_open_internal( &key, path, token, REG_KEY_READ ); wresult = regkey_open_internal( NULL, NULL, &key, path, token,
REG_KEY_READ );
if ( !W_ERROR_IS_OK(wresult) ) { if ( !W_ERROR_IS_OK(wresult) ) {
DEBUG(0,("svcctl_lookup_dispname: key lookup failed! [%s] (%s)\n", DEBUG(0,("svcctl_lookup_dispname: key lookup failed! [%s] (%s)\n",
path, dos_errstr(wresult))); path, dos_errstr(wresult)));
@ -590,7 +593,7 @@ char* svcctl_lookup_dispname( const char *name, NT_USER_TOKEN *token )
if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) { if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) {
DEBUG(0,("svcctl_lookup_dispname: talloc() failed!\n")); DEBUG(0,("svcctl_lookup_dispname: talloc() failed!\n"));
regkey_close_internal( key ); TALLOC_FREE( key );
goto fail; goto fail;
} }
@ -601,13 +604,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 ); rpcstr_pull( display_name, regval_data_p(val), sizeof(display_name), regval_size(val), 0 );
regkey_close_internal( key ); TALLOC_FREE( key );
return display_name; return display_name;
fail: fail:
/* default to returning the service name */ /* default to returning the service name */
regkey_close_internal( key ); TALLOC_FREE( key );
fstrcpy( display_name, name ); fstrcpy( display_name, name );
return display_name; return display_name;
} }
@ -627,7 +630,8 @@ char* svcctl_lookup_description( const char *name, NT_USER_TOKEN *token )
/* now add the security descriptor */ /* now add the security descriptor */
pstr_sprintf( path, "%s\\%s", KEY_SERVICES, name ); pstr_sprintf( path, "%s\\%s", KEY_SERVICES, name );
wresult = regkey_open_internal( &key, path, token, REG_KEY_READ ); wresult = regkey_open_internal( NULL, NULL, &key, path, token,
REG_KEY_READ );
if ( !W_ERROR_IS_OK(wresult) ) { if ( !W_ERROR_IS_OK(wresult) ) {
DEBUG(0,("svcctl_lookup_dispname: key lookup failed! [%s] (%s)\n", DEBUG(0,("svcctl_lookup_dispname: key lookup failed! [%s] (%s)\n",
path, dos_errstr(wresult))); path, dos_errstr(wresult)));
@ -636,7 +640,7 @@ char* svcctl_lookup_description( const char *name, NT_USER_TOKEN *token )
if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) { if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) {
DEBUG(0,("svcctl_lookup_dispname: talloc() failed!\n")); DEBUG(0,("svcctl_lookup_dispname: talloc() failed!\n"));
regkey_close_internal( key ); TALLOC_FREE( key );
return NULL; return NULL;
} }
@ -647,7 +651,7 @@ char* svcctl_lookup_description( const char *name, NT_USER_TOKEN *token )
else else
rpcstr_pull( description, regval_data_p(val), sizeof(description), regval_size(val), 0 ); rpcstr_pull( description, regval_data_p(val), sizeof(description), regval_size(val), 0 );
regkey_close_internal( key ); TALLOC_FREE( key );
return description; return description;
} }
@ -666,7 +670,8 @@ REGVAL_CTR* svcctl_fetch_regvalues( const char *name, NT_USER_TOKEN *token )
/* now add the security descriptor */ /* now add the security descriptor */
pstr_sprintf( path, "%s\\%s", KEY_SERVICES, name ); pstr_sprintf( path, "%s\\%s", KEY_SERVICES, name );
wresult = regkey_open_internal( &key, path, token, REG_KEY_READ ); wresult = regkey_open_internal( NULL, NULL, &key, path, token,
REG_KEY_READ );
if ( !W_ERROR_IS_OK(wresult) ) { if ( !W_ERROR_IS_OK(wresult) ) {
DEBUG(0,("svcctl_fetch_regvalues: key lookup failed! [%s] (%s)\n", DEBUG(0,("svcctl_fetch_regvalues: key lookup failed! [%s] (%s)\n",
path, dos_errstr(wresult))); path, dos_errstr(wresult)));
@ -675,13 +680,13 @@ REGVAL_CTR* svcctl_fetch_regvalues( const char *name, NT_USER_TOKEN *token )
if ( !(values = TALLOC_ZERO_P( NULL, REGVAL_CTR )) ) { if ( !(values = TALLOC_ZERO_P( NULL, REGVAL_CTR )) ) {
DEBUG(0,("svcctl_fetch_regvalues: talloc() failed!\n")); DEBUG(0,("svcctl_fetch_regvalues: talloc() failed!\n"));
regkey_close_internal( key ); TALLOC_FREE( key );
return NULL; return NULL;
} }
fetch_reg_values( key, values ); fetch_reg_values( key, values );
regkey_close_internal( key ); TALLOC_FREE( key );
return values; return values;
} }