svn commit: samba r24175 - in branches/4.0-regwrite: . source/lib/registry/tools

jelmer at samba.org jelmer at samba.org
Sat Aug 4 13:13:09 GMT 2007


Author: jelmer
Date: 2007-08-04 13:13:08 +0000 (Sat, 04 Aug 2007)
New Revision: 24175

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24175

Log:
Fix regdiff and update for new API.

Modified:
   branches/4.0-regwrite/
   branches/4.0-regwrite/source/lib/registry/tools/regdiff.c


Changeset:

Property changes on: branches/4.0-regwrite
___________________________________________________________________
Name: bzr:revision-info
   - timestamp: Sun 2007-01-14 05:27:37.785000086 +0100
committer: Wilco Baan Hofman <wilco at baanhofman.nl>
properties: 
	branch-nick: 4.0-regwrite
	rebase-of: wilco at baanhofman.nl-20070114042737-pwu8etpcs7lmwsms

   + timestamp: Sun 2007-01-14 05:35:01.158999920 +0100
committer: Wilco Baan Hofman <wilco at baanhofman.nl>
properties: 
	branch-nick: 4.0-regwrite
	rebase-of: wilco at baanhofman.nl-20070114043501-7g3vsn55rrr643z6

Name: bzr:revision-id:v3-trunk0
   - 11140 jelmer at samba.org-20070113195019-yrx40nap220myng0-svn3-upgrade
11142 jelmer at samba.org-20070113195431-nshumfy5z00cpnaj-svn3-upgrade
11143 jelmer at samba.org-20070113195555-am0swaxzsoxp05p0-svn3-upgrade
11144 wilco at baanhofman.nl-20070114042604-b7pwqobkrbmlbp8p-svn3-upgrade
11145 wilco at baanhofman.nl-20070114042644-fa3gbnlhall7nkry-svn3-upgrade
11146 wilco at baanhofman.nl-20070114042712-7ueqyvk12ki1frc5-svn3-upgrade
11147 wilco at baanhofman.nl-20070114042737-pwu8etpcs7lmwsms-svn3-upgrade

   + 11140 jelmer at samba.org-20070113195019-yrx40nap220myng0-svn3-upgrade
11142 jelmer at samba.org-20070113195431-nshumfy5z00cpnaj-svn3-upgrade
11143 jelmer at samba.org-20070113195555-am0swaxzsoxp05p0-svn3-upgrade
11144 wilco at baanhofman.nl-20070114042604-b7pwqobkrbmlbp8p-svn3-upgrade
11145 wilco at baanhofman.nl-20070114042644-fa3gbnlhall7nkry-svn3-upgrade
11146 wilco at baanhofman.nl-20070114042712-7ueqyvk12ki1frc5-svn3-upgrade
11147 wilco at baanhofman.nl-20070114042737-pwu8etpcs7lmwsms-svn3-upgrade
11148 wilco at baanhofman.nl-20070114043501-7g3vsn55rrr643z6-svn3-upgrade


Modified: branches/4.0-regwrite/source/lib/registry/tools/regdiff.c
===================================================================
--- branches/4.0-regwrite/source/lib/registry/tools/regdiff.c	2007-08-04 13:13:02 UTC (rev 24174)
+++ branches/4.0-regwrite/source/lib/registry/tools/regdiff.c	2007-08-04 13:13:08 UTC (rev 24175)
@@ -2,7 +2,8 @@
    Unix SMB/CIFS implementation.
    simple registry frontend
    
-   Copyright (C) Jelmer Vernooij 2004-2005
+   Copyright (C) Jelmer Vernooij 2004-2006
+   Copyright (C) Wilco Baan Hofman 2006
 
    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
@@ -25,7 +26,7 @@
 #include "lib/registry/reg_backend_rpc.h"
 #include "lib/cmdline/popt_common.h"
 
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
 	int opt;
 	poptContext pc;
@@ -33,22 +34,24 @@
 	struct registry_context *h1 = NULL, *h2 = NULL;
 	int from_null = 0;
 	WERROR error;
-	struct reg_diff *diff;
 	struct poptOption long_options[] = {
 		POPT_AUTOHELP
-		{"output", 'o', POPT_ARG_STRING, &outputfile, 'o', "output file to use", NULL },
-		{"null", 'n', POPT_ARG_NONE, &from_null, 'n', "Diff from NULL", NULL },
-		{"remote", 'R', POPT_ARG_STRING, NULL, 0, "Connect to remote server" , NULL },
-		{"local", 'L', POPT_ARG_NONE, NULL, 0, "Open local registry", NULL },
+		{"output", 'o', POPT_ARG_STRING, &outputfile, 0, "output file to use", NULL },
+		{"null", 'n', POPT_ARG_NONE, &from_null, 0, "Diff from NULL", NULL },
+		{"remote", 'R', POPT_ARG_STRING, NULL, 'R', "Connect to remote server" , NULL },
+		{"local", 'L', POPT_ARG_NONE, NULL, 'L', "Open local registry", NULL },
 		POPT_COMMON_SAMBA
 		POPT_COMMON_CREDENTIALS
 		POPT_COMMON_VERSION
 		{ NULL }
 	};
+	TALLOC_CTX *ctx = talloc_init("regdiff");
+	void *callback_data;
+	struct reg_diff_callbacks *callbacks;
 
 	registry_init();
 
-	pc = poptGetContext(argv[0], argc, (const char **) argv, long_options,0);
+	pc = poptGetContext(argv[0], argc, argv, long_options,0);
 
 	while((opt = poptGetNextOpt(pc)) != -1) {
 		error = WERR_OK;
@@ -74,13 +77,21 @@
 
 	poptFreeContext(pc);
 
-	diff = reg_generate_diff(NULL, h1, h2);
-	if (!diff) {
-		fprintf(stderr, "Unable to generate diff between keys\n");
+	if (h1 == NULL || h2 == NULL) {
+		fprintf(stderr, "Please specify two contexts.\n");
 		return -1;
+	}	
+	error = reg_diff_save(ctx, outputfile, REG_DIFF_DOTREG, &callbacks, &callback_data);
+	if (!W_ERROR_IS_OK(error)) {
+		fprintf(stderr, "Problem saving registry diff to '%s': %s\n", outputfile, win_errstr(error));
+		return -1;
 	}
+	error = reg_generate_diff(h1, h2, callbacks, callback_data);
+	if (!W_ERROR_IS_OK(error)) {
+		fprintf(stderr, "Unable to generate diff between keys: %s\n", win_errstr(error));
+		return -1;
+	}
 
-	reg_diff_save(diff, outputfile);
 
 	return 0;
 }



More information about the samba-cvs mailing list