svn commit: samba r6409 - in trunk/source: registry utils
jerry at samba.org
jerry at samba.org
Thu Apr 21 02:26:20 GMT 2005
Author: jerry
Date: 2005-04-21 02:26:19 +0000 (Thu, 21 Apr 2005)
New Revision: 6409
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6409
Log:
add test code for reading the regf block in 'net rpc registry dump'
Modified:
trunk/source/registry/regfio.c
trunk/source/utils/net_rpc_registry.c
Changeset:
Modified: trunk/source/registry/regfio.c
===================================================================
--- trunk/source/registry/regfio.c 2005-04-21 01:46:18 UTC (rev 6408)
+++ trunk/source/registry/regfio.c 2005-04-21 02:26:19 UTC (rev 6409)
@@ -58,9 +58,6 @@
int bytes_read, returned;
char *buffer;
- if ( prs_data_size(ps) < REGF_BLOCKSIZE )
- prs_alloc_mem( ps, REGF_BLOCKSIZE, 1 );
-
buffer = prs_data_p( ps );
if ( lseek( fd, file_offset, SEEK_SET ) == -1 ) {
@@ -161,7 +158,7 @@
return False;
}
- prs_init( &ps, 0, ctx, UNMARSHALL );
+ prs_init( &ps, REGF_BLOCKSIZE, ctx, UNMARSHALL );
/* grab the first block from the file */
@@ -200,6 +197,7 @@
DEBUG(0,("ERROR allocating memory\n"));
return NULL;
}
+ ZERO_STRUCTP( rb );
/* open and existing file */
Modified: trunk/source/utils/net_rpc_registry.c
===================================================================
--- trunk/source/utils/net_rpc_registry.c 2005-04-21 01:46:18 UTC (rev 6408)
+++ trunk/source/utils/net_rpc_registry.c 2005-04-21 02:26:19 UTC (rev 6409)
@@ -259,6 +259,24 @@
static int rpc_registry_dump( int argc, const char **argv )
{
+ REGF_FILE *registry;
+
+ if (argc != 1 ) {
+ d_printf("Usage: net rpc dump <file> \n");
+ return 0;
+ }
+
+ d_printf("Opening %s....", argv[0]);
+ if ( !(registry = regfio_open( argv[0], O_RDONLY, 0 )) ) {
+ d_printf("Failed to open %s for reading\n", argv[0]);
+ return 1;
+ }
+ d_printf("ok\n");
+
+
+ d_printf("Closing registry...");
+ regfio_close( registry );
+ d_printf("ok\n");
return 0;
}
More information about the samba-cvs
mailing list