2005-06-15 04:54:43 +04:00
/*
* Unix SMB / CIFS implementation .
* Service Control API Implementation
2005-09-30 21:13:37 +04:00
*
2005-06-15 04:54:43 +04:00
* Copyright ( C ) Marcin Krzysztof Porwit 2005.
2005-09-30 21:13:37 +04:00
* Largely Rewritten by :
* Copyright ( C ) Gerald ( Jerry ) Carter 2005.
2005-06-15 04:54:43 +04:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
2007-07-09 23:25:36 +04:00
* the Free Software Foundation ; either version 3 of the License , or
2005-06-15 04:54:43 +04:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2007-07-10 09:23:25 +04:00
* along with this program ; if not , see < http : //www.gnu.org/licenses/>.
2005-06-15 04:54:43 +04:00
*/
# include "includes.h"
2010-05-20 15:39:46 +04:00
# include "services/services.h"
2009-10-02 02:17:06 +04:00
# include "registry.h"
2010-05-23 17:57:27 +04:00
# include "registry/reg_util_legacy.h"
2005-06-15 04:54:43 +04:00
2005-10-06 21:48:03 +04:00
struct rcinit_file_information {
char * description ;
} ;
struct service_display_info {
const char * servicename ;
const char * daemon ;
const char * dispname ;
const char * description ;
} ;
2007-11-21 04:57:47 +03:00
struct service_display_info builtin_svcs [ ] = {
2005-11-21 16:00:36 +03:00
{ " Spooler " , " smbd " , " Print Spooler " , " Internal service for spooling files to print devices " } ,
2005-12-16 04:41:25 +03:00
{ " NETLOGON " , " smbd " , " Net Logon " , " File service providing access to policy and profile data (not remotely manageable) " } ,
2005-11-21 16:00:36 +03:00
{ " RemoteRegistry " , " smbd " , " Remote Registry Service " , " Internal service providing remote access to "
" the Samba registry " } ,
{ " WINS " , " nmbd " , " Windows Internet Name Service (WINS) " , " Internal service providing a "
2005-12-16 04:41:25 +03:00
" NetBIOS point-to-point name server (not remotely manageable) " } ,
2005-10-06 21:48:03 +04:00
{ NULL , NULL , NULL , NULL }
} ;
2007-11-21 04:57:47 +03:00
struct service_display_info common_unix_svcs [ ] = {
2005-11-21 16:00:36 +03:00
{ " cups " , NULL , " Common Unix Printing System " , " Provides unified printing support for all operating systems " } ,
{ " postfix " , NULL , " Internet Mail Service " , " Provides support for sending and receiving electonic mail " } ,
{ " sendmail " , NULL , " Internet Mail Service " , " Provides support for sending and receiving electonic mail " } ,
{ " portmap " , NULL , " TCP Port to RPC PortMapper " , NULL } ,
{ " xinetd " , NULL , " Internet Meta-Daemon " , NULL } ,
{ " inet " , NULL , " Internet Meta-Daemon " , NULL } ,
{ " xntpd " , NULL , " Network Time Service " , NULL } ,
{ " ntpd " , NULL , " Network Time Service " , NULL } ,
{ " lpd " , NULL , " BSD Print Spooler " , NULL } ,
{ " nfsserver " , NULL , " Network File Service " , NULL } ,
{ " cron " , NULL , " Scheduling Service " , NULL } ,
{ " at " , NULL , " Scheduling Service " , NULL } ,
{ " nscd " , NULL , " Name Service Cache Daemon " , NULL } ,
{ " slapd " , NULL , " LDAP Directory Service " , NULL } ,
{ " ldap " , NULL , " LDAP DIrectory Service " , NULL } ,
{ " ypbind " , NULL , " NIS Directory Service " , NULL } ,
{ " courier-imap " , NULL , " IMAP4 Mail Service " , NULL } ,
{ " courier-pop3 " , NULL , " POP3 Mail Service " , NULL } ,
{ " named " , NULL , " Domain Name Service " , NULL } ,
{ " bind " , NULL , " Domain Name Service " , NULL } ,
{ " httpd " , NULL , " HTTP Server " , NULL } ,
{ " apache " , NULL , " HTTP Server " , " Provides s highly scalable and flexible web server "
" capable of implementing various protocols incluing "
" but not limited to HTTP " } ,
{ " autofs " , NULL , " Automounter " , NULL } ,
{ " squid " , NULL , " Web Cache Proxy " , NULL } ,
2005-11-08 19:33:45 +03:00
{ " perfcountd " , NULL , " Performance Monitoring Daemon " , NULL } ,
2005-11-21 16:00:36 +03:00
{ " pgsql " , NULL , " PgSQL Database Server " , " Provides service for SQL database from Postgresql.org " } ,
{ " arpwatch " , NULL , " ARP Tables watcher " , " Provides service for monitoring ARP tables for changes " } ,
{ " dhcpd " , NULL , " DHCP Server " , " Provides service for dynamic host configuration and IP assignment " } ,
{ " nwserv " , NULL , " NetWare Server Emulator " , " Provides service for emulating Novell NetWare 3.12 server " } ,
{ " proftpd " , NULL , " Professional FTP Server " , " Provides high configurable service for FTP connection and "
" file transferring " } ,
{ " ssh2 " , NULL , " SSH Secure Shell " , " Provides service for secure connection for remote administration " } ,
{ " sshd " , NULL , " SSH Secure Shell " , " Provides service for secure connection for remote administration " } ,
2005-10-06 21:48:03 +04:00
{ NULL , NULL , NULL , NULL }
} ;
2005-09-30 21:13:37 +04:00
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-06-15 04:54:43 +04:00
2010-05-18 12:29:34 +04:00
static struct security_descriptor * construct_service_sd ( TALLOC_CTX * ctx )
2005-06-15 04:54:43 +04:00
{
2010-05-18 05:25:38 +04:00
struct security_ace ace [ 4 ] ;
2005-09-30 21:13:37 +04:00
size_t i = 0 ;
2010-05-18 12:29:34 +04:00
struct security_descriptor * sd = NULL ;
2010-05-18 05:30:40 +04:00
struct security_acl * theacl = NULL ;
2005-09-30 21:13:37 +04:00
size_t sd_size ;
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
/* basic access for Everyone */
2007-11-21 04:57:47 +03:00
2008-10-09 20:49:03 +04:00
init_sec_ace ( & ace [ i + + ] , & global_sid_World ,
SEC_ACE_TYPE_ACCESS_ALLOWED , SERVICE_READ_ACCESS , 0 ) ;
2007-11-21 04:57:47 +03:00
2008-10-09 20:49:03 +04:00
init_sec_ace ( & ace [ i + + ] , & global_sid_Builtin_Power_Users ,
SEC_ACE_TYPE_ACCESS_ALLOWED , SERVICE_EXECUTE_ACCESS , 0 ) ;
2007-11-21 04:57:47 +03:00
2008-10-09 20:49:03 +04:00
init_sec_ace ( & ace [ i + + ] , & global_sid_Builtin_Server_Operators ,
SEC_ACE_TYPE_ACCESS_ALLOWED , SERVICE_ALL_ACCESS , 0 ) ;
init_sec_ace ( & ace [ i + + ] , & global_sid_Builtin_Administrators ,
SEC_ACE_TYPE_ACCESS_ALLOWED , SERVICE_ALL_ACCESS , 0 ) ;
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
/* create the security descriptor */
2007-11-21 04:57:47 +03:00
2009-02-24 02:44:34 +03:00
if ( ! ( theacl = make_sec_acl ( ctx , NT4_ACL_REVISION , i , ace ) ) )
2005-09-30 21:13:37 +04:00
return NULL ;
2005-06-15 04:54:43 +04:00
2007-12-21 00:27:01 +03:00
if ( ! ( sd = make_sec_desc ( ctx , SECURITY_DESCRIPTOR_REVISION_1 ,
SEC_DESC_SELF_RELATIVE , NULL , NULL , NULL ,
2009-02-24 02:44:34 +03:00
theacl , & sd_size ) ) )
2005-09-30 21:13:37 +04:00
return NULL ;
2005-06-15 04:54:43 +04:00
2005-09-30 21:13:37 +04:00
return sd ;
}
2005-06-15 04:54:43 +04:00
/********************************************************************
2005-09-30 21:13:37 +04:00
This is where we do the dirty work of filling in things like the
Display name , Description , etc . . .
2005-06-15 04:54:43 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-10-06 21:48:03 +04:00
static char * get_common_service_dispname ( const char * servicename )
{
int i ;
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
for ( i = 0 ; common_unix_svcs [ i ] . servicename ; i + + ) {
2007-11-21 04:57:47 +03:00
if ( strequal ( servicename , common_unix_svcs [ i ] . servicename ) ) {
2007-12-18 05:00:43 +03:00
char * dispname ;
if ( asprintf ( & dispname ,
" %s (%s) " ,
2005-10-06 21:48:03 +04:00
common_unix_svcs [ i ] . dispname ,
2007-12-18 05:00:43 +03:00
common_unix_svcs [ i ] . servicename ) < 0 ) {
return NULL ;
}
2005-10-06 21:48:03 +04:00
return dispname ;
}
2007-11-21 04:57:47 +03:00
}
2007-12-18 05:00:43 +03:00
return SMB_STRDUP ( servicename ) ;
2005-10-06 21:48:03 +04:00
}
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2007-11-21 04:57:47 +03:00
static char * cleanup_string ( const char * string )
2005-10-06 21:48:03 +04:00
{
2007-11-21 04:57:47 +03:00
char * clean = NULL ;
2005-10-06 21:48:03 +04:00
char * begin , * end ;
2007-11-21 04:57:47 +03:00
TALLOC_CTX * ctx = talloc_tos ( ) ;
2005-10-06 21:48:03 +04:00
2007-11-21 04:57:47 +03:00
clean = talloc_strdup ( ctx , string ) ;
if ( ! clean ) {
return NULL ;
}
2005-10-06 21:48:03 +04:00
begin = clean ;
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
/* trim any beginning whilespace */
2007-11-21 04:57:47 +03:00
while ( isspace ( * begin ) ) {
2005-10-06 21:48:03 +04:00
begin + + ;
2007-11-21 04:57:47 +03:00
}
2005-10-06 21:48:03 +04:00
2007-11-21 04:57:47 +03:00
if ( * begin = = ' \0 ' ) {
2005-10-06 21:48:03 +04:00
return NULL ;
2007-11-21 04:57:47 +03:00
}
2005-10-06 21:48:03 +04:00
/* trim any trailing whitespace or carriage returns.
Start at the end and move backwards */
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
end = begin + strlen ( begin ) - 1 ;
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
while ( isspace ( * end ) | | * end = = ' \n ' | | * end = = ' \r ' ) {
* end = ' \0 ' ;
end - - ;
}
2007-11-21 04:57:47 +03:00
return begin ;
2005-10-06 21:48:03 +04:00
}
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2007-10-19 04:40:25 +04:00
static bool read_init_file ( const char * servicename , struct rcinit_file_information * * service_info )
2005-10-06 21:48:03 +04:00
{
2008-09-17 23:02:13 +04:00
struct rcinit_file_information * info = NULL ;
2007-11-21 04:57:47 +03:00
char * filepath = NULL ;
char str [ 1024 ] ;
2008-09-17 23:02:13 +04:00
XFILE * f = NULL ;
char * p = NULL ;
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
if ( ! ( info = TALLOC_ZERO_P ( NULL , struct rcinit_file_information ) ) )
return False ;
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
/* attempt the file open */
2007-11-21 04:57:47 +03:00
2008-08-15 02:50:56 +04:00
filepath = talloc_asprintf ( info , " %s/%s/%s " , get_dyn_MODULESDIR ( ) ,
2007-11-21 04:57:47 +03:00
SVCCTL_SCRIPT_DIR , servicename ) ;
if ( ! filepath ) {
TALLOC_FREE ( info ) ;
return false ;
}
if ( ! ( f = x_fopen ( filepath , O_RDONLY , 0 ) ) ) {
2005-10-06 21:48:03 +04:00
DEBUG ( 0 , ( " read_init_file: failed to open [%s] \n " , filepath ) ) ;
TALLOC_FREE ( info ) ;
2007-11-21 04:57:47 +03:00
return false ;
2005-10-06 21:48:03 +04:00
}
2007-11-21 04:57:47 +03:00
2005-10-13 17:20:26 +04:00
while ( ( x_fgets ( str , sizeof ( str ) - 1 , f ) ) ! = NULL ) {
2007-11-21 04:57:47 +03:00
/* ignore everything that is not a full line
2005-10-06 21:48:03 +04:00
comment starting with a ' # ' */
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
if ( str [ 0 ] ! = ' # ' )
continue ;
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
/* Look for a line like '^#.*Description:' */
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
if ( ( p = strstr ( str , " Description: " ) ) ! = NULL ) {
char * desc ;
p + = strlen ( " Description: " ) + 1 ;
2007-11-21 04:57:47 +03:00
if ( ! p )
2005-10-06 21:48:03 +04:00
break ;
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
if ( ( desc = cleanup_string ( p ) ) ! = NULL )
info - > description = talloc_strdup ( info , desc ) ;
}
}
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
x_fclose ( f ) ;
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
if ( ! info - > description )
info - > description = talloc_strdup ( info , " External Unix Service " ) ;
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
* service_info = info ;
2007-11-21 04:57:47 +03:00
TALLOC_FREE ( filepath ) ;
2005-10-06 21:48:03 +04:00
return True ;
}
/********************************************************************
This is where we do the dirty work of filling in things like the
Display name , Description , etc . . .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2009-03-23 20:14:17 +03:00
static void fill_service_values ( const char * name , struct regval_ctr * values )
2005-06-15 04:54:43 +04:00
{
2009-09-24 17:01:32 +04:00
char * dname , * ipath , * description ;
2005-09-30 21:13:37 +04:00
uint32 dword ;
2005-10-06 21:48:03 +04:00
int i ;
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
/* These values are hardcoded in all QueryServiceConfig() replies.
I ' m just storing them here for cosmetic purposes */
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
dword = SVCCTL_AUTO_START ;
2010-05-25 00:19:17 +04:00
regval_ctr_addvalue ( values , " Start " , REG_DWORD , ( uint8 * ) & dword , sizeof ( uint32 ) ) ;
2007-11-21 04:57:47 +03:00
2009-01-08 15:05:29 +03:00
dword = SERVICE_TYPE_WIN32_OWN_PROCESS ;
2010-05-25 00:19:17 +04:00
regval_ctr_addvalue ( values , " Type " , REG_DWORD , ( uint8 * ) & dword , sizeof ( uint32 ) ) ;
2005-06-15 04:54:43 +04:00
2005-09-30 21:13:37 +04:00
dword = SVCCTL_SVC_ERROR_NORMAL ;
2010-05-25 00:19:17 +04:00
regval_ctr_addvalue ( values , " ErrorControl " , REG_DWORD , ( uint8 * ) & dword , sizeof ( uint32 ) ) ;
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
/* everything runs as LocalSystem */
2007-11-21 04:57:47 +03:00
2009-09-24 17:01:32 +04:00
regval_ctr_addvalue_sz ( values , " ObjectName " , " LocalSystem " ) ;
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
/* special considerations for internal services and the DisplayName value */
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
for ( i = 0 ; builtin_svcs [ i ] . servicename ; i + + ) {
if ( strequal ( name , builtin_svcs [ i ] . servicename ) ) {
2009-09-24 17:01:32 +04:00
ipath = talloc_asprintf ( talloc_tos ( ) , " %s/%s/%s " ,
2008-08-15 02:50:56 +04:00
get_dyn_MODULESDIR ( ) , SVCCTL_SCRIPT_DIR ,
2009-09-24 17:01:32 +04:00
builtin_svcs [ i ] . daemon ) ;
description = talloc_strdup ( talloc_tos ( ) , builtin_svcs [ i ] . description ) ;
dname = talloc_strdup ( talloc_tos ( ) , builtin_svcs [ i ] . dispname ) ;
2005-10-06 21:48:03 +04:00
break ;
}
2007-11-21 04:57:47 +03:00
}
2005-10-06 21:48:03 +04:00
/* default to an external service if we haven't found a match */
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
if ( builtin_svcs [ i ] . servicename = = NULL ) {
2007-12-18 05:00:43 +03:00
char * dispname = NULL ;
2005-10-06 21:48:03 +04:00
struct rcinit_file_information * init_info = NULL ;
2009-09-24 17:01:32 +04:00
ipath = talloc_asprintf ( talloc_tos ( ) , " %s/%s/%s " ,
get_dyn_MODULESDIR ( ) , SVCCTL_SCRIPT_DIR ,
name ) ;
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
/* lookup common unix display names */
2007-12-18 05:00:43 +03:00
dispname = get_common_service_dispname ( name ) ;
2009-09-24 17:01:32 +04:00
dname = talloc_strdup ( talloc_tos ( ) , dispname ? dispname : " " ) ;
2007-12-18 05:00:43 +03:00
SAFE_FREE ( dispname ) ;
2005-10-06 21:48:03 +04:00
2007-11-21 04:57:47 +03:00
/* get info from init file itself */
2005-10-06 21:48:03 +04:00
if ( read_init_file ( name , & init_info ) ) {
2009-09-24 17:01:32 +04:00
description = talloc_strdup ( talloc_tos ( ) , init_info - > description ) ;
2005-10-06 21:48:03 +04:00
TALLOC_FREE ( init_info ) ;
}
else {
2009-09-24 17:01:32 +04:00
description = talloc_strdup ( talloc_tos ( ) , " External Unix Service " ) ;
2005-10-06 21:48:03 +04:00
}
2005-09-30 21:13:37 +04:00
}
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
/* add the new values */
2007-11-21 04:57:47 +03:00
2009-09-24 17:01:32 +04:00
regval_ctr_addvalue_sz ( values , " DisplayName " , dname ) ;
regval_ctr_addvalue_sz ( values , " ImagePath " , ipath ) ;
regval_ctr_addvalue_sz ( values , " Description " , description ) ;
TALLOC_FREE ( dname ) ;
TALLOC_FREE ( ipath ) ;
TALLOC_FREE ( description ) ;
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
return ;
2005-06-15 04:54:43 +04:00
}
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2009-03-24 01:02:57 +03:00
static void add_new_svc_name ( struct registry_key_handle * key_parent ,
struct regsubkey_ctr * subkeys ,
const char * name )
2005-06-15 04:54:43 +04:00
{
2009-03-24 01:02:57 +03:00
struct registry_key_handle * key_service = NULL , * key_secdesc = NULL ;
2005-09-30 21:13:37 +04:00
WERROR wresult ;
2007-11-21 04:57:47 +03:00
char * path = NULL ;
2009-03-23 20:14:17 +03:00
struct regval_ctr * values = NULL ;
2009-02-24 17:19:18 +03:00
struct regsubkey_ctr * svc_subkeys = NULL ;
2010-05-18 12:29:34 +04:00
struct security_descriptor * sd = NULL ;
2007-10-07 16:56:43 +04:00
DATA_BLOB sd_blob ;
NTSTATUS status ;
2005-09-30 21:13:37 +04:00
/* add to the list and create the subkey path */
regsubkey_ctr_addkey ( subkeys , name ) ;
store_reg_keys ( key_parent , subkeys ) ;
/* open the new service key */
2007-11-21 04:57:47 +03:00
if ( asprintf ( & path , " %s \\ %s " , KEY_SERVICES , name ) < 0 ) {
return ;
}
2006-12-01 23:01:09 +03:00
wresult = regkey_open_internal ( NULL , & key_service , path ,
2006-11-29 13:51:00 +03:00
get_root_nt_token ( ) , REG_KEY_ALL ) ;
2005-09-30 21:13:37 +04:00
if ( ! W_ERROR_IS_OK ( wresult ) ) {
2007-11-21 04:57:47 +03:00
DEBUG ( 0 , ( " add_new_svc_name: key lookup failed! [%s] (%s) \n " ,
2008-11-01 19:19:26 +03:00
path , win_errstr ( wresult ) ) ) ;
2007-11-21 04:57:47 +03:00
SAFE_FREE ( path ) ;
2005-09-30 21:13:37 +04:00
return ;
2005-06-15 04:54:43 +04:00
}
2007-11-21 04:57:47 +03:00
SAFE_FREE ( path ) ;
2005-09-30 21:13:37 +04:00
/* add the 'Security' key */
2009-02-25 01:23:04 +03:00
wresult = regsubkey_ctr_init ( key_service , & svc_subkeys ) ;
if ( ! W_ERROR_IS_OK ( wresult ) ) {
2005-09-30 21:13:37 +04:00
DEBUG ( 0 , ( " add_new_svc_name: talloc() failed! \n " ) ) ;
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key_service ) ;
2005-09-30 21:13:37 +04:00
return ;
2005-06-15 04:54:43 +04:00
}
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
fetch_reg_keys ( key_service , svc_subkeys ) ;
regsubkey_ctr_addkey ( svc_subkeys , " Security " ) ;
store_reg_keys ( key_service , svc_subkeys ) ;
2005-06-15 04:54:43 +04:00
2005-09-30 21:13:37 +04:00
/* now for the service values */
2007-11-21 04:57:47 +03:00
2009-03-23 20:14:17 +03:00
if ( ! ( values = TALLOC_ZERO_P ( key_service , struct regval_ctr ) ) ) {
2005-09-30 21:13:37 +04:00
DEBUG ( 0 , ( " add_new_svc_name: talloc() failed! \n " ) ) ;
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key_service ) ;
2005-09-30 21:13:37 +04:00
return ;
}
2005-06-15 04:54:43 +04:00
2005-09-30 21:13:37 +04:00
fill_service_values ( name , values ) ;
store_reg_values ( key_service , values ) ;
2005-06-15 04:54:43 +04:00
2005-09-30 21:13:37 +04:00
/* cleanup the service key*/
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key_service ) ;
2005-09-30 21:13:37 +04:00
/* now add the security descriptor */
2005-06-15 04:54:43 +04:00
2007-11-21 04:57:47 +03:00
if ( asprintf ( & path , " %s \\ %s \\ %s " , KEY_SERVICES , name , " Security " ) < 0 ) {
return ;
}
2006-12-01 23:01:09 +03:00
wresult = regkey_open_internal ( NULL , & key_secdesc , path ,
2006-11-29 13:51:00 +03:00
get_root_nt_token ( ) , REG_KEY_ALL ) ;
2005-09-30 21:13:37 +04:00
if ( ! W_ERROR_IS_OK ( wresult ) ) {
2007-11-21 04:57:47 +03:00
DEBUG ( 0 , ( " add_new_svc_name: key lookup failed! [%s] (%s) \n " ,
2008-11-01 19:19:26 +03:00
path , win_errstr ( wresult ) ) ) ;
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key_secdesc ) ;
2007-11-21 04:57:47 +03:00
SAFE_FREE ( path ) ;
2005-09-30 21:13:37 +04:00
return ;
2005-06-15 04:54:43 +04:00
}
2007-11-21 04:57:47 +03:00
SAFE_FREE ( path ) ;
2005-06-15 04:54:43 +04:00
2009-03-23 20:14:17 +03:00
if ( ! ( values = TALLOC_ZERO_P ( key_secdesc , struct regval_ctr ) ) ) {
2005-09-30 21:13:37 +04:00
DEBUG ( 0 , ( " add_new_svc_name: talloc() failed! \n " ) ) ;
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key_secdesc ) ;
2005-09-30 21:13:37 +04:00
return ;
}
2005-06-15 04:54:43 +04:00
2005-09-30 21:13:37 +04:00
if ( ! ( sd = construct_service_sd ( key_secdesc ) ) ) {
DEBUG ( 0 , ( " add_new_svc_name: Failed to create default sec_desc! \n " ) ) ;
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key_secdesc ) ;
2005-09-30 21:13:37 +04:00
return ;
}
2007-10-07 16:56:43 +04:00
status = marshall_sec_desc ( key_secdesc , sd , & sd_blob . data ,
& sd_blob . length ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
DEBUG ( 0 , ( " marshall_sec_desc failed: %s \n " ,
nt_errstr ( status ) ) ) ;
TALLOC_FREE ( key_secdesc ) ;
return ;
2005-09-30 21:13:37 +04:00
}
2007-11-21 04:57:47 +03:00
2007-10-07 16:56:43 +04:00
regval_ctr_addvalue ( values , " Security " , REG_BINARY ,
2010-05-25 00:19:17 +04:00
sd_blob . data , sd_blob . length ) ;
2007-10-07 16:56:43 +04:00
store_reg_values ( key_secdesc , values ) ;
2007-11-21 04:57:47 +03:00
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key_secdesc ) ;
2005-06-15 04:54:43 +04:00
2005-09-30 21:13:37 +04:00
return ;
2005-06-15 04:54:43 +04:00
}
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-09-30 21:13:37 +04:00
void svcctl_init_keys ( void )
2005-06-15 04:54:43 +04:00
{
2005-09-30 21:13:37 +04:00
const char * * service_list = lp_svcctl_list ( ) ;
int i ;
2009-02-24 17:19:18 +03:00
struct regsubkey_ctr * subkeys = NULL ;
2009-03-24 01:02:57 +03:00
struct registry_key_handle * key = NULL ;
2005-09-30 21:13:37 +04:00
WERROR wresult ;
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
/* bad mojo here if the lookup failed. Should not happen */
2007-11-21 04:57:47 +03:00
2006-12-01 23:01:09 +03:00
wresult = regkey_open_internal ( NULL , & key , KEY_SERVICES ,
2008-06-18 18:30:37 +04:00
get_root_nt_token ( ) , REG_KEY_ALL ) ;
2005-06-15 04:54:43 +04:00
2005-09-30 21:13:37 +04:00
if ( ! W_ERROR_IS_OK ( wresult ) ) {
2007-11-21 04:57:47 +03:00
DEBUG ( 0 , ( " svcctl_init_keys: key lookup failed! (%s) \n " ,
2008-11-01 19:19:26 +03:00
win_errstr ( wresult ) ) ) ;
2005-09-30 21:13:37 +04:00
return ;
}
2007-11-21 04:57:47 +03:00
/* lookup the available subkeys */
2009-02-25 01:23:04 +03:00
wresult = regsubkey_ctr_init ( key , & subkeys ) ;
if ( ! W_ERROR_IS_OK ( wresult ) ) {
2007-08-09 23:03:23 +04:00
DEBUG ( 0 , ( " svcctl_init_keys: talloc() failed! \n " ) ) ;
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key ) ;
2005-09-30 21:13:37 +04:00
return ;
}
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
fetch_reg_keys ( key , subkeys ) ;
2007-11-21 04:57:47 +03:00
2008-02-18 18:58:24 +03:00
/* the builtin services exist */
2007-11-21 04:57:47 +03:00
2005-10-06 21:48:03 +04:00
for ( i = 0 ; builtin_svcs [ i ] . servicename ; i + + )
add_new_svc_name ( key , subkeys , builtin_svcs [ i ] . servicename ) ;
2007-11-21 04:57:47 +03:00
2006-02-08 18:09:09 +03:00
for ( i = 0 ; service_list & & service_list [ i ] ; i + + ) {
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
/* only add new services */
if ( regsubkey_ctr_key_exists ( subkeys , service_list [ i ] ) )
continue ;
2005-06-15 04:54:43 +04:00
2005-09-30 21:13:37 +04:00
/* Add the new service key and initialize the appropriate values */
2005-06-15 04:54:43 +04:00
2005-09-30 21:13:37 +04:00
add_new_svc_name ( key , subkeys , service_list [ i ] ) ;
2005-06-15 04:54:43 +04:00
}
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key ) ;
2005-06-15 04:54:43 +04:00
2005-09-30 21:13:37 +04:00
/* initialize the control hooks */
2005-06-15 04:54:43 +04:00
2005-09-30 21:13:37 +04:00
init_service_op_table ( ) ;
2005-06-15 04:54:43 +04:00
2005-09-30 21:13:37 +04:00
return ;
2005-06-15 04:54:43 +04:00
}
/********************************************************************
2005-09-30 21:13:37 +04:00
This is where we do the dirty work of filling in things like the
2007-11-21 04:57:47 +03:00
Display name , Description , etc . . . Always return a default secdesc
2005-09-30 21:13:37 +04:00
in case of any failure .
2005-06-15 04:54:43 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-05-18 12:29:34 +04:00
struct security_descriptor * svcctl_get_secdesc ( TALLOC_CTX * ctx , const char * name , NT_USER_TOKEN * token )
2005-06-15 04:54:43 +04:00
{
2009-03-24 01:02:57 +03:00
struct registry_key_handle * key = NULL ;
2009-03-23 20:14:17 +03:00
struct regval_ctr * values = NULL ;
2009-03-24 00:27:59 +03:00
struct regval_blob * val = NULL ;
2010-05-18 12:29:34 +04:00
struct security_descriptor * ret_sd = NULL ;
2007-11-21 04:57:47 +03:00
char * path = NULL ;
2005-09-30 21:13:37 +04:00
WERROR wresult ;
2007-10-07 16:56:43 +04:00
NTSTATUS status ;
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
/* now add the security descriptor */
2007-11-21 04:57:47 +03:00
if ( asprintf ( & path , " %s \\ %s \\ %s " , KEY_SERVICES , name , " Security " ) < 0 ) {
return NULL ;
}
2006-12-01 23:01:09 +03:00
wresult = regkey_open_internal ( NULL , & key , path , token ,
2006-11-29 13:51:00 +03:00
REG_KEY_ALL ) ;
2005-09-30 21:13:37 +04:00
if ( ! W_ERROR_IS_OK ( wresult ) ) {
2007-11-21 04:57:47 +03:00
DEBUG ( 0 , ( " svcctl_get_secdesc: key lookup failed! [%s] (%s) \n " ,
2008-11-01 19:19:26 +03:00
path , win_errstr ( wresult ) ) ) ;
2008-02-18 19:38:19 +03:00
goto done ;
2005-09-30 21:13:37 +04:00
}
2005-06-15 04:54:43 +04:00
2009-03-23 20:14:17 +03:00
if ( ! ( values = TALLOC_ZERO_P ( key , struct regval_ctr ) ) ) {
2008-01-21 17:14:16 +03:00
DEBUG ( 0 , ( " svcctl_get_secdesc: talloc() failed! \n " ) ) ;
2008-02-18 19:38:19 +03:00
goto done ;
2005-09-30 21:13:37 +04:00
}
2005-06-15 04:54:43 +04:00
2008-02-18 19:23:41 +03:00
if ( fetch_reg_values ( key , values ) = = - 1 ) {
DEBUG ( 0 , ( " Error getting registry values \n " ) ) ;
2008-02-18 19:38:19 +03:00
goto done ;
2008-02-18 19:23:41 +03:00
}
2007-10-07 16:56:43 +04:00
2005-09-30 21:13:37 +04:00
if ( ! ( val = regval_ctr_getvalue ( values , " Security " ) ) ) {
2008-02-18 19:38:19 +03:00
goto fallback_to_default_sd ;
2005-09-30 21:13:37 +04:00
}
2005-06-15 04:54:43 +04:00
2007-10-07 16:56:43 +04:00
/* stream the service security descriptor */
status = unmarshall_sec_desc ( ctx , regval_data_p ( val ) ,
regval_size ( val ) , & ret_sd ) ;
2008-02-18 19:38:19 +03:00
if ( NT_STATUS_IS_OK ( status ) ) {
goto done ;
2005-09-30 21:13:37 +04:00
}
2005-06-15 04:54:43 +04:00
2008-02-18 19:38:19 +03:00
fallback_to_default_sd :
DEBUG ( 6 , ( " svcctl_get_secdesc: constructing default secdesc for "
" service [%s] \n " , name ) ) ;
ret_sd = construct_service_sd ( ctx ) ;
done :
SAFE_FREE ( path ) ;
TALLOC_FREE ( key ) ;
2005-09-30 21:13:37 +04:00
return ret_sd ;
}
2005-06-15 04:54:43 +04:00
2006-01-13 23:24:50 +03:00
/********************************************************************
Wrapper to make storing a Service sd easier
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-05-18 12:29:34 +04:00
bool svcctl_set_secdesc ( TALLOC_CTX * ctx , const char * name , struct security_descriptor * sec_desc , NT_USER_TOKEN * token )
2006-01-13 23:24:50 +03:00
{
2009-03-24 01:02:57 +03:00
struct registry_key_handle * key = NULL ;
2006-01-13 23:24:50 +03:00
WERROR wresult ;
2007-11-21 04:57:47 +03:00
char * path = NULL ;
2009-03-23 20:14:17 +03:00
struct regval_ctr * values = NULL ;
2009-02-05 04:54:05 +03:00
DATA_BLOB blob ;
NTSTATUS status ;
2007-10-19 04:40:25 +04:00
bool ret = False ;
2007-11-21 04:57:47 +03:00
2006-01-13 23:24:50 +03:00
/* now add the security descriptor */
2007-11-21 04:57:47 +03:00
if ( asprintf ( & path , " %s \\ %s \\ %s " , KEY_SERVICES , name , " Security " ) < 0 ) {
return false ;
}
2006-12-01 23:01:09 +03:00
wresult = regkey_open_internal ( NULL , & key , path , token ,
2006-11-29 13:51:00 +03:00
REG_KEY_ALL ) ;
2006-01-13 23:24:50 +03:00
if ( ! W_ERROR_IS_OK ( wresult ) ) {
2007-11-21 04:57:47 +03:00
DEBUG ( 0 , ( " svcctl_get_secdesc: key lookup failed! [%s] (%s) \n " ,
2008-11-01 19:19:26 +03:00
path , win_errstr ( wresult ) ) ) ;
2007-11-21 04:57:47 +03:00
SAFE_FREE ( path ) ;
2006-01-13 23:24:50 +03:00
return False ;
}
2007-11-21 04:57:47 +03:00
SAFE_FREE ( path ) ;
2006-01-13 23:24:50 +03:00
2009-03-23 20:14:17 +03:00
if ( ! ( values = TALLOC_ZERO_P ( key , struct regval_ctr ) ) ) {
2008-01-21 17:14:16 +03:00
DEBUG ( 0 , ( " svcctl_set_secdesc: talloc() failed! \n " ) ) ;
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key ) ;
2006-01-13 23:24:50 +03:00
return False ;
}
2007-11-21 04:57:47 +03:00
2006-01-13 23:24:50 +03:00
/* stream the printer security descriptor */
2008-03-15 01:26:28 +03:00
2009-02-05 04:54:05 +03:00
status = marshall_sec_desc ( ctx , sec_desc , & blob . data , & blob . length ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
DEBUG ( 0 , ( " svcctl_set_secdesc: ndr_push_struct_blob() failed! \n " ) ) ;
2008-03-15 01:26:28 +03:00
TALLOC_FREE ( key ) ;
return False ;
}
2007-11-21 04:57:47 +03:00
2010-05-25 00:19:17 +04:00
regval_ctr_addvalue ( values , " Security " , REG_BINARY , blob . data , blob . length ) ;
2009-02-05 04:54:05 +03:00
ret = store_reg_values ( key , values ) ;
2007-11-21 04:57:47 +03:00
2006-01-13 23:24:50 +03:00
/* cleanup */
2007-11-21 04:57:47 +03:00
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key ) ;
2006-01-13 23:24:50 +03:00
return ret ;
}
2005-09-30 21:13:37 +04:00
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-06-15 04:54:43 +04:00
2007-12-18 05:00:43 +03:00
const char * svcctl_lookup_dispname ( TALLOC_CTX * ctx , const char * name , NT_USER_TOKEN * token )
2005-09-30 21:13:37 +04:00
{
2009-09-30 22:00:52 +04:00
const char * display_name = NULL ;
2009-03-24 01:02:57 +03:00
struct registry_key_handle * key = NULL ;
2009-03-23 20:14:17 +03:00
struct regval_ctr * values = NULL ;
2009-03-24 00:27:59 +03:00
struct regval_blob * val = NULL ;
2007-11-21 04:57:47 +03:00
char * path = NULL ;
2005-09-30 21:13:37 +04:00
WERROR wresult ;
2009-09-30 22:00:52 +04:00
DATA_BLOB blob ;
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
/* now add the security descriptor */
2007-11-21 04:57:47 +03:00
if ( asprintf ( & path , " %s \\ %s " , KEY_SERVICES , name ) < 0 ) {
return NULL ;
}
2006-12-01 23:01:09 +03:00
wresult = regkey_open_internal ( NULL , & key , path , token ,
2006-11-29 13:51:00 +03:00
REG_KEY_READ ) ;
2005-09-30 21:13:37 +04:00
if ( ! W_ERROR_IS_OK ( wresult ) ) {
DEBUG ( 0 , ( " svcctl_lookup_dispname: key lookup failed! [%s] (%s) \n " ,
2008-11-01 19:19:26 +03:00
path , win_errstr ( wresult ) ) ) ;
2007-11-21 04:57:47 +03:00
SAFE_FREE ( path ) ;
2005-10-06 21:48:03 +04:00
goto fail ;
2005-09-30 21:13:37 +04:00
}
2007-11-21 04:57:47 +03:00
SAFE_FREE ( path ) ;
2005-06-15 04:54:43 +04:00
2009-03-23 20:14:17 +03:00
if ( ! ( values = TALLOC_ZERO_P ( key , struct regval_ctr ) ) ) {
2005-09-30 21:13:37 +04:00
DEBUG ( 0 , ( " svcctl_lookup_dispname: talloc() failed! \n " ) ) ;
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key ) ;
2005-10-06 21:48:03 +04:00
goto fail ;
2005-09-30 21:13:37 +04:00
}
2005-06-15 04:54:43 +04:00
2005-09-30 21:13:37 +04:00
fetch_reg_values ( key , values ) ;
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
if ( ! ( val = regval_ctr_getvalue ( values , " DisplayName " ) ) )
2005-10-06 21:48:03 +04:00
goto fail ;
2009-09-30 22:00:52 +04:00
blob = data_blob_const ( regval_data_p ( val ) , regval_size ( val ) ) ;
2010-05-10 02:42:06 +04:00
pull_reg_sz ( ctx , & blob , & display_name ) ;
2005-06-15 04:54:43 +04:00
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key ) ;
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
return display_name ;
2005-10-06 21:48:03 +04:00
fail :
/* default to returning the service name */
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key ) ;
2007-12-18 05:00:43 +03:00
return talloc_strdup ( ctx , name ) ;
2005-06-15 04:54:43 +04:00
}
2005-09-30 21:13:37 +04:00
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-06-15 04:54:43 +04:00
2007-12-18 05:00:43 +03:00
const char * svcctl_lookup_description ( TALLOC_CTX * ctx , const char * name , NT_USER_TOKEN * token )
2005-06-15 04:54:43 +04:00
{
2009-09-30 22:00:52 +04:00
const char * description = NULL ;
2009-03-24 01:02:57 +03:00
struct registry_key_handle * key = NULL ;
2009-03-23 20:14:17 +03:00
struct regval_ctr * values = NULL ;
2009-03-24 00:27:59 +03:00
struct regval_blob * val = NULL ;
2007-11-21 04:57:47 +03:00
char * path = NULL ;
2005-09-30 21:13:37 +04:00
WERROR wresult ;
2009-09-30 22:00:52 +04:00
DATA_BLOB blob ;
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
/* now add the security descriptor */
2007-11-21 04:57:47 +03:00
if ( asprintf ( & path , " %s \\ %s " , KEY_SERVICES , name ) < 0 ) {
return NULL ;
}
2006-12-01 23:01:09 +03:00
wresult = regkey_open_internal ( NULL , & key , path , token ,
2006-11-29 13:51:00 +03:00
REG_KEY_READ ) ;
2005-09-30 21:13:37 +04:00
if ( ! W_ERROR_IS_OK ( wresult ) ) {
2007-12-18 05:00:43 +03:00
DEBUG ( 0 , ( " svcctl_lookup_description: key lookup failed! [%s] (%s) \n " ,
2008-11-01 19:19:26 +03:00
path , win_errstr ( wresult ) ) ) ;
2007-11-21 04:57:47 +03:00
SAFE_FREE ( path ) ;
2005-09-30 21:13:37 +04:00
return NULL ;
2005-06-15 04:54:43 +04:00
}
2007-11-21 04:57:47 +03:00
SAFE_FREE ( path ) ;
2005-06-15 04:54:43 +04:00
2009-03-23 20:14:17 +03:00
if ( ! ( values = TALLOC_ZERO_P ( key , struct regval_ctr ) ) ) {
2007-12-18 05:00:43 +03:00
DEBUG ( 0 , ( " svcctl_lookup_description: talloc() failed! \n " ) ) ;
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key ) ;
2005-09-30 21:13:37 +04:00
return NULL ;
2005-06-15 04:54:43 +04:00
}
2005-09-30 21:13:37 +04:00
fetch_reg_values ( key , values ) ;
2007-11-21 04:57:47 +03:00
2007-12-18 05:00:43 +03:00
if ( ! ( val = regval_ctr_getvalue ( values , " Description " ) ) ) {
TALLOC_FREE ( key ) ;
return " Unix Service " ;
}
2009-09-30 22:00:52 +04:00
blob = data_blob_const ( regval_data_p ( val ) , regval_size ( val ) ) ;
2010-05-10 02:42:06 +04:00
pull_reg_sz ( ctx , & blob , & description ) ;
2009-09-30 22:00:52 +04:00
2007-12-18 05:00:43 +03:00
TALLOC_FREE ( key ) ;
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
return description ;
}
2005-06-15 04:54:43 +04:00
2005-09-30 21:13:37 +04:00
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2009-03-23 20:14:17 +03:00
struct regval_ctr * svcctl_fetch_regvalues ( const char * name , NT_USER_TOKEN * token )
2005-09-30 21:13:37 +04:00
{
2009-03-24 01:02:57 +03:00
struct registry_key_handle * key = NULL ;
2009-03-23 20:14:17 +03:00
struct regval_ctr * values = NULL ;
2007-11-21 04:57:47 +03:00
char * path = NULL ;
2005-09-30 21:13:37 +04:00
WERROR wresult ;
2007-11-21 04:57:47 +03:00
2005-09-30 21:13:37 +04:00
/* now add the security descriptor */
2007-11-21 04:57:47 +03:00
if ( asprintf ( & path , " %s \\ %s " , KEY_SERVICES , name ) < 0 ) {
return NULL ;
}
2006-12-01 23:01:09 +03:00
wresult = regkey_open_internal ( NULL , & key , path , token ,
2006-11-29 13:51:00 +03:00
REG_KEY_READ ) ;
2005-09-30 21:13:37 +04:00
if ( ! W_ERROR_IS_OK ( wresult ) ) {
2007-11-21 04:57:47 +03:00
DEBUG ( 0 , ( " svcctl_fetch_regvalues: key lookup failed! [%s] (%s) \n " ,
2008-11-01 19:19:26 +03:00
path , win_errstr ( wresult ) ) ) ;
2007-11-21 04:57:47 +03:00
SAFE_FREE ( path ) ;
2005-09-30 21:13:37 +04:00
return NULL ;
2005-06-15 04:54:43 +04:00
}
2007-11-21 04:57:47 +03:00
SAFE_FREE ( path ) ;
2005-09-30 21:13:37 +04:00
2009-03-23 20:14:17 +03:00
if ( ! ( values = TALLOC_ZERO_P ( NULL , struct regval_ctr ) ) ) {
2005-09-30 21:13:37 +04:00
DEBUG ( 0 , ( " svcctl_fetch_regvalues: talloc() failed! \n " ) ) ;
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key ) ;
2005-09-30 21:13:37 +04:00
return NULL ;
2005-06-15 04:54:43 +04:00
}
2005-09-30 21:13:37 +04:00
fetch_reg_values ( key , values ) ;
2005-06-15 04:54:43 +04:00
2006-11-29 13:51:00 +03:00
TALLOC_FREE ( key ) ;
2005-09-30 21:13:37 +04:00
return values ;
2005-06-15 04:54:43 +04:00
}