summaryrefslogtreecommitdiff
path: root/source3/utils/net_rpc_registry.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-05-26 20:36:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:57:00 -0500
commitd5e79de59561e614fce79a9460c3b2caaa459673 (patch)
tree43c6c7f352ff1c0f9f16808466b47069db3655e7 /source3/utils/net_rpc_registry.c
parent45d03e327ae8b2b9b9761ed76161d4467b27f730 (diff)
downloadsamba-d5e79de59561e614fce79a9460c3b2caaa459673.tar.gz
samba-d5e79de59561e614fce79a9460c3b2caaa459673.tar.bz2
samba-d5e79de59561e614fce79a9460c3b2caaa459673.zip
r6995: * fixing segfault when writing out registry values of zero length
* add RegSaveKey() client function * add 'net rpc registry save' subcommand (This used to be commit f35e0a0a8d8df5c39e61ebd34c4aecbc5c9bb635)
Diffstat (limited to 'source3/utils/net_rpc_registry.c')
-rw-r--r--source3/utils/net_rpc_registry.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/source3/utils/net_rpc_registry.c b/source3/utils/net_rpc_registry.c
index 53378fadef..f97f67a13b 100644
--- a/source3/utils/net_rpc_registry.c
+++ b/source3/utils/net_rpc_registry.c
@@ -198,7 +198,7 @@ static int rpc_registry_enumerate( int argc, const char **argv )
/********************************************************************
********************************************************************/
-static NTSTATUS rpc_registry_backup_internal( const DOM_SID *domain_sid, const char *domain_name,
+static NTSTATUS rpc_registry_save_internal( const DOM_SID *domain_sid, const char *domain_name,
struct cli_state *cli, TALLOC_CTX *mem_ctx,
int argc, const char **argv )
{
@@ -206,7 +206,6 @@ static NTSTATUS rpc_registry_backup_internal( const DOM_SID *domain_sid, const c
uint32 hive;
pstring subpath;
POLICY_HND pol_hive, pol_key;
- REGF_FILE *regfile;
if (argc != 2 ) {
d_printf("Usage: net rpc backup <path> <file> \n");
@@ -232,17 +231,14 @@ static NTSTATUS rpc_registry_backup_internal( const DOM_SID *domain_sid, const c
return werror_to_ntstatus(result);
}
- /* open the file */
-
- if ( !(regfile = regfio_open( argv[1], (O_RDWR|O_CREAT|O_TRUNC), 0600 )) ) {
- d_printf("Unable to open registry file [%s]\n", argv[1]);
- return werror_to_ntstatus(WERR_GENERAL_FAILURE);
+ result = cli_reg_save_key( cli, mem_ctx, &pol_key, argv[1] );
+ if ( !W_ERROR_IS_OK(result) ) {
+ d_printf("Unable to save [%s] to %s:%s\n", argv[0], cli->desthost, argv[1]);
}
/* cleanup */
- regfio_close( regfile );
cli_reg_close( cli, mem_ctx, &pol_key );
cli_reg_close( cli, mem_ctx, &pol_hive );
@@ -252,10 +248,10 @@ static NTSTATUS rpc_registry_backup_internal( const DOM_SID *domain_sid, const c
/********************************************************************
********************************************************************/
-static int rpc_registry_backup( int argc, const char **argv )
+static int rpc_registry_save( int argc, const char **argv )
{
return run_rpc_command( NULL, PI_WINREG, 0,
- rpc_registry_backup_internal, argc, argv );
+ rpc_registry_save_internal, argc, argv );
}
@@ -467,7 +463,7 @@ static int rpc_registry_copy( int argc, const char **argv )
static int net_help_registry( int argc, const char **argv )
{
d_printf("net rpc registry enumerate <path> [recurse] Enumerate the subkeya and values for a given registry path\n");
- d_printf("net rpc registry backup <path> <file> Backup a registry tree to a local file\n");
+ d_printf("net rpc registry save <path> <file> Backup a registry tree to a file on the server\n");
d_printf("net rpc registry dump <file> Dump the contents of a registry file to stdout\n");
return -1;
@@ -480,7 +476,7 @@ int net_rpc_registry(int argc, const char **argv)
{
struct functable func[] = {
{"enumerate", rpc_registry_enumerate},
- {"backup", rpc_registry_backup},
+ {"save", rpc_registry_save},
{"dump", rpc_registry_dump},
{"copy", rpc_registry_copy},
{NULL, NULL}