svn commit: samba r4166 - in branches/SAMBA_4_0/source: include lib/registry lib/registry/common lib/registry/tools rpc_server/winreg

jelmer at samba.org jelmer at samba.org
Mon Dec 13 00:45:30 GMT 2004


Author: jelmer
Date: 2004-12-13 00:45:29 +0000 (Mon, 13 Dec 2004)
New Revision: 4166

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

Log:
More small API fixes, keep registry structs as small as possible.
Implement DelValue in the RPC server

Modified:
   branches/SAMBA_4_0/source/include/registry.h
   branches/SAMBA_4_0/source/lib/registry/common/reg_interface.c
   branches/SAMBA_4_0/source/lib/registry/reg_backend_dir.c
   branches/SAMBA_4_0/source/lib/registry/reg_backend_ldb.c
   branches/SAMBA_4_0/source/lib/registry/reg_backend_rpc.c
   branches/SAMBA_4_0/source/lib/registry/reg_backend_w95.c
   branches/SAMBA_4_0/source/lib/registry/tools/regpatch.c
   branches/SAMBA_4_0/source/lib/registry/tools/regshell.c
   branches/SAMBA_4_0/source/rpc_server/winreg/rpc_winreg.c


Changeset:
Modified: branches/SAMBA_4_0/source/include/registry.h
===================================================================
--- branches/SAMBA_4_0/source/include/registry.h	2004-12-12 11:30:30 UTC (rev 4165)
+++ branches/SAMBA_4_0/source/include/registry.h	2004-12-13 00:45:29 UTC (rev 4166)
@@ -75,10 +75,8 @@
   const char *path;		  /* Full path to the key */
   char *class_name; /* Name of key class */
   NTTIME last_mod; /* Time last modified                 */
-  SEC_DESC *security;
   struct registry_hive *hive;
   void *backend_data;
-  int ref;
 };
 
 struct registry_value {
@@ -86,10 +84,6 @@
   unsigned int data_type;
   int data_len;
   void *data_blk;    /* Might want a separate block */
-  struct registry_hive *hive;
-  struct registry_key *parent;
-  void *backend_data;
-  int ref;
 };
 
 /* FIXME */
@@ -142,7 +136,7 @@
 
 	/* Value management */
 	WERROR (*set_value)(struct registry_key *, const char *name, int type, void *data, int len); 
-	WERROR (*del_value)(struct registry_value *);
+	WERROR (*del_value)(struct registry_key *, const char *valname);
 };
 
 struct registry_hive {

Modified: branches/SAMBA_4_0/source/lib/registry/common/reg_interface.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/common/reg_interface.c	2004-12-12 11:30:30 UTC (rev 4165)
+++ branches/SAMBA_4_0/source/lib/registry/common/reg_interface.c	2004-12-13 00:45:29 UTC (rev 4166)
@@ -281,8 +281,6 @@
 		return WERR_NOT_SUPPORTED;
 	}
 	
-	(*val)->parent = key;
-	(*val)->hive = key->hive;
 	return WERR_OK;
 }
 
@@ -408,9 +406,6 @@
 	if(!W_ERROR_IS_OK(error) && !W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS))
 		return error;
 	
-	(*val)->parent = key;
-	(*val)->hive = key->hive;
-	
 	return WERR_OK;
 }
 
