Rev 11183: More work getting samba to compile again. in file:///home/jelmer/bzr.samba-old/4.0-regwrite/

Jelmer Vernooij jelmer at samba.org
Mon Jun 11 01:20:55 GMT 2007


At file:///home/jelmer/bzr.samba-old/4.0-regwrite/

------------------------------------------------------------
revno: 11183
revision-id: jelmer at samba.org-20070610222652-11vkd62zyiyk971l
parent: jelmer at samba.org-20070608215652-x6m0ejk982bzfp76
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 4.0-regwrite
timestamp: Mon 2007-06-11 00:26:52 +0200
message:
  More work getting samba to compile again.
modified:
  source/lib/registry/hive.h     hive.h-20070423140448-w1nvzs8d2qxvyswz-1
  source/lib/registry/interface.c svn-v2:20 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2fcommon%2freg_interface.c
  source/lib/registry/patchfile.c svn-v2:10605 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2fpatchfile.c
  source/lib/registry/patchfile_dotreg.c patchfile_dotreg.c-20070114041738-0dfmkdtsa8bfu20l-1
  source/lib/registry/registry.h svn-v2:10026 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2fregistry.h
  source/lib/registry/tests/generic.c svn-v2:21656 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2ftests%2fgeneric.c
  source/lib/registry/tools/regshell.c svn-v2:20 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2ftools%2fregshell.c
  source/lib/registry/tools/regtree.c svn-v2:20 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2ftools%2fregtree.c
  source/lib/util/become_daemon.c svn-v2:22379 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2futil%2fbecome_daemon.c
  source/rpc_server/winreg/rpc_winreg.c svn-v2:20 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2frpc_server%2fwinreg%2frpc_winreg.c
  source/scripting/ejs/smbcalls_ldb.c svn-v2:7266 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fscripting%2fejs%2fsmbcalls_ldb.c
  source/smbd/server.c           svn-v2:2 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-trunk-source%2fsmbd%2fserver.c
  source/torture/ndr/winreg.c    svn-v2:21347 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2ftorture%2fndr%2fwinreg.c
=== modified file 'source/lib/registry/hive.h'
--- a/source/lib/registry/hive.h	2007-06-02 15:25:04 +0000
+++ b/source/lib/registry/hive.h	2007-06-10 22:26:52 +0000
@@ -140,7 +140,8 @@
 							const struct hive_key *key,
 							const char **classname,
 							uint32_t *num_subkeys,
-							uint32_t *num_values);
+							uint32_t *num_values,
+							NTTIME *last_change_time);
 };
 
 struct cli_credentials;

=== modified file 'source/lib/registry/interface.c'
--- a/source/lib/registry/interface.c	2007-06-02 15:25:04 +0000
+++ b/source/lib/registry/interface.c	2007-06-10 22:26:52 +0000
@@ -108,7 +108,7 @@
 		return WERR_NOT_SUPPORTED;
 	}
 
-	return parent->context->ops->open_key(parent, name, result);
+	return parent->context->ops->open_key(mem_ctx, parent, name, result);
 }
 
 /**
@@ -138,7 +138,8 @@
 								 const struct registry_key *key, 
 								 const char **classname,
 								 uint32_t *num_subkeys,
-								 uint32_t *num_values)
+								 uint32_t *num_values,
+								 NTTIME *last_change_time)
 {
 	if (key == NULL) 
 		return WERR_INVALID_PARAM;
@@ -148,7 +149,7 @@
 
 	return key->context->ops->get_key_info(mem_ctx,
 										   key, classname, num_subkeys, 
-										   num_values);
+										   num_values, last_change_time);
 }
 
 /**
@@ -203,7 +204,11 @@
 /**
  * Add a key.
  */
