2005-05-23 20:25:31 +04:00
/*
Samba Unix / Linux SMB client library
Distributed SMB / CIFS Server Management Utility
2006-09-28 01:37:43 +04:00
Copyright ( C ) Gerald ( Jerry ) Carter 2005 - 2006
2005-05-23 20:25:31 +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-05-23 20:25:31 +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 04:52:41 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>. */
2005-05-23 20:25:31 +04:00
# include "includes.h"
# include "utils/net.h"
2008-04-04 15:26:03 +04:00
# include "utils/net_registry_util.h"
2005-05-23 20:25:31 +04:00
# include "regfio.h"
# include "reg_objects.h"
2007-10-19 04:40:25 +04:00
static bool reg_hive_key ( const char * fullname , uint32 * reg_type ,
2006-11-21 13:32:08 +03:00
const char * * key_name )
{
const char * sep ;
ptrdiff_t len ;
sep = strchr_m ( fullname , ' \\ ' ) ;
if ( sep ! = NULL ) {
len = sep - fullname ;
* key_name = sep + 1 ;
}
else {
len = strlen ( fullname ) ;
* key_name = " " ;
}
if ( strnequal ( fullname , " HKLM " , len ) | |
strnequal ( fullname , " HKEY_LOCAL_MACHINE " , len ) )
( * reg_type ) = HKEY_LOCAL_MACHINE ;
else if ( strnequal ( fullname , " HKCR " , len ) | |
strnequal ( fullname , " HKEY_CLASSES_ROOT " , len ) )
( * reg_type ) = HKEY_CLASSES_ROOT ;
else if ( strnequal ( fullname , " HKU " , len ) | |
strnequal ( fullname , " HKEY_USERS " , len ) )
( * reg_type ) = HKEY_USERS ;
2007-09-25 08:54:20 +04:00
else if ( strnequal ( fullname , " HKCU " , len ) | |
strnequal ( fullname , " HKEY_CURRENT_USER " , len ) )
( * reg_type ) = HKEY_CURRENT_USER ;
2006-11-21 13:32:08 +03:00
else if ( strnequal ( fullname , " HKPD " , len ) | |
strnequal ( fullname , " HKEY_PERFORMANCE_DATA " , len ) )
( * reg_type ) = HKEY_PERFORMANCE_DATA ;
else {
DEBUG ( 10 , ( " reg_hive_key: unrecognised hive key %s \n " ,
fullname ) ) ;
return False ;
}
return True ;
}
static NTSTATUS registry_openkey ( TALLOC_CTX * mem_ctx ,
struct rpc_pipe_client * pipe_hnd ,
const char * name , uint32 access_mask ,
struct policy_handle * hive_hnd ,
struct policy_handle * key_hnd )
{
uint32 hive ;
NTSTATUS status ;
struct winreg_String key ;
2007-07-26 20:39:48 +04:00
ZERO_STRUCT ( key ) ;
2006-11-21 13:32:08 +03:00
if ( ! reg_hive_key ( name , & hive , & key . name ) ) {
return NT_STATUS_INVALID_PARAMETER ;
}
status = rpccli_winreg_Connect ( pipe_hnd , mem_ctx , hive , access_mask ,
hive_hnd ) ;
if ( ! ( NT_STATUS_IS_OK ( status ) ) ) {
return status ;
}
status = rpccli_winreg_OpenKey ( pipe_hnd , mem_ctx , hive_hnd , key , 0 ,
2007-12-03 20:21:40 +03:00
access_mask , key_hnd , NULL ) ;
2006-11-21 13:32:08 +03:00
if ( ! ( NT_STATUS_IS_OK ( status ) ) ) {
2007-12-03 20:21:40 +03:00
rpccli_winreg_CloseKey ( pipe_hnd , mem_ctx , hive_hnd , NULL ) ;
2006-11-21 13:32:08 +03:00
return status ;
}
return NT_STATUS_OK ;
}
2006-11-21 02:20:07 +03:00
static NTSTATUS registry_enumkeys ( TALLOC_CTX * ctx ,
struct rpc_pipe_client * pipe_hnd ,
struct policy_handle * key_hnd ,
uint32 * pnum_keys , char * * * pnames ,
char * * * pclasses , NTTIME * * * pmodtimes )
{
TALLOC_CTX * mem_ctx ;
NTSTATUS status ;
uint32 num_subkeys , max_subkeylen , max_classlen ;
uint32 num_values , max_valnamelen , max_valbufsize ;
uint32 i ;
NTTIME last_changed_time ;
uint32 secdescsize ;
struct winreg_String classname ;
char * * names , * * classes ;
NTTIME * * modtimes ;
if ( ! ( mem_ctx = talloc_new ( ctx ) ) ) {
return NT_STATUS_NO_MEMORY ;
}
ZERO_STRUCT ( classname ) ;
status = rpccli_winreg_QueryInfoKey (
pipe_hnd , mem_ctx , key_hnd , & classname , & num_subkeys ,
& max_subkeylen , & max_classlen , & num_values , & max_valnamelen ,
2007-12-03 20:21:40 +03:00
& max_valbufsize , & secdescsize , & last_changed_time , NULL ) ;
2006-11-21 02:20:07 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
goto error ;
}
if ( num_subkeys = = 0 ) {
* pnum_keys = 0 ;
TALLOC_FREE ( mem_ctx ) ;
return NT_STATUS_OK ;
}
if ( ( ! ( names = TALLOC_ZERO_ARRAY ( mem_ctx , char * , num_subkeys ) ) ) | |
( ! ( classes = TALLOC_ZERO_ARRAY ( mem_ctx , char * , num_subkeys ) ) ) | |
( ! ( modtimes = TALLOC_ZERO_ARRAY ( mem_ctx , NTTIME * ,
num_subkeys ) ) ) ) {
status = NT_STATUS_NO_MEMORY ;
goto error ;
}
for ( i = 0 ; i < num_subkeys ; i + + ) {
char c , n ;
struct winreg_StringBuf class_buf ;
struct winreg_StringBuf name_buf ;
NTTIME modtime ;
2007-12-03 20:21:40 +03:00
WERROR werr ;
2006-11-21 02:20:07 +03:00
c = ' \0 ' ;
class_buf . name = & c ;
class_buf . size = max_classlen + 2 ;
n = ' \0 ' ;
name_buf . name = & n ;
name_buf . size = max_subkeylen + 2 ;
ZERO_STRUCT ( modtime ) ;
status = rpccli_winreg_EnumKey ( pipe_hnd , mem_ctx , key_hnd ,
2007-01-16 18:42:03 +03:00
i , & name_buf , & class_buf ,
2007-12-03 20:21:40 +03:00
& modtime , & werr ) ;
2006-11-21 02:20:07 +03:00
2007-12-03 20:21:40 +03:00
if ( W_ERROR_EQUAL ( werr ,
2006-11-21 02:20:07 +03:00
WERR_NO_MORE_ITEMS ) ) {
status = NT_STATUS_OK ;
break ;
}
if ( ! NT_STATUS_IS_OK ( status ) ) {
goto error ;
}
classes [ i ] = NULL ;
2007-01-16 18:42:03 +03:00
if ( class_buf . name & &
( ! ( classes [ i ] = talloc_strdup ( classes , class_buf . name ) ) ) ) {
2006-11-21 02:20:07 +03:00
status = NT_STATUS_NO_MEMORY ;
goto error ;
}
if ( ! ( names [ i ] = talloc_strdup ( names , name_buf . name ) ) ) {
status = NT_STATUS_NO_MEMORY ;
goto error ;
}
2007-01-16 18:42:03 +03:00
if ( ( ! ( modtimes [ i ] = ( NTTIME * ) talloc_memdup (
modtimes , & modtime , sizeof ( modtime ) ) ) ) ) {
2006-11-21 02:20:07 +03:00
status = NT_STATUS_NO_MEMORY ;
goto error ;
}
}
* pnum_keys = num_subkeys ;
if ( pnames ) {
* pnames = talloc_move ( ctx , & names ) ;
}
if ( pclasses ) {
* pclasses = talloc_move ( ctx , & classes ) ;
}
if ( pmodtimes ) {
* pmodtimes = talloc_move ( ctx , & modtimes ) ;
}
status = NT_STATUS_OK ;
error :
TALLOC_FREE ( mem_ctx ) ;
return status ;
}
static NTSTATUS registry_enumvalues ( TALLOC_CTX * ctx ,
struct rpc_pipe_client * pipe_hnd ,
struct policy_handle * key_hnd ,
uint32 * pnum_values , char * * * pvalnames ,
struct registry_value * * * pvalues )
{
TALLOC_CTX * mem_ctx ;
NTSTATUS status ;
uint32 num_subkeys , max_subkeylen , max_classlen ;
uint32 num_values , max_valnamelen , max_valbufsize ;
uint32 i ;
NTTIME last_changed_time ;
uint32 secdescsize ;
struct winreg_String classname ;
struct registry_value * * values ;
char * * names ;
if ( ! ( mem_ctx = talloc_new ( ctx ) ) ) {
return NT_STATUS_NO_MEMORY ;
}
ZERO_STRUCT ( classname ) ;
status = rpccli_winreg_QueryInfoKey (
pipe_hnd , mem_ctx , key_hnd , & classname , & num_subkeys ,
& max_subkeylen , & max_classlen , & num_values , & max_valnamelen ,
2007-12-03 20:21:40 +03:00
& max_valbufsize , & secdescsize , & last_changed_time , NULL ) ;
2006-11-21 02:20:07 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
goto error ;
}
if ( num_values = = 0 ) {
* pnum_values = 0 ;
TALLOC_FREE ( mem_ctx ) ;
return NT_STATUS_OK ;
}
if ( ( ! ( names = TALLOC_ARRAY ( mem_ctx , char * , num_values ) ) ) | |
( ! ( values = TALLOC_ARRAY ( mem_ctx , struct registry_value * ,
num_values ) ) ) ) {
status = NT_STATUS_NO_MEMORY ;
goto error ;
}
for ( i = 0 ; i < num_values ; i + + ) {
enum winreg_Type type = REG_NONE ;
2007-01-16 18:42:03 +03:00
uint8 * data = NULL ;
2006-11-21 02:20:07 +03:00
uint32 data_size ;
uint32 value_length ;
char n ;
2006-11-27 10:52:46 +03:00
struct winreg_ValNameBuf name_buf ;
2006-12-01 23:01:09 +03:00
WERROR err ;
2006-11-21 02:20:07 +03:00
n = ' \0 ' ;
name_buf . name = & n ;
name_buf . size = max_valnamelen + 2 ;
data_size = max_valbufsize ;
2007-05-07 19:07:49 +04:00
data = ( uint8 * ) TALLOC ( mem_ctx , data_size ) ;
2006-11-21 02:20:07 +03:00
value_length = 0 ;
status = rpccli_winreg_EnumValue ( pipe_hnd , mem_ctx , key_hnd ,
2007-01-16 18:42:03 +03:00
i , & name_buf , & type ,
2007-02-20 16:43:41 +03:00
data , & data_size ,
2007-12-03 20:21:40 +03:00
& value_length , & err ) ;
2006-11-21 02:20:07 +03:00
2007-12-03 20:21:40 +03:00
if ( W_ERROR_EQUAL ( err ,
2006-11-21 02:20:07 +03:00
WERR_NO_MORE_ITEMS ) ) {
status = NT_STATUS_OK ;
break ;
}
if ( ! ( NT_STATUS_IS_OK ( status ) ) ) {
goto error ;
}
2007-01-16 18:42:03 +03:00
if ( name_buf . name = = NULL ) {
2006-11-21 02:20:07 +03:00
status = NT_STATUS_INVALID_PARAMETER ;
goto error ;
}
if ( ! ( names [ i ] = talloc_strdup ( names , name_buf . name ) ) ) {
status = NT_STATUS_NO_MEMORY ;
goto error ;
}
2007-01-16 18:42:03 +03:00
err = registry_pull_value ( values , & values [ i ] , type , data ,
data_size , value_length ) ;
2006-12-01 23:01:09 +03:00
if ( ! W_ERROR_IS_OK ( err ) ) {
status = werror_to_ntstatus ( err ) ;
2006-11-21 02:20:07 +03:00
goto error ;
}
}
* pnum_values = num_values ;
if ( pvalnames ) {
* pvalnames = talloc_move ( ctx , & names ) ;
}
if ( pvalues ) {
* pvalues = talloc_move ( ctx , & values ) ;
}
status = NT_STATUS_OK ;
error :
TALLOC_FREE ( mem_ctx ) ;
return status ;
}
2005-05-23 20:25:31 +04:00
2007-10-06 00:07:18 +04:00
static NTSTATUS registry_getsd ( TALLOC_CTX * mem_ctx ,
struct rpc_pipe_client * pipe_hnd ,
struct policy_handle * key_hnd ,
uint32_t sec_info ,
struct KeySecurityData * sd )
{
return rpccli_winreg_GetKeySecurity ( pipe_hnd , mem_ctx , key_hnd ,
2007-12-03 20:21:40 +03:00
sec_info , sd , NULL ) ;
2007-10-06 00:07:18 +04:00
}
2006-11-21 13:32:08 +03:00
static NTSTATUS registry_setvalue ( TALLOC_CTX * mem_ctx ,
struct rpc_pipe_client * pipe_hnd ,
struct policy_handle * key_hnd ,
const char * name ,
const struct registry_value * value )
{
struct winreg_String name_string ;
DATA_BLOB blob ;
NTSTATUS result ;
2006-12-01 23:01:09 +03:00
WERROR err ;
2006-11-21 13:32:08 +03:00
2006-12-01 23:01:09 +03:00
err = registry_push_value ( mem_ctx , value , & blob ) ;
if ( ! W_ERROR_IS_OK ( err ) ) {
return werror_to_ntstatus ( err ) ;
2006-11-21 13:32:08 +03:00
}
2007-07-26 20:39:48 +04:00
ZERO_STRUCT ( name_string ) ;
2006-11-21 13:32:08 +03:00
name_string . name = name ;
result = rpccli_winreg_SetValue ( pipe_hnd , blob . data , key_hnd ,
name_string , value - > type ,
2007-12-03 20:21:40 +03:00
blob . data , blob . length , NULL ) ;
2006-11-21 13:32:08 +03:00
TALLOC_FREE ( blob . data ) ;
return result ;
}
static NTSTATUS rpc_registry_setvalue_internal ( const DOM_SID * domain_sid ,
const char * domain_name ,
struct cli_state * cli ,
struct rpc_pipe_client * pipe_hnd ,
TALLOC_CTX * mem_ctx ,
int argc ,
const char * * argv )
{
struct policy_handle hive_hnd , key_hnd ;
NTSTATUS status ;
struct registry_value value ;
2007-08-23 19:33:25 +04:00
status = registry_openkey ( mem_ctx , pipe_hnd , argv [ 0 ] ,
SEC_RIGHTS_MAXIMUM_ALLOWED ,
2006-11-21 13:32:08 +03:00
& hive_hnd , & key_hnd ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
d_fprintf ( stderr , " registry_openkey failed: %s \n " ,
nt_errstr ( status ) ) ;
return status ;
}
if ( ! strequal ( argv [ 2 ] , " multi_sz " ) & & ( argc ! = 4 ) ) {
d_fprintf ( stderr , " Too many args for type %s \n " , argv [ 2 ] ) ;
return NT_STATUS_NOT_IMPLEMENTED ;
}
if ( strequal ( argv [ 2 ] , " dword " ) ) {
value . type = REG_DWORD ;
value . v . dword = strtoul ( argv [ 3 ] , NULL , 10 ) ;
}
else if ( strequal ( argv [ 2 ] , " sz " ) ) {
value . type = REG_SZ ;
value . v . sz . len = strlen ( argv [ 3 ] ) + 1 ;
value . v . sz . str = CONST_DISCARD ( char * , argv [ 3 ] ) ;
}
else {
2006-12-02 13:51:21 +03:00
d_fprintf ( stderr , " type \" %s \" not implemented \n " , argv [ 2 ] ) ;
2006-11-21 13:32:08 +03:00
status = NT_STATUS_NOT_IMPLEMENTED ;
goto error ;
}
status = registry_setvalue ( mem_ctx , pipe_hnd , & key_hnd ,
argv [ 1 ] , & value ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
d_fprintf ( stderr , " registry_setvalue failed: %s \n " ,
nt_errstr ( status ) ) ;
}
error :
2007-12-03 20:21:40 +03:00
rpccli_winreg_CloseKey ( pipe_hnd , mem_ctx , & key_hnd , NULL ) ;
rpccli_winreg_CloseKey ( pipe_hnd , mem_ctx , & hive_hnd , NULL ) ;
2006-11-21 13:32:08 +03:00
return NT_STATUS_OK ;
}
static int rpc_registry_setvalue ( int argc , const char * * argv )
{
2006-11-21 13:48:11 +03:00
if ( argc < 4 ) {
d_fprintf ( stderr , " usage: net rpc registry setvalue <key> "
" <valuename> <type> [<val>]+ \n " ) ;
return - 1 ;
}
2006-11-21 13:32:08 +03:00
return run_rpc_command ( NULL , PI_WINREG , 0 ,
rpc_registry_setvalue_internal , argc , argv ) ;
}
2006-11-21 18:33:55 +03:00
static NTSTATUS rpc_registry_deletevalue_internal ( const DOM_SID * domain_sid ,
const char * domain_name ,
struct cli_state * cli ,
struct rpc_pipe_client * pipe_hnd ,
TALLOC_CTX * mem_ctx ,
int argc ,
const char * * argv )
{
struct policy_handle hive_hnd , key_hnd ;
NTSTATUS status ;
struct winreg_String valuename ;
2007-07-26 20:39:48 +04:00
ZERO_STRUCT ( valuename ) ;
2007-08-23 19:33:25 +04:00
status = registry_openkey ( mem_ctx , pipe_hnd , argv [ 0 ] ,
SEC_RIGHTS_MAXIMUM_ALLOWED ,
2006-11-21 18:33:55 +03:00
& hive_hnd , & key_hnd ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
d_fprintf ( stderr , " registry_openkey failed: %s \n " ,
nt_errstr ( status ) ) ;
return status ;
}
valuename . name = argv [ 1 ] ;
status = rpccli_winreg_DeleteValue ( pipe_hnd , mem_ctx , & key_hnd ,
2007-12-03 20:21:40 +03:00
valuename , NULL ) ;
2006-11-21 18:33:55 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
d_fprintf ( stderr , " registry_deletevalue failed: %s \n " ,
nt_errstr ( status ) ) ;
}
2007-12-03 20:21:40 +03:00
rpccli_winreg_CloseKey ( pipe_hnd , mem_ctx , & key_hnd , NULL ) ;
rpccli_winreg_CloseKey ( pipe_hnd , mem_ctx , & hive_hnd , NULL ) ;
2006-11-21 18:33:55 +03:00
return NT_STATUS_OK ;
}
static int rpc_registry_deletevalue ( int argc , const char * * argv )
{
if ( argc ! = 2 ) {
d_fprintf ( stderr , " usage: net rpc registry deletevalue <key> "
" <valuename> \n " ) ;
return - 1 ;
}
return run_rpc_command ( NULL , PI_WINREG , 0 ,
rpc_registry_deletevalue_internal , argc , argv ) ;
}
static NTSTATUS rpc_registry_createkey_internal ( const DOM_SID * domain_sid ,
const char * domain_name ,
struct cli_state * cli ,
struct rpc_pipe_client * pipe_hnd ,
TALLOC_CTX * mem_ctx ,
int argc ,
const char * * argv )
{
uint32 hive ;
struct policy_handle hive_hnd , key_hnd ;
struct winreg_String key , keyclass ;
enum winreg_CreateAction action ;
NTSTATUS status ;
2007-07-26 20:39:48 +04:00
ZERO_STRUCT ( key ) ;
ZERO_STRUCT ( keyclass ) ;
2006-11-21 18:33:55 +03:00
if ( ! reg_hive_key ( argv [ 0 ] , & hive , & key . name ) ) {
return NT_STATUS_INVALID_PARAMETER ;
}
2006-11-21 23:10:39 +03:00
status = rpccli_winreg_Connect ( pipe_hnd , mem_ctx , hive ,
2007-08-23 19:33:25 +04:00
SEC_RIGHTS_MAXIMUM_ALLOWED ,
2006-11-21 18:33:55 +03:00
& hive_hnd ) ;
if ( ! ( NT_STATUS_IS_OK ( status ) ) ) {
return status ;
}
action = REG_ACTION_NONE ;
keyclass . name = " " ;
status = rpccli_winreg_CreateKey ( pipe_hnd , mem_ctx , & hive_hnd , key ,
keyclass , 0 , REG_KEY_READ , NULL ,
2007-12-03 20:21:40 +03:00
& key_hnd , & action , NULL ) ;
2006-11-21 18:33:55 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
d_fprintf ( stderr , " createkey returned %s \n " ,
nt_errstr ( status ) ) ;
2007-12-03 20:21:40 +03:00
rpccli_winreg_CloseKey ( pipe_hnd , mem_ctx , & hive_hnd , NULL ) ;
2006-11-21 18:33:55 +03:00
return status ;
}
2007-01-16 18:42:03 +03:00
switch ( action ) {
2006-11-21 18:33:55 +03:00
case REG_ACTION_NONE :
d_printf ( " createkey did nothing -- huh? \n " ) ;
break ;
case REG_CREATED_NEW_KEY :
d_printf ( " createkey created %s \n " , argv [ 0 ] ) ;
break ;
case REG_OPENED_EXISTING_KEY :
d_printf ( " createkey opened existing %s \n " , argv [ 0 ] ) ;
break ;
}
2007-12-03 20:21:40 +03:00
rpccli_winreg_CloseKey ( pipe_hnd , mem_ctx , & key_hnd , NULL ) ;
rpccli_winreg_CloseKey ( pipe_hnd , mem_ctx , & hive_hnd , NULL ) ;
2006-11-21 18:33:55 +03:00
return status ;
}
static int rpc_registry_createkey ( int argc , const char * * argv )
{
if ( argc ! = 1 ) {
d_fprintf ( stderr , " usage: net rpc registry createkey <key> \n " ) ;
return - 1 ;
}
return run_rpc_command ( NULL , PI_WINREG , 0 ,
rpc_registry_createkey_internal , argc , argv ) ;
}
static NTSTATUS rpc_registry_deletekey_internal ( const DOM_SID * domain_sid ,
const char * domain_name ,
struct cli_state * cli ,
struct rpc_pipe_client * pipe_hnd ,
TALLOC_CTX * mem_ctx ,
int argc ,
const char * * argv )
{
uint32 hive ;
struct policy_handle hive_hnd ;
struct winreg_String key ;
NTSTATUS status ;
2007-07-26 20:39:48 +04:00
ZERO_STRUCT ( key ) ;
2006-11-21 18:33:55 +03:00
if ( ! reg_hive_key ( argv [ 0 ] , & hive , & key . name ) ) {
return NT_STATUS_INVALID_PARAMETER ;
}
2007-08-23 19:33:25 +04:00
status = rpccli_winreg_Connect ( pipe_hnd , mem_ctx , hive ,
SEC_RIGHTS_MAXIMUM_ALLOWED ,
2006-11-21 18:33:55 +03:00
& hive_hnd ) ;
if ( ! ( NT_STATUS_IS_OK ( status ) ) ) {
return status ;
}
2007-12-03 20:21:40 +03:00
status = rpccli_winreg_DeleteKey ( pipe_hnd , mem_ctx , & hive_hnd , key , NULL ) ;
rpccli_winreg_CloseKey ( pipe_hnd , mem_ctx , & hive_hnd , NULL ) ;
2006-11-21 18:33:55 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
d_fprintf ( stderr , " deletekey returned %s \n " ,
nt_errstr ( status ) ) ;
}
return status ;
}
static int rpc_registry_deletekey ( int argc , const char * * argv )
{
if ( argc ! = 1 ) {
d_fprintf ( stderr , " usage: net rpc registry deletekey <key> \n " ) ;
return - 1 ;
}
return run_rpc_command ( NULL , PI_WINREG , 0 ,
rpc_registry_deletekey_internal , argc , argv ) ;
}
2005-05-23 20:25:31 +04:00
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-09-30 21:13:37 +04:00
static NTSTATUS rpc_registry_enumerate_internal ( const DOM_SID * domain_sid ,
const char * domain_name ,
struct cli_state * cli ,
struct rpc_pipe_client * pipe_hnd ,
TALLOC_CTX * mem_ctx ,
int argc ,
const char * * argv )
2005-05-23 20:25:31 +04:00
{
POLICY_HND pol_hive , pol_key ;
2006-09-26 19:15:26 +04:00
NTSTATUS status ;
2006-12-01 23:01:09 +03:00
uint32 num_subkeys = 0 ;
uint32 num_values = 0 ;
char * * names = NULL , * * classes = NULL ;
NTTIME * * modtimes = NULL ;
2006-11-21 02:20:07 +03:00
uint32 i ;
2006-12-01 23:01:09 +03:00
struct registry_value * * values = NULL ;
2005-05-23 20:25:31 +04:00
if ( argc ! = 1 ) {
2007-10-06 00:08:48 +04:00
d_printf ( " Usage: net rpc registry enumerate <path> [recurse] \n " ) ;
d_printf ( " Example: net rpc registry enumerate 'HKLM \\ Software \\ Samba' \n " ) ;
2005-05-23 20:25:31 +04:00
return NT_STATUS_OK ;
}
2006-11-21 13:48:11 +03:00
status = registry_openkey ( mem_ctx , pipe_hnd , argv [ 0 ] , REG_KEY_READ ,
& pol_hive , & pol_key ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
d_fprintf ( stderr , " registry_openkey failed: %s \n " ,
2006-09-29 01:19:08 +04:00
nt_errstr ( status ) ) ;
2006-11-21 13:48:11 +03:00
return status ;
2005-05-23 20:25:31 +04:00
}
2006-09-29 01:19:08 +04:00
2006-11-21 02:20:07 +03:00
status = registry_enumkeys ( mem_ctx , pipe_hnd , & pol_key , & num_subkeys ,
& names , & classes , & modtimes ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
d_fprintf ( stderr , " enumerating keys failed: %s \n " ,
nt_errstr ( status ) ) ;
2006-09-29 01:19:08 +04:00
return status ;
}
2006-11-21 02:20:07 +03:00
for ( i = 0 ; i < num_subkeys ; i + + ) {
2008-04-04 15:26:03 +04:00
print_registry_key ( names [ i ] , modtimes [ i ] ) ;
2005-05-23 20:25:31 +04:00
}
2006-11-21 02:20:07 +03:00
status = registry_enumvalues ( mem_ctx , pipe_hnd , & pol_key , & num_values ,
& names , & values ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
d_fprintf ( stderr , " enumerating values failed: %s \n " ,
nt_errstr ( status ) ) ;
return status ;
2006-09-29 01:19:08 +04:00
}
2006-11-21 02:20:07 +03:00
for ( i = 0 ; i < num_values ; i + + ) {
2008-04-04 15:30:49 +04:00
print_registry_value ( names [ i ] , values [ i ] ) ;
2005-05-23 20:25:31 +04:00
}
2006-11-21 02:20:07 +03:00
2007-12-03 20:21:40 +03:00
rpccli_winreg_CloseKey ( pipe_hnd , mem_ctx , & pol_key , NULL ) ;
rpccli_winreg_CloseKey ( pipe_hnd , mem_ctx , & pol_hive , NULL ) ;
2005-05-23 20:25:31 +04:00
2006-09-26 19:15:26 +04:00
return status ;
2005-05-23 20:25:31 +04:00
}
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static int rpc_registry_enumerate ( int argc , const char * * argv )
{
return run_rpc_command ( NULL , PI_WINREG , 0 ,
rpc_registry_enumerate_internal , argc , argv ) ;
}
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-09-30 21:13:37 +04:00
static NTSTATUS rpc_registry_save_internal ( const DOM_SID * domain_sid ,
const char * domain_name ,
struct cli_state * cli ,
struct rpc_pipe_client * pipe_hnd ,
TALLOC_CTX * mem_ctx ,
int argc ,
const char * * argv )
2005-05-23 20:25:31 +04:00
{
WERROR result = WERR_GENERAL_FAILURE ;
POLICY_HND pol_hive , pol_key ;
2006-09-26 19:15:26 +04:00
NTSTATUS status = NT_STATUS_UNSUCCESSFUL ;
2006-09-28 01:37:43 +04:00
struct winreg_String filename ;
2005-05-23 20:25:31 +04:00
if ( argc ! = 2 ) {
2007-10-06 00:08:48 +04:00
d_printf ( " Usage: net rpc registry backup <path> <file> \n " ) ;
2005-05-23 20:25:31 +04:00
return NT_STATUS_OK ;
}
2006-11-21 13:48:11 +03:00
status = registry_openkey ( mem_ctx , pipe_hnd , argv [ 0 ] , REG_KEY_ALL ,
& pol_hive , & pol_key ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
d_fprintf ( stderr , " registry_openkey failed: %s \n " ,
nt_errstr ( status ) ) ;
2006-09-26 19:15:26 +04:00
return status ;
2005-05-23 20:25:31 +04:00
}
2006-11-21 13:48:11 +03:00
2006-09-28 01:37:43 +04:00
filename . name = argv [ 1 ] ;
2007-12-03 20:21:40 +03:00
status = rpccli_winreg_SaveKey ( pipe_hnd , mem_ctx , & pol_key , & filename , NULL , NULL ) ;
2005-05-27 00:36:04 +04:00
if ( ! W_ERROR_IS_OK ( result ) ) {
2006-01-18 00:22:00 +03:00
d_fprintf ( stderr , " Unable to save [%s] to %s:%s \n " , argv [ 0 ] , cli - > desthost , argv [ 1 ] ) ;
2005-05-23 20:25:31 +04:00
}
/* cleanup */
2007-12-03 20:21:40 +03:00
rpccli_winreg_CloseKey ( pipe_hnd , mem_ctx , & pol_key , NULL ) ;
rpccli_winreg_CloseKey ( pipe_hnd , mem_ctx , & pol_hive , NULL ) ;
2005-05-23 20:25:31 +04:00
2006-09-26 19:15:26 +04:00
return status ;
2005-05-23 20:25:31 +04:00
}
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-05-27 00:36:04 +04:00
static int rpc_registry_save ( int argc , const char * * argv )
2005-05-23 20:25:31 +04:00
{
return run_rpc_command ( NULL , PI_WINREG , 0 ,
2005-05-27 00:36:04 +04:00
rpc_registry_save_internal , argc , argv ) ;
2005-05-23 20:25:31 +04:00
}
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void dump_values ( REGF_NK_REC * nk )
{
int i , j ;
2007-12-05 02:21:14 +03:00
char * data_str = NULL ;
2005-05-23 20:25:31 +04:00
uint32 data_size , data ;
if ( ! nk - > values )
return ;
for ( i = 0 ; i < nk - > num_values ; i + + ) {
d_printf ( " \" %s \" = " , nk - > values [ i ] . valuename ? nk - > values [ i ] . valuename : " (default) " ) ;
2006-07-11 22:01:26 +04:00
d_printf ( " (%s) " , reg_type_lookup ( nk - > values [ i ] . type ) ) ;
2005-05-23 20:25:31 +04:00
data_size = nk - > values [ i ] . data_size & ~ VK_DATA_IN_OFFSET ;
switch ( nk - > values [ i ] . type ) {
case REG_SZ :
2007-12-05 02:21:14 +03:00
rpcstr_pull_talloc ( talloc_tos ( ) ,
& data_str ,
nk - > values [ i ] . data ,
- 1 ,
STR_TERMINATE ) ;
if ( ! data_str ) {
break ;
}
2005-05-23 20:25:31 +04:00
d_printf ( " %s " , data_str ) ;
break ;
case REG_MULTI_SZ :
case REG_EXPAND_SZ :
for ( j = 0 ; j < data_size ; j + + ) {
d_printf ( " %c " , nk - > values [ i ] . data [ j ] ) ;
}
break ;
case REG_DWORD :
data = IVAL ( nk - > values [ i ] . data , 0 ) ;
d_printf ( " 0x%x " , data ) ;
break ;
case REG_BINARY :
for ( j = 0 ; j < data_size ; j + + ) {
d_printf ( " %x " , nk - > values [ i ] . data [ j ] ) ;
}
break ;
default :
d_printf ( " unknown " ) ;
break ;
}
d_printf ( " \n " ) ;
}
}
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2007-10-19 04:40:25 +04:00
static bool dump_registry_tree ( REGF_FILE * file , REGF_NK_REC * nk , const char * parent )
2005-05-23 20:25:31 +04:00
{
REGF_NK_REC * key ;
/* depth first dump of the registry tree */
while ( ( key = regfio_fetch_subkey ( file , nk ) ) ) {
2007-12-05 02:21:14 +03:00
char * regpath ;
if ( asprintf ( & regpath , " %s \\ %s " , parent , key - > keyname ) < 0 ) {
break ;
}
2005-05-23 20:25:31 +04:00
d_printf ( " [%s] \n " , regpath ) ;
dump_values ( key ) ;
d_printf ( " \n " ) ;
dump_registry_tree ( file , key , regpath ) ;
2007-12-05 02:21:14 +03:00
SAFE_FREE ( regpath ) ;
2005-05-23 20:25:31 +04:00
}
2006-01-18 00:22:00 +03:00
2005-05-23 20:25:31 +04:00
return True ;
}
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2007-10-19 04:40:25 +04:00
static bool write_registry_tree ( REGF_FILE * infile , REGF_NK_REC * nk ,
2005-05-23 20:25:31 +04:00
REGF_NK_REC * parent , REGF_FILE * outfile ,
const char * parentpath )
{
REGF_NK_REC * key , * subkey ;
2007-12-05 02:21:14 +03:00
REGVAL_CTR * values = NULL ;
REGSUBKEY_CTR * subkeys = NULL ;
2005-05-23 20:25:31 +04:00
int i ;
2007-12-05 02:21:14 +03:00
char * path = NULL ;
2005-05-23 20:25:31 +04:00
2005-08-29 18:55:40 +04:00
if ( ! ( subkeys = TALLOC_ZERO_P ( infile - > mem_ctx , REGSUBKEY_CTR ) ) ) {
DEBUG ( 0 , ( " write_registry_tree: talloc() failed! \n " ) ) ;
return False ;
}
if ( ! ( values = TALLOC_ZERO_P ( subkeys , REGVAL_CTR ) ) ) {
DEBUG ( 0 , ( " write_registry_tree: talloc() failed! \n " ) ) ;
2007-12-05 02:21:14 +03:00
TALLOC_FREE ( subkeys ) ;
2005-08-29 18:55:40 +04:00
return False ;
}
2005-05-23 20:25:31 +04:00
/* copy values into the REGVAL_CTR */
2007-12-05 02:21:14 +03:00
2005-05-23 20:25:31 +04:00
for ( i = 0 ; i < nk - > num_values ; i + + ) {
2005-08-29 18:55:40 +04:00
regval_ctr_addvalue ( values , nk - > values [ i ] . valuename , nk - > values [ i ] . type ,
2005-10-18 07:24:00 +04:00
( const char * ) nk - > values [ i ] . data , ( nk - > values [ i ] . data_size & ~ VK_DATA_IN_OFFSET ) ) ;
2005-05-23 20:25:31 +04:00
}
/* copy subkeys into the REGSUBKEY_CTR */
2007-12-05 02:21:14 +03:00
2005-05-23 20:25:31 +04:00
while ( ( subkey = regfio_fetch_subkey ( infile , nk ) ) ) {
2005-08-29 18:55:40 +04:00
regsubkey_ctr_addkey ( subkeys , subkey - > keyname ) ;
2005-05-23 20:25:31 +04:00
}
2007-12-05 02:21:14 +03:00
2005-08-29 18:55:40 +04:00
key = regfio_write_key ( outfile , nk - > keyname , values , subkeys , nk - > sec_desc - > sec_desc , parent ) ;
2005-05-23 20:25:31 +04:00
/* write each one of the subkeys out */
2007-12-05 02:21:14 +03:00
path = talloc_asprintf ( subkeys ,
" %s%s%s " ,
parentpath ,
parent ? " \\ " : " " ,
nk - > keyname ) ;
if ( ! path ) {
TALLOC_FREE ( subkeys ) ;
return false ;
}
2005-05-23 20:25:31 +04:00
nk - > subkey_index = 0 ;
while ( ( subkey = regfio_fetch_subkey ( infile , nk ) ) ) {
write_registry_tree ( infile , subkey , key , outfile , path ) ;
}
d_printf ( " [%s] \n " , path ) ;
2007-12-05 02:21:14 +03:00
TALLOC_FREE ( subkeys ) ;
2005-05-23 20:25:31 +04:00
return True ;
}
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static int rpc_registry_dump ( int argc , const char * * argv )
{
REGF_FILE * registry ;
REGF_NK_REC * nk ;
if ( argc ! = 1 ) {
2007-10-06 00:08:48 +04:00
d_printf ( " Usage: net rpc registry dump <file> \n " ) ;
2005-05-23 20:25:31 +04:00
return 0 ;
}
d_printf ( " Opening %s.... " , argv [ 0 ] ) ;
if ( ! ( registry = regfio_open ( argv [ 0 ] , O_RDONLY , 0 ) ) ) {
2006-01-18 00:22:00 +03:00
d_fprintf ( stderr , " Failed to open %s for reading \n " , argv [ 0 ] ) ;
2005-05-23 20:25:31 +04:00
return 1 ;
}
d_printf ( " ok \n " ) ;
/* get the root of the registry file */
2006-06-19 23:07:39 +04:00
if ( ( nk = regfio_rootkey ( registry ) ) = = NULL ) {
d_fprintf ( stderr , " Could not get rootkey \n " ) ;
2006-06-28 08:56:23 +04:00
regfio_close ( registry ) ;
2006-06-19 23:07:39 +04:00
return 1 ;
}
2005-05-23 20:25:31 +04:00
d_printf ( " [%s] \n " , nk - > keyname ) ;
dump_values ( nk ) ;
d_printf ( " \n " ) ;
dump_registry_tree ( registry , nk , nk - > keyname ) ;
#if 0
talloc_report_full ( registry - > mem_ctx , stderr ) ;
# endif
d_printf ( " Closing registry... " ) ;
regfio_close ( registry ) ;
d_printf ( " ok \n " ) ;
return 0 ;
}
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static int rpc_registry_copy ( int argc , const char * * argv )
{
2006-06-28 08:51:23 +04:00
REGF_FILE * infile = NULL , * outfile = NULL ;
2005-05-23 20:25:31 +04:00
REGF_NK_REC * nk ;
2006-01-18 00:22:00 +03:00
int result = 1 ;
2005-05-23 20:25:31 +04:00
if ( argc ! = 2 ) {
2007-10-06 00:08:48 +04:00
d_printf ( " Usage: net rpc registry copy <srcfile> <newfile> \n " ) ;
2005-05-23 20:25:31 +04:00
return 0 ;
}
d_printf ( " Opening %s.... " , argv [ 0 ] ) ;
if ( ! ( infile = regfio_open ( argv [ 0 ] , O_RDONLY , 0 ) ) ) {
2006-01-18 00:22:00 +03:00
d_fprintf ( stderr , " Failed to open %s for reading \n " , argv [ 0 ] ) ;
2005-05-23 20:25:31 +04:00
return 1 ;
}
d_printf ( " ok \n " ) ;
d_printf ( " Opening %s.... " , argv [ 1 ] ) ;
if ( ! ( outfile = regfio_open ( argv [ 1 ] , ( O_RDWR | O_CREAT | O_TRUNC ) , ( S_IREAD | S_IWRITE ) ) ) ) {
2006-01-18 00:22:00 +03:00
d_fprintf ( stderr , " Failed to open %s for writing \n " , argv [ 1 ] ) ;
2006-06-28 08:51:23 +04:00
goto out ;
2005-05-23 20:25:31 +04:00
}
d_printf ( " ok \n " ) ;
/* get the root of the registry file */
2006-06-19 23:07:39 +04:00
if ( ( nk = regfio_rootkey ( infile ) ) = = NULL ) {
d_fprintf ( stderr , " Could not get rootkey \n " ) ;
2006-06-28 08:51:23 +04:00
goto out ;
2006-06-19 23:07:39 +04:00
}
2005-05-23 20:25:31 +04:00
d_printf ( " RootKey: [%s] \n " , nk - > keyname ) ;
write_registry_tree ( infile , nk , NULL , outfile , " " ) ;
2006-01-18 00:22:00 +03:00
result = 0 ;
2006-06-28 08:51:23 +04:00
out :
2005-05-23 20:25:31 +04:00
d_printf ( " Closing %s... " , argv [ 1 ] ) ;
2006-06-28 08:51:23 +04:00
if ( outfile ) {
regfio_close ( outfile ) ;
}
2005-05-23 20:25:31 +04:00
d_printf ( " ok \n " ) ;
d_printf ( " Closing %s... " , argv [ 0 ] ) ;
2006-06-28 08:51:23 +04:00
if ( infile ) {
regfio_close ( infile ) ;
}
2005-05-23 20:25:31 +04:00
d_printf ( " ok \n " ) ;
2006-01-18 00:22:00 +03:00
return ( result ) ;
2005-05-23 20:25:31 +04:00
}
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2007-10-06 00:07:18 +04:00
static NTSTATUS rpc_registry_getsd_internal ( const DOM_SID * domain_sid ,
const char * domain_name ,
struct cli_state * cli ,
struct rpc_pipe_client * pipe_hnd ,
TALLOC_CTX * mem_ctx ,
int argc ,
const char * * argv )
{
POLICY_HND pol_hive , pol_key ;
NTSTATUS status ;
2007-11-09 16:39:45 +03:00
enum ndr_err_code ndr_err ;
2007-10-06 00:07:18 +04:00
struct KeySecurityData * sd = NULL ;
uint32_t sec_info ;
DATA_BLOB blob ;
struct security_descriptor sec_desc ;
2007-11-05 04:33:58 +03:00
uint32_t access_mask = REG_KEY_READ |
SEC_RIGHT_MAXIMUM_ALLOWED |
SEC_RIGHT_SYSTEM_SECURITY ;
2007-10-06 00:07:18 +04:00
2007-10-09 17:53:40 +04:00
if ( argc < 1 | | argc > 2 ) {
d_printf ( " Usage: net rpc registry getsd <path> <secinfo> \n " ) ;
2007-10-06 00:07:18 +04:00
d_printf ( " Example: net rpc registry getsd 'HKLM \\ Software \\ Samba' \n " ) ;
return NT_STATUS_OK ;
}
2007-11-05 04:33:58 +03:00
status = registry_openkey ( mem_ctx , pipe_hnd , argv [ 0 ] ,
access_mask ,
2007-10-06 00:07:18 +04:00
& pol_hive , & pol_key ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
d_fprintf ( stderr , " registry_openkey failed: %s \n " ,
nt_errstr ( status ) ) ;
return status ;
}
sd = TALLOC_ZERO_P ( mem_ctx , struct KeySecurityData ) ;
if ( ! sd ) {
status = NT_STATUS_NO_MEMORY ;
goto out ;
}
sd - > size = 0x1000 ;
2007-10-09 17:53:40 +04:00
if ( argc > = 2 ) {
sscanf ( argv [ 1 ] , " %x " , & sec_info ) ;
} else {
sec_info = SECINFO_OWNER | SECINFO_GROUP | SECINFO_DACL ;
}
2007-10-06 00:07:18 +04:00
status = registry_getsd ( mem_ctx , pipe_hnd , & pol_key , sec_info , sd ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
d_fprintf ( stderr , " getting sd failed: %s \n " ,
nt_errstr ( status ) ) ;
goto out ;
}
blob . data = sd - > data ;
blob . length = sd - > size ;
2007-11-09 16:39:45 +03:00
ndr_err = ndr_pull_struct_blob ( & blob , mem_ctx , & sec_desc ,
( ndr_pull_flags_fn_t ) ndr_pull_security_descriptor ) ;
if ( ! NDR_ERR_CODE_IS_SUCCESS ( ndr_err ) ) {
status = ndr_map_error2ntstatus ( ndr_err ) ;
2007-10-09 17:53:40 +04:00
goto out ;
}
2007-11-09 16:39:45 +03:00
status = NT_STATUS_OK ;
2007-10-06 00:07:18 +04:00
display_sec_desc ( & sec_desc ) ;
out :
2007-12-03 20:21:40 +03:00
rpccli_winreg_CloseKey ( pipe_hnd , mem_ctx , & pol_key , NULL ) ;
rpccli_winreg_CloseKey ( pipe_hnd , mem_ctx , & pol_hive , NULL ) ;
2007-10-06 00:07:18 +04:00
return status ;
}
static int rpc_registry_getsd ( int argc , const char * * argv )
{
return run_rpc_command ( NULL , PI_WINREG , 0 ,
2007-10-09 17:53:40 +04:00
rpc_registry_getsd_internal , argc , argv ) ;
2007-10-06 00:07:18 +04:00
}
/********************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-05-23 20:25:31 +04:00
int net_rpc_registry ( int argc , const char * * argv )
{
2006-11-21 17:01:03 +03:00
struct functable2 func [ ] = {
{ " enumerate " , rpc_registry_enumerate ,
" Enumerate registry keys and values " } ,
2006-11-21 18:33:55 +03:00
{ " createkey " , rpc_registry_createkey ,
" Create a new registry key " } ,
{ " deletekey " , rpc_registry_deletekey ,
" Delete a registry key " } ,
2006-11-21 17:01:03 +03:00
{ " setvalue " , rpc_registry_setvalue ,
" Set a new registry value " } ,
2006-11-21 18:33:55 +03:00
{ " deletevalue " , rpc_registry_deletevalue ,
" Delete a registry value " } ,
2006-11-21 17:01:03 +03:00
{ " save " , rpc_registry_save ,
" Save a registry file " } ,
{ " dump " , rpc_registry_dump ,
" Dump a registry file " } ,
{ " copy " , rpc_registry_copy ,
" Copy a registry file " } ,
2007-10-06 00:07:18 +04:00
{ " getsd " , rpc_registry_getsd ,
" Get security descriptor " } ,
2006-11-21 17:01:03 +03:00
{ NULL , NULL , NULL }
2005-05-23 20:25:31 +04:00
} ;
2006-11-21 17:01:03 +03:00
return net_run_function2 ( argc , argv , " net rpc registry " , func ) ;
2005-05-23 20:25:31 +04:00
}