@@ -447,7 +442,7 @@
 		}
 
 		if(W_ERROR_IS_OK(error)) {
-			error = reg_del_value(val);
+			error = reg_del_value(key, val->name);
 			if(!W_ERROR_IS_OK(error)) {
 				talloc_destroy(mem_ctx);
 				return error;
@@ -564,13 +559,13 @@
 
 
 
-WERROR reg_del_value(struct registry_value *val)
+WERROR reg_del_value(struct registry_key *key, const char *valname)
 {
 	WERROR ret = WERR_OK;
-	if(!val->hive->functions->del_value)
+	if(!key->hive->functions->del_value)
 		return WERR_NOT_SUPPORTED;
 
-	ret = val->hive->functions->del_value(val);
+	ret = key->hive->functions->del_value(key, valname);
 
 	if(!W_ERROR_IS_OK(ret)) return ret;
 

Modified: branches/SAMBA_4_0/source/lib/registry/reg_backend_dir.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/reg_backend_dir.c	2004-12-12 11:30:30 UTC (rev 4165)
+++ branches/SAMBA_4_0/source/lib/registry/reg_backend_dir.c	2004-12-13 00:45:29 UTC (rev 4166)
@@ -120,27 +120,13 @@
 	return WERR_OK;
 }
 
-static WERROR reg_dir_set_value(struct registry_key *p, const char *name, int type, void *data, int len)
-{
-	/* FIXME */
-	return WERR_NOT_SUPPORTED;
-}
-
-static WERROR reg_dir_del_value(struct registry_value *v)
-{
-	/* FIXME*/
-	return WERR_NOT_SUPPORTED;
-}
-
 static struct hive_operations reg_backend_dir = {
 	.name = "dir",
 	.open_hive = reg_dir_open,
 	.open_key = reg_dir_open_key,
 	.add_key = reg_dir_add_key,
 	.del_key = reg_dir_del_key,
-	.get_subkey_by_index = reg_dir_key_by_index,
-	.set_value = reg_dir_set_value,
-	.del_value = reg_dir_del_value,
+	.get_subkey_by_index = reg_dir_key_by_index
 };
 
 NTSTATUS registry_dir_init(void)

Modified: branches/SAMBA_4_0/source/lib/registry/reg_backend_ldb.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/reg_backend_ldb.c	2004-12-12 11:30:30 UTC (rev 4165)
+++ branches/SAMBA_4_0/source/lib/registry/reg_backend_ldb.c	2004-12-13 00:45:29 UTC (rev 4166)
@@ -144,7 +144,7 @@
 	
 	*value = talloc_p(mem_ctx, struct registry_value);
 	(*value)->name = talloc_strdup(mem_ctx, el->values[0].data);
-	(*value)->backend_data = talloc_strdup(mem_ctx, kd->values[idx]->dn);
+	/* FIXME */
 
 	return WERR_OK;
 }

Modified: branches/SAMBA_4_0/source/lib/registry/reg_backend_rpc.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/reg_backend_rpc.c	2004-12-12 11:30:30 UTC (rev 4165)
+++ branches/SAMBA_4_0/source/lib/registry/reg_backend_rpc.c	2004-12-13 00:45:29 UTC (rev 4166)
@@ -218,7 +218,6 @@
 	if(NT_STATUS_IS_OK(status) && 
 	   W_ERROR_IS_OK(r.out.result) && r.out.length) {
 		*value = talloc_p(mem_ctx, struct registry_value);
-		(*value)->parent = parent;
 		(*value)->name = talloc_strdup(mem_ctx, r.out.name_out.name);
 		(*value)->data_type = type;
 		(*value)->data_len = *r.out.length;

Modified: branches/SAMBA_4_0/source/lib/registry/reg_backend_w95.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/reg_backend_w95.c	2004-12-12 11:30:30 UTC (rev 4165)
+++ branches/SAMBA_4_0/source/lib/registry/reg_backend_w95.c	2004-12-13 00:45:29 UTC (rev 4166)
@@ -332,7 +332,6 @@
 	}
 
 	*value = talloc_p(mem_ctx, struct registry_value);
-	(*value)->backend_data = curval;
 	(*value)->name = talloc_strndup(mem_ctx, (char *)curval+sizeof(RGDB_VALUE), curval->name_len);
 		
 	(*value)->data_len = curval->data_len;

Modified: branches/SAMBA_4_0/source/lib/registry/tools/regpatch.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/tools/regpatch.c	2004-12-12 11:30:30 UTC (rev 4165)
+++ branches/SAMBA_4_0/source/lib/registry/tools/regpatch.c	2004-12-13 00:45:29 UTC (rev 4166)
@@ -701,13 +701,9 @@
 
 		  while (cmd->val_count) {
 			  VAL_SPEC_LIST *val = cmd->val_spec_list;
-			  struct registry_value *reg_val = NULL;
 
 			  if (val->type == REG_DELETE) {
-				  error = reg_key_get_value_by_name( mem_ctx, tmp, val->name, &reg_val);
-				  if(W_ERROR_IS_OK(error)) {
-					  error = reg_del_value(reg_val);
-				  }
+				  error = reg_del_value(tmp, val->name);
 				  if(!W_ERROR_IS_OK(error)) {
 					DEBUG(0, ("Error removing value '%s'\n", val->name));
 				  }

Modified: branches/SAMBA_4_0/source/lib/registry/tools/regshell.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/tools/regshell.c	2004-12-12 11:30:30 UTC (rev 4165)
+++ branches/SAMBA_4_0/source/lib/registry/tools/regshell.c	2004-12-13 00:45:29 UTC (rev 4166)
@@ -142,18 +142,12 @@
 
 static struct registry_key *cmd_rmval(TALLOC_CTX *mem_ctx, struct registry_key *cur, int argc, char **argv)
 { 
-	struct registry_value *val;
 	if(argc < 2) {
 		fprintf(stderr, "Usage: rmval <valuename>\n");
 		return NULL;
 	}
 
-	if(!W_ERROR_IS_OK(reg_key_get_value_by_name(mem_ctx, cur, argv[1], &val))) {
-		fprintf(stderr, "No such value '%s'\n", argv[1]);
-		return NULL;
-	}
-
-	if(!W_ERROR_IS_OK(reg_del_value(val))) {
+	if(!W_ERROR_IS_OK(reg_del_value(cur, argv[1]))) {
 		fprintf(stderr, "Error deleting value '%s'\n", argv[1]);
 	} else {
 		fprintf(stderr, "Successfully deleted value '%s'\n", argv[1]);

Modified: branches/SAMBA_4_0/source/rpc_server/winreg/rpc_winreg.c
===================================================================
--- branches/SAMBA_4_0/source/rpc_server/winreg/rpc_winreg.c	2004-12-12 11:30:30 UTC (rev 4165)
+++ branches/SAMBA_4_0/source/rpc_server/winreg/rpc_winreg.c	2004-12-13 00:45:29 UTC (rev 4166)
@@ -149,16 +149,14 @@
 		       struct winreg_DeleteValue *r)
 {
 	struct dcesrv_handle *h;
-	struct registry_value *value;
+	struct registry_key *key;
 
-	h = dcesrv_handle_fetch(dce_call->conn, r->in.handle, HTYPE_REGVAL);
+	h = dcesrv_handle_fetch(dce_call->conn, r->in.handle, HTYPE_REGKEY);
 	DCESRV_CHECK_HANDLE(h);
 
-	value = h->data;
+	key = h->data;
 	
-	/* FIXME */
-
-	return WERR_NOT_SUPPORTED;
+	return reg_del_value(key, r->in.value.name);
 }
 
 



More information about the samba-cvs mailing list