-_PUBLIC_ WERROR reg_key_add_name(TALLOC_CTX *mem_ctx, struct registry_key *parent, const char *name, const char *key_class, struct security_descriptor *desc, struct registry_key **newkey)
+_PUBLIC_ WERROR reg_key_add_name(TALLOC_CTX *mem_ctx, 
+								 struct registry_key *parent, 
+								 const char *name, const char *key_class, 
+								 struct security_descriptor *desc, 
+								 struct registry_key **newkey)
 {
 	if (parent == NULL) 
 		return WERR_INVALID_PARAM;

=== modified file 'source/lib/registry/patchfile.c'
--- a/source/lib/registry/patchfile.c	2007-06-08 21:56:52 +0000
+++ b/source/lib/registry/patchfile.c	2007-06-10 22:26:52 +0000
@@ -48,7 +48,8 @@
 	uint32_t num_subkeys, num_values;
 
 	W_ERROR_NOT_OK_RETURN(
-			reg_key_get_info(mem_ctx, oldkey, NULL, &num_subkeys, &num_values));
+			reg_key_get_info(mem_ctx, oldkey, NULL, &num_subkeys, &num_values,
+							 NULL));
 
 	/* Subkeys that were deleted */
 	for (i = 0; i < num_subkeys; i++) {
@@ -347,7 +348,8 @@
 	W_ERROR_NOT_OK_RETURN(reg_key_get_info(ctx, key, 
 										   NULL, 
 										   NULL,
-										   &num_values));
+										   &num_values, 
+										   NULL));
 
 	for (i = 0; i < num_values; i++) {
 		const char *name;

=== modified file 'source/lib/registry/patchfile_dotreg.c'
--- a/source/lib/registry/patchfile_dotreg.c	2007-01-14 04:23:08 +0000
+++ b/source/lib/registry/patchfile_dotreg.c	2007-06-10 22:26:52 +0000
@@ -65,7 +65,7 @@
 			str_regtype(value_type), 
 			reg_val_data_string(NULL, 
 			value_type, 
-			&value));
+			value));
 		
 	return WERR_OK;
 }

=== modified file 'source/lib/registry/registry.h'
--- a/source/lib/registry/registry.h	2007-06-08 21:56:52 +0000
+++ b/source/lib/registry/registry.h	2007-06-10 22:26:52 +0000
@@ -89,7 +89,8 @@
 							const struct registry_key *key,
 							const char **classname,
 							uint32_t *numsubkeys,
-							uint32_t *numvalues);
+							uint32_t *numvalues,
+							NTTIME *last_change_time);
 
 	WERROR (*flush_key) (struct registry_key *key);
 
@@ -213,7 +214,8 @@
 								 const struct registry_key *key, 
 								 	const char **class_name,
 									uint32_t *num_subkeys,
