svn commit: samba r9377 - in branches/SAMBA_4_0/source: script/tests scripting/bin

tridge at samba.org tridge at samba.org
Thu Aug 18 05:09:27 GMT 2005


Author: tridge
Date: 2005-08-18 05:09:26 +0000 (Thu, 18 Aug 2005)
New Revision: 9377

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

Log:
made winreg a user tool (I find it quite useful). I expect it to get the ability
to add/remove keys and values in the future.

add it to the standard tests, ensuring that we know if winreg
breaks. This is particularly important as winreg uses such unusual IDL
constructs


Added:
   branches/SAMBA_4_0/source/scripting/bin/winreg
Modified:
   branches/SAMBA_4_0/source/script/tests/test_ejs.sh


Changeset:
Modified: branches/SAMBA_4_0/source/script/tests/test_ejs.sh
===================================================================
--- branches/SAMBA_4_0/source/script/tests/test_ejs.sh	2005-08-18 03:15:48 UTC (rev 9376)
+++ branches/SAMBA_4_0/source/script/tests/test_ejs.sh	2005-08-18 05:09:26 UTC (rev 9377)
@@ -24,3 +24,4 @@
     testit "$f" $SCRIPTDIR/$f $CONFIGURATION ncalrpc: -U$USERNAME%$PASSWORD || failed=`expr $failed + 1`
 done
 
+testit "winreg" scripting/bin/winreg $CONFIGURATION ncalrpc: 'HKLM' -U$USERNAME%$PASSWORD || failed=`expr $failed + 1`

Added: branches/SAMBA_4_0/source/scripting/bin/winreg
===================================================================
--- branches/SAMBA_4_0/source/scripting/bin/winreg	2005-08-18 03:15:48 UTC (rev 9376)
+++ branches/SAMBA_4_0/source/scripting/bin/winreg	2005-08-18 05:09:26 UTC (rev 9377)
@@ -0,0 +1,75 @@
+#!/bin/sh
+exec smbscript "$0" ${1+"$@"}
+/*
+  tool to manipulate a remote registry
+  Copyright Andrew Tridgell 2005
+  Released under the GNU GPL v2 or later
+*/	
+
+libinclude("base.js");
+libinclude("winreg.js");
+
+var options = new Object();
+
+ok = GetOptions(ARGV, options,
+		"POPT_AUTOHELP",
+		"POPT_COMMON_SAMBA",
+		"POPT_COMMON_CREDENTIALS");
+if (ok == false) {
+	println("Failed to parse options: " + options.ERROR);
+	return -1;
+}
+
+if (options.ARGV.length < 1) {
+	println("Usage: winreg.js <BINDING> [path]");
+	return -1;
+}
+var binding = options.ARGV[0];
+reg = winreg_init();
+security_init(reg);
+
+print("Connecting to " + binding + "\n");
+status = reg.connect(binding);
+if (status.is_ok != true) {
+	print("Failed to connect to " + binding + " - " + status.errstr + "\n");
+	return -1;
+}
+
+function list_values(path) {
+	var list = winreg_enum_values(reg, path);
+	var i;
+	if (list == undefined) {
+		return;
+	}
+	for (i=0;i<list.length;i++) {
+		printf("\ttype=%2d size=%4d  '%s'\n", list[i].type, list[i].size, list[i].name);
+	}
+}
+
+function list_path(path) {
+	var list = winreg_enum_path(reg, path);
+	var i;
+	list_values(path);
+	for (i=0;i<list.length;i++) {
+		var npath;
+		if (path) {
+			npath = path + "\\" + list[i];
+		} else {
+			npath = list[i];
+		}
+		println(npath);
+		list_path(npath);
+	}
+}
+
+var root;
+
+if (options.ARGV.length > 1) {
+	root = options.ARGV[1];
+} else {
+	root = '';
+}
+
+printf("Listing registry tree '%s'\n", root);
+list_path(root);
+return 0;


Property changes on: branches/SAMBA_4_0/source/scripting/bin/winreg
___________________________________________________________________
Name: svn:executable
   + *



More information about the samba-cvs mailing list