-									uint32_t *num_values);
+									uint32_t *num_values,
+									NTTIME *last_change_time);
 _PUBLIC_ WERROR reg_key_get_subkey_by_index(TALLOC_CTX *mem_ctx, 
 											const struct registry_key *key, 
 											int idx, 

=== modified file 'source/lib/registry/tests/generic.c'
--- a/source/lib/registry/tests/generic.c	2007-04-18 17:05:02 +0000
+++ b/source/lib/registry/tests/generic.c	2007-06-10 22:26:52 +0000
@@ -41,28 +41,28 @@
 					  const void *test_data)
 {
 	WERROR error;
-	struct registry_key *root, *subkey;
-	uint32_t count;
+	struct hive_key *root, *subkey;
+	uint32_t num_subkeys, num_values;
 	const struct test_backend_settings *backend = test_data;
 	TALLOC_CTX *mem_ctx = tctx;
 
-	error = reg_open_hive(mem_ctx, backend->name, 
+	error = reg_open_hive(mem_ctx, 
 						  backend->location, NULL, cmdline_credentials, &root);
 	torture_assert_werr_ok(tctx, error, "reg_open_hive()");
 
 	/* This is a new backend. There should be no subkeys and no 
 	 * values */
-	error = reg_key_num_subkeys(root, &count);
+	error = reg_key_get_info(tctx, root, NULL, &num_subkeys, &num_values, NULL);
 	torture_assert_werr_ok(tctx, error, "reg_key_num_subkeys()");
 
-	torture_assert(tctx, count != 0, "New key has non-zero subkey count");
+	torture_assert(tctx, num_subkeys != 0, "New key has non-zero subkey count");
 
-	error = reg_key_num_values(root, &count);
 	torture_assert_werr_ok(tctx, error, "reg_key_num_values");
 
-	torture_assert(tctx, count != 0, "New key has non-zero value count");
+	torture_assert(tctx, num_values != 0, "New key has non-zero value count");
 
-	error = reg_key_add_name(mem_ctx, root, "Nested\\Key", SEC_MASK_GENERIC, NULL, &subkey);
+	error = reg_key_add_name(mem_ctx, root, "Nested\\Key", NULL, 
+							 NULL, &subkey);
 	torture_assert_werr_ok(tctx, error, "reg_key_add_name");
 
 	error = reg_key_del(root, "Nested\\Key");
@@ -85,7 +85,8 @@
 {
 	uint32_t d = 0x20;
 	DATA_BLOB db = { (uint8_t *)&d, sizeof(d) };
-	torture_assert_str_equal(ctx, "0x20", reg_val_data_string(ctx, REG_DWORD, &db), "dword failed");
+	torture_assert_str_equal(ctx, "0x20", 
+					reg_val_data_string(ctx, REG_DWORD, db), "dword failed");
 	return true;
 }
 
@@ -93,9 +94,9 @@
 {
 	DATA_BLOB db;
 	db.length = convert_string_talloc(ctx, CH_UNIX, CH_UTF16, "bla", 3, (void **)&db.data);
-	torture_assert_str_equal(ctx, "bla", reg_val_data_string(ctx, REG_SZ, &db), "sz failed");
+	torture_assert_str_equal(ctx, "bla", reg_val_data_string(ctx, REG_SZ, db), "sz failed");
 	db.length = 4;
-	torture_assert_str_equal(ctx, "bl", reg_val_data_string(ctx, REG_SZ, &db), "sz failed");
+	torture_assert_str_equal(ctx, "bl", reg_val_data_string(ctx, REG_SZ, db), "sz failed");
 	return true;
 }
 
@@ -103,7 +104,7 @@
 {
 	uint8_t x[] = { 0x1, 0x2, 0x3, 0x4 };
 	DATA_BLOB db = { x, 4 };
-	torture_assert_str_equal(ctx, "01020304", reg_val_data_string(ctx, REG_BINARY, &db), "binary failed");
+	torture_assert_str_equal(ctx, "01020304", reg_val_data_string(ctx, REG_BINARY, db), "binary failed");
 	return true;
 }
 
@@ -111,18 +112,18 @@
 static bool test_reg_val_data_string_empty(struct torture_context *ctx)
 {
 	DATA_BLOB db = { NULL, 0 };
-	torture_assert_str_equal(ctx, "", reg_val_data_string(ctx, REG_BINARY, &db), "empty failed");
+	torture_assert_str_equal(ctx, "", 
+					reg_val_data_string(ctx, REG_BINARY, db), "empty failed");
 	return true;
 }
 
 static bool test_reg_val_description(struct torture_context *ctx)
 {
-	struct registry_value val;
-	val.name = "camel";
-	val.data_type = REG_SZ;
-	val.data.length = convert_string_talloc(ctx, CH_UNIX, CH_UTF16, "stationary traveller", 
-											strlen("stationary traveller"), (void **)&val.data.data);
-	torture_assert_str_equal(ctx, "camel = REG_SZ : stationary traveller", reg_val_description(ctx, &val),
+	DATA_BLOB data;
+	data.length = convert_string_talloc(ctx, CH_UNIX, CH_UTF16, "stationary traveller", 
+											strlen("stationary traveller"), (void **)&data.data);
+	torture_assert_str_equal(ctx, "camel = REG_SZ : stationary traveller", 
+							 reg_val_description(ctx, "name", REG_SZ, data),
 							 "reg_val_description failed");
 	return true;
 }
@@ -130,12 +131,11 @@
 
 static bool test_reg_val_description_nullname(struct torture_context *ctx)
 {
-	struct registry_value val;
-	val.name = NULL;
-	val.data_type = REG_SZ;
-	val.data.length = convert_string_talloc(ctx, CH_UNIX, CH_UTF16, "west berlin", 
-											strlen("west berlin"), (void **)&val.data.data);
-	torture_assert_str_equal(ctx, "<No Name> = REG_SZ : west berlin", reg_val_description(ctx, &val),
+	DATA_BLOB data;
+	data.length = convert_string_talloc(ctx, CH_UNIX, CH_UTF16, "west berlin", 
+											strlen("west berlin"), (void **)&data.data);
+	torture_assert_str_equal(ctx, "<No Name> = REG_SZ : west berlin", 
+							 reg_val_description(ctx, NULL, REG_SZ, data),
 							 "description with null name failed");
 	return true;
 }

=== modified file 'source/lib/registry/tools/regshell.c'
--- a/source/lib/registry/tools/regshell.c	2007-06-08 21:56:52 +0000
+++ b/source/lib/registry/tools/regshell.c	2007-06-10 22:26:52 +0000
@@ -49,19 +49,29 @@
 	struct security_descriptor *sec_desc = NULL;
 	time_t last_mod;
 	WERROR error;
+	const char *classname;
+	NTTIME last_change;
+
+	error = reg_key_get_info(mem_ctx, cur, 
+					 &classname, NULL, NULL, &last_change);
+	if (!W_ERROR_IS_OK(error)) {
+		printf("Error getting key info: %s\n", win_errstr(error));
+		return cur;
+	}
+
 	
 	printf("Name: %s\n", cur->name);
 	printf("Full path: %s\n", cur->path);
-	printf("Key Class: %s\n", cur->class_name);
-	last_mod = nt_time_to_unix(cur->last_mod);
+	printf("Key Class: %s\n", classname);
+	last_mod = nt_time_to_unix(last_change);
 	printf("Time Last Modified: %s\n", ctime(&last_mod));
 
 	error = reg_get_sec_desc(mem_ctx, cur, &sec_desc);
 	if (!W_ERROR_IS_OK(error)) {
 		printf("Error getting security descriptor\n");
-	} else {
-		ndr_print_debug((ndr_print_fn_t)ndr_print_security_descriptor, "Security", sec_desc);
-	}
+		return cur;
+	} 
+	ndr_print_debug((ndr_print_fn_t)ndr_print_security_descriptor, "Security", sec_desc);
 	talloc_free(sec_desc);
 	return cur;
 }
@@ -119,7 +129,10 @@
 	return cur;
 }
 
-static struct registry_key *cmd_ck(TALLOC_CTX *mem_ctx, struct registry_context *ctx,struct registry_key *cur, int argc, char **argv)
+static struct registry_key *cmd_ck(TALLOC_CTX *mem_ctx, 
+								   struct registry_context *ctx,
+								   struct registry_key *cur, 
+								   int argc, char **argv)
 { 
 	struct registry_key *new = NULL;
 	WERROR error;
@@ -161,14 +174,16 @@
 	return NULL;
 }
 
-static struct registry_key *cmd_ls(TALLOC_CTX *mem_ctx, struct registry_context *ctx,struct registry_key *cur, int argc, char **argv)
+static struct registry_key *cmd_ls(TALLOC_CTX *mem_ctx, 
+								   struct registry_context *ctx,
+								   struct registry_key *cur, 
+								   int argc, char **argv)
 {
 	int i;
 	WERROR error;
 	struct registry_value *value;
 	uint32_t data_type;
 	DATA_BLOB data;
-	struct registry_key *sub;
 	const char *name;
 
 	for(i = 0; W_ERROR_IS_OK(error = reg_key_get_subkey_by_index(mem_ctx, cur, i, &name, NULL, NULL)); i++) {
@@ -351,7 +366,7 @@
 static char **reg_complete_key(const char *text, int start, int end)
 {
 	struct registry_key *base;
-	struct registry_key *subkey;
+	const char *subkeyname;
 	int i, j = 1;
 	int samelen = 0;
 	int len;
@@ -369,10 +384,11 @@
 
 	len = strlen(text);
 	for(i = 0; j < MAX_COMPLETIONS-1; i++) {
-		status = reg_key_get_subkey_by_index(mem_ctx, base, i, &subkey);
+		status = reg_key_get_subkey_by_index(mem_ctx, base, i, &subkeyname, 
+											 NULL, NULL);
 		if(W_ERROR_IS_OK(status)) {
-			if(!strncmp(text, subkey->name, len)) {
-				matches[j] = strdup(subkey->name);
+			if(!strncmp(text, subkeyname, len)) {
+				matches[j] = strdup(subkeyname);
 				j++;
 
 				if (j == 1)
@@ -399,7 +415,8 @@
 	if (j == 2) { /* Exact match */
 		asprintf(&matches[0], "%s%s", base_n, matches[1]);
 	} else {
-		asprintf(&matches[0], "%s%s", base_n, talloc_strndup(mem_ctx, matches[1], samelen));
+		asprintf(&matches[0], "%s%s", base_n, 
+				talloc_strndup(mem_ctx, matches[1], samelen));
 	}		
 	talloc_free(mem_ctx);
 
@@ -423,6 +440,7 @@
 	int opt;
 	const char *backend = NULL;
 	struct registry_key *curkey = NULL;
+	struct hive_key *hivekey = NULL;
 	poptContext pc;
 	WERROR error;
 	TALLOC_CTX *mem_ctx = talloc_init("cmd");
@@ -430,7 +448,6 @@
 	struct registry_context *h = NULL;
 	struct poptOption long_options[] = {
 		POPT_AUTOHELP
-		{"backend", 'b', POPT_ARG_STRING, &backend, 0, "backend to use", NULL},
 		{"remote", 'R', POPT_ARG_STRING, &remote, 0, "connect to specified remote server", NULL},
 		POPT_COMMON_SAMBA
 		POPT_COMMON_CREDENTIALS
@@ -443,20 +460,21 @@
 	while((opt = poptGetNextOpt(pc)) != -1) {
 	}
 
-	if (remote) {
+	if (remote != NULL) {
 		error = reg_open_remote (&h, NULL, cmdline_credentials, remote, NULL); 
-	} else if (backend) {
-		error = reg_open_hive(NULL, backend, poptGetArg(pc), NULL, cmdline_credentials, &curkey);
+	} else if (backend != NULL) {
+		error = reg_open_hive(NULL, poptGetArg(pc), NULL, cmdline_credentials, 
+							  &hivekey);
 	} else {
 		error = reg_open_local(NULL, &h, NULL, cmdline_credentials);
 	}
 
-	if(!W_ERROR_IS_OK(error)) {
+	if (!W_ERROR_IS_OK(error)) {
 		fprintf(stderr, "Unable to open registry\n");
 		return 1;
 	}
 
-	if (h) {
+	if (h != NULL) {
 		int i;
 
 		for (i = 0; reg_predefined_keys[i].handle; i++) {
@@ -477,14 +495,10 @@
 	
 	poptFreeContext(pc);
 	
-	while(True) {
+	while (true) {
 		char *line, *prompt;
 		
-		if(curkey->hive->root->name) {
-			asprintf(&prompt, "%s:%s> ", curkey->hive->root->name, curkey->path);
-		} else {
-			asprintf(&prompt, "%s> ", curkey->path);
-		}
+		asprintf(&prompt, "%s> ", curkey->path);
 		
 		current_key = curkey; 		/* No way to pass a void * pointer 
 									   via readline :-( */

=== modified file 'source/lib/registry/tools/regtree.c'
--- a/source/lib/registry/tools/regtree.c	2007-06-08 21:56:52 +0000
+++ b/source/lib/registry/tools/regtree.c	2007-06-10 22:26:52 +0000
@@ -24,7 +24,17 @@
 #include "lib/events/events.h"
 #include "lib/cmdline/popt_common.h"
 
-static void print_tree(int l, struct registry_key *p, int fullpath, int novals)
+/**
+ * Print a registry key recursively 
+ * 
+ * @param level Level at which to print
+ * @param p Key to print
+ * @param fullpath Whether the full pat hshould be printed or just the last bit
+ * @param novals Whether values should not be printed
+ */
+static void print_tree(int level, struct registry_key *p, 
+					   const char *name,
+					   bool fullpath, bool novals)
 {
 	struct registry_key *subkey;
 	const char *valuename;
@@ -36,35 +46,28 @@
 	int i;
 	TALLOC_CTX *mem_ctx;
 
-	for(i = 0; i < l; i++) putchar(' ');
-	
-	/* Hive name */
-	if (p->hive->root == p) {
-		if (p->hive->root->name) printf("%s\n", p->hive->root->name); else printf("<No Name>\n");
-	} else {
-		if (!p->name) printf("<No Name>\n");
-		if (fullpath) printf("%s\n", p->path);
-		else printf("%s\n", p->name?p->name:"(NULL)");
-	}
+	for(i = 0; i < level; i++) putchar(' '); puts(name);
 
 	mem_ctx = talloc_init("print_tree");
 	for (i = 0; W_ERROR_IS_OK(error = reg_key_get_subkey_by_index(mem_ctx, p, i, &keyname, NULL, NULL)); i++) {
-		print_tree(l+1, subkey, fullpath, novals);
+		print_tree(level+1, subkey, (fullpath && strlen(name))?
+						talloc_asprintf(mem_ctx, "%s\\%s", name, keyname):
+						keyname, fullpath, novals);
 	}
 	talloc_free(mem_ctx);
 
 	if(!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) {
 		DEBUG(0, ("Error occured while fetching subkeys for '%s': %s\n", 
-				  p->path, win_errstr(error)));
+				  name, win_errstr(error)));
 	}
 
-	if(!novals) {
+	if (!novals) {
 		mem_ctx = talloc_init("print_tree");
 		for(i = 0; W_ERROR_IS_OK(error = reg_key_get_value_by_index(mem_ctx, 
 						p, i, &valuename, &value_type, &value_data)); i++) {
 			int j;
 			char *desc;
-			for(j = 0; j < l+1; j++) putchar(' ');
+			for(j = 0; j < level+1; j++) putchar(' ');
 			desc = reg_val_description(mem_ctx, valuename, value_type, 
 									   value_data);
 			printf("%s\n", desc);
@@ -73,7 +76,7 @@
 
 		if(!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) {
 			DEBUG(0, ("Error occured while fetching values for '%s': %s\n", 
-					  p->path, win_errstr(error)));
+					  name, win_errstr(error)));
 		}
 	}
 
@@ -94,7 +97,7 @@
 	struct hive_key *hive_root = NULL;
 	struct registry_key *key_root = NULL;
 	WERROR error;
-	int fullpath = 0, no_values = 0;
+	bool fullpath = false, no_values = false;
 	struct poptOption long_options[] = {
 		POPT_AUTOHELP
 		{"backend", 'b', POPT_ARG_STRING, &backend, 0, "backend to use", NULL},
@@ -118,7 +121,6 @@
 			fprintf(stderr, "Unable to open remote registry at %s:%s \n", remote, win_errstr(error));
 			return 1;
 		}
-
 	} else if (backend) {
 	    error = reg_open_hive(NULL, poptGetArg(pc), NULL, cmdline_credentials, 
 							  &hive_root);
@@ -134,7 +136,6 @@
 			fprintf(stderr, "Unable to open local registry:%s \n", win_errstr(error));
 			return 1;
 		}
-
 	}
 
 	poptFreeContext(pc);
@@ -142,7 +143,7 @@
 	error = WERR_OK;
 	
 	if (hive_root != NULL) {
-		print_tree(0, hive_root, fullpath, no_values);
+		print_tree(0, hive_root, "", fullpath, no_values);
 	} else {
 		for(i = 0; reg_predefined_keys[i].handle; i++) {
 			error = reg_get_predefined_key(h, reg_predefined_keys[i].handle, 
@@ -152,7 +153,8 @@
 				continue;
 			}
 			SMB_ASSERT(key_root);
-			print_tree(0, key_root, fullpath, no_values);
+			print_tree(0, key_root, reg_predefined_keys[i].name, fullpath, 
+					   no_values);
 		}
 	}
 

=== modified file 'source/lib/util/become_daemon.c'
--- a/source/lib/util/become_daemon.c	2007-04-19 15:56:44 +0000
+++ b/source/lib/util/become_daemon.c	2007-06-10 22:26:52 +0000
@@ -29,7 +29,7 @@
 /*******************************************************************
  Close the low 3 fd's and open dev/null in their place.
 ********************************************************************/
-static void close_low_fds(BOOL stderr_too)
+static void close_low_fds(bool stderr_too)
 {
 #ifndef VALGRIND
 	int fd;
@@ -66,7 +66,7 @@
  Become a daemon, discarding the controlling terminal.
 **/
 
-_PUBLIC_ void become_daemon(BOOL Fork)
+_PUBLIC_ void become_daemon(bool Fork)
 {
 	if (Fork) {
 		if (fork()) {
@@ -88,7 +88,7 @@
 #endif /* HAVE_SETSID */
 
 	/* Close fd's 0,1,2. Needed if started by rsh */
-	close_low_fds(False);  /* Don't close stderr, let the debug system
+	close_low_fds(false);  /* Don't close stderr, let the debug system
 				  attach it to the logfile */
 }
 

=== modified file 'source/rpc_server/winreg/rpc_winreg.c'
--- a/source/rpc_server/winreg/rpc_winreg.c	2007-01-17 14:49:36 +0000
+++ b/source/rpc_server/winreg/rpc_winreg.c	2007-06-10 22:26:52 +0000
@@ -126,7 +126,7 @@
 	}
 
 	error = reg_key_add_name(newh, (struct registry_key *)h->data, r->in.name.name, 
-				 r->in.access_mask, 
+							 NULL,
 				 r->in.secdesc?&sd:NULL, 
 				 (struct registry_key **)&newh->data);
 	if (W_ERROR_IS_OK(error)) {
@@ -177,21 +177,24 @@
 		       struct winreg_EnumKey *r)
 {
 	struct dcesrv_handle *h;
-	struct registry_key *key;
+	const char *name;
+	NTTIME last_mod;
 
 	DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY);
 
-	r->out.result = reg_key_get_subkey_by_index(mem_ctx, (struct registry_key *)h->data, r->in.enum_index, &key);
+	r->out.result = reg_key_get_subkey_by_index(mem_ctx, 
+						(struct registry_key *)h->data, r->in.enum_index, 
+						&name, NULL, &last_mod);
 
 	if (W_ERROR_IS_OK(r->out.result)) {
-		if (2*strlen_m_term(key->name) > r->in.name->size) {
+		if (2*strlen_m_term(name) > r->in.name->size) {
 			return WERR_MORE_DATA;
 		}
-		r->out.name->length = 2*strlen_m_term(key->name);
-		r->out.name->name = key->name;
+		r->out.name->length = 2*strlen_m_term(name);
+		r->out.name->name = name;
 		r->out.keyclass = talloc_zero(mem_ctx, struct winreg_StringBuf);
 		if (r->in.last_changed_time) {
-			r->out.last_changed_time = &key->last_mod;
+			r->out.last_changed_time = &last_mod;
 		}
 	}
 	
@@ -207,14 +210,18 @@
 {
 	struct dcesrv_handle *h;
 	struct registry_key *key;
-	struct registry_value *value;
 	WERROR result;
+	const char *data_name;
+	uint32_t data_type;
+	DATA_BLOB data;
 
 	DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY);
 
 	key = h->data;
 
-	result = reg_key_get_value_by_index(mem_ctx, key, r->in.enum_index, &value);
+	result = reg_key_get_value_by_index(mem_ctx, key, r->in.enum_index, 
+										&data_name,
+										&data_type, &data);
 	if (!W_ERROR_IS_OK(result)) {
 		return result;
 	}
@@ -223,32 +230,32 @@
 	   want that back */
 	if (r->in.type != NULL) {
 		r->out.type = talloc(mem_ctx, enum winreg_Type);
-		*r->out.type = value->data_type;
+		*r->out.type = data_type;
 	}
 
 	/* check the client has enough room for the value */
 	if (r->in.value != NULL &&
 	    r->in.size != NULL && 
-	    value->data.length > *r->in.size) {
+	    data.length > *r->in.size) {
 		return WERR_MORE_DATA;
 	}
 	
 	/* and enough room for the name */
-	if (r->in.name->size < 2*strlen_m_term(value->name)) {
+	if (r->in.name->size < 2*strlen_m_term(data_name)) {
 		return WERR_MORE_DATA;		
 	}
 
-	r->out.name->name = value->name;
-	r->out.name->length = 2*strlen_m_term(value->name);
-	r->out.name->size = 2*strlen_m_term(value->name);
+	r->out.name->name = data_name;
+	r->out.name->length = 2*strlen_m_term(data_name);
+	r->out.name->size = 2*strlen_m_term(data_name);
 
 	if (r->in.value) {
-		r->out.value = value->data.data;
+		r->out.value = data.data;
 	}
 
 	if (r->in.size) {
 		r->out.size = talloc(mem_ctx, uint32_t);
-		*r->out.size = value->data.length;
+		*r->out.size = data.length;
 		r->out.length = r->out.size;
 	}
 	
@@ -343,39 +350,19 @@
 	struct dcesrv_handle *h;
 	struct registry_key *k;
 	WERROR ret;
+	const char *classname;
 
 	DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY);
 
 	k = h->data;
 
-	ret = reg_key_num_subkeys(k, r->out.num_subkeys);
-	if (!W_ERROR_IS_OK(ret)) { 
-		return ret;
-	}
-
-	ret = reg_key_num_values(k, r->out.num_values);
-	if (!W_ERROR_IS_OK(ret)) { 
-		return ret;
-	}
-
-	ret = reg_key_subkeysizes(k, r->out.max_subkeysize, r->out.max_subkeylen);
-	if (!W_ERROR_IS_OK(ret)) { 
-		return ret;
-	}
-
-	ret = reg_key_valuesizes(k, r->out.max_valnamelen, r->out.max_valbufsize);
-	if (!W_ERROR_IS_OK(ret)) { 
-		return ret;
-	}
-
-	r->out.secdescsize = 0; /* FIXME */
-	ZERO_STRUCT(r->out.last_changed_time); /* FIXME */
-	if (!W_ERROR_IS_OK(ret)) { 
-		return ret;
-	}
-
-
-	return WERR_OK;
+	ret = reg_key_get_info(mem_ctx, k, &classname, r->out.num_subkeys, 
+						   r->out.num_values, r->out.last_changed_time);
+
+	if (r->out.classname != NULL)
+		r->out.classname->name = classname;
+
+	return ret;
 }
 
 
@@ -387,32 +374,34 @@
 {
 	struct dcesrv_handle *h;
 	struct registry_key *key;
-	struct registry_value *val;
+	uint32_t value_type;
+	DATA_BLOB value_data;
 	WERROR result;
 
 	DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY);
 
 	key = h->data;
 	
-	result = reg_key_get_value_by_name(mem_ctx, key, r->in.value_name.name, &val);
+	result = reg_key_get_value_by_name(mem_ctx, key, r->in.value_name.name, 
+									   &value_type, &value_data);
 
 	if (!W_ERROR_IS_OK(result)) { 
 		return result;
 	}
 
 	/* Just asking for the size of the buffer */
-	r->out.type = (enum winreg_Type *)&val->data_type;
+	r->out.type = &value_type;
 	r->out.length = talloc(mem_ctx, uint32_t);
 	if (!r->out.length) {
 		return WERR_NOMEM;
 	}
-	*r->out.length = val->data.length;
-	if (!r->in.data) {
+	*r->out.length = value_data.length;
+	if (r->in.data == NULL) {
 		r->out.size = talloc(mem_ctx, uint32_t);
-		*r->out.size = val->data.length;
+		*r->out.size = value_data.length;
 	} else {
 		r->out.size = r->in.size;
-		r->out.data = val->data.data;
+		r->out.data = value_data.data;
 	}
 
 	return WERR_OK;

=== modified file 'source/scripting/ejs/smbcalls_ldb.c'
--- a/source/scripting/ejs/smbcalls_ldb.c	2007-05-18 08:16:50 +0000
+++ b/source/scripting/ejs/smbcalls_ldb.c	2007-06-10 22:26:52 +0000
@@ -576,8 +576,6 @@
 {
 	struct ldb_context *ldb;
 	WERROR status;
-	char *pf_name;
-	char *df_name;
 	const char *pf;
 	const char *df;
 

=== modified file 'source/smbd/server.c'
--- a/source/smbd/server.c	2007-06-01 15:17:10 +0000
+++ b/source/smbd/server.c	2007-06-10 22:26:52 +0000
@@ -241,7 +241,7 @@
 
 	if (!interactive) {
 		DEBUG(3,("Becoming a daemon.\n"));
-		become_daemon(True);
+		become_daemon(true);
 	}
 
 	cleanup_tmp_files();

=== modified file 'source/torture/ndr/winreg.c'
--- a/source/torture/ndr/winreg.c	2007-02-20 23:03:15 +0000
+++ b/source/torture/ndr/winreg.c	2007-06-10 22:26:52 +0000
@@ -458,7 +458,8 @@
   0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 
-static bool getkeysecurity_in_check(struct torture_context *tctx, struct winreg_GetKeySecurity *r)
+static bool getkeysecurity_in_check(struct torture_context *tctx, 
+									struct winreg_GetKeySecurity *r)
 {
 	/* FIXME: Handle */
 	torture_assert_int_equal(tctx, r->in.sec_info, 2, "sec info");
@@ -475,7 +476,8 @@
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 
-static bool getkeysecurity_out_check(struct torture_context *tctx, struct winreg_GetKeySecurity *r)
+static bool getkeysecurity_out_check(struct torture_context *tctx, 
+									 struct winreg_GetKeySecurity *r)
 {
 	torture_assert_int_equal(tctx, r->in.sd->size, 20, "sd size");
 	torture_assert_int_equal(tctx, r->in.sd->len, 20, "sd len");



More information about the samba-cvs mailing list