svn commit: samba r4213 - in branches/SAMBA_4_0/source: . lib/registry lib/registry/common rpc_server/winreg

jelmer at samba.org jelmer at samba.org
Wed Dec 15 02:27:22 GMT 2004


Author: jelmer
Date: 2004-12-15 02:27:22 +0000 (Wed, 15 Dec 2004)
New Revision: 4213

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

Log:
Store REG_SZ in UTF16, not the unix charset..

It is now possible to use the "Add..." button in the Security 
tab of the File Properties Dialog box.

Modified:
   branches/SAMBA_4_0/source/lib/registry/common/reg_util.c
   branches/SAMBA_4_0/source/lib/registry/reg_backend_nt4.c
   branches/SAMBA_4_0/source/registry.ldif
   branches/SAMBA_4_0/source/rpc_server/winreg/rpc_winreg.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/registry/common/reg_util.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/common/reg_util.c	2004-12-15 01:25:24 UTC (rev 4212)
+++ branches/SAMBA_4_0/source/lib/registry/common/reg_util.c	2004-12-15 02:27:22 UTC (rev 4213)
@@ -57,12 +57,11 @@
   if(v->data_len == 0) return talloc_strdup(mem_ctx, "");
 
   switch (v->data_type) {
+  case REG_EXPAND_SZ:
   case REG_SZ:
-	  return talloc_strndup(mem_ctx, v->data_blk, v->data_len);
+      convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, v->data_blk, v->data_len, (void **)&ret);
+	  return ret;
 
-  case REG_EXPAND_SZ:
-	  return talloc_strndup(mem_ctx, v->data_blk, v->data_len);
-
   case REG_BINARY:
 	  ret = talloc(mem_ctx, v->data_len * 3 + 2);
 	  asciip = ret;
@@ -120,8 +119,7 @@
 	{
 		case REG_SZ:
 		case REG_EXPAND_SZ:
-			(*value)->data_blk = talloc_strdup(mem_ctx, data_str);
-			(*value)->data_len = strlen(data_str);
+      		(*value)->data_len = convert_string_talloc(mem_ctx, CH_UNIX, CH_UTF16, data_str, strlen(data_str), &(*value)->data_blk);
 			break;
 		case REG_DWORD:
 			(*value)->data_len = sizeof(uint32);

Modified: branches/SAMBA_4_0/source/lib/registry/reg_backend_nt4.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/reg_backend_nt4.c	2004-12-15 01:25:24 UTC (rev 4212)
+++ branches/SAMBA_4_0/source/lib/registry/reg_backend_nt4.c	2004-12-15 02:27:22 UTC (rev 4213)
@@ -935,13 +935,6 @@
 		}
 
 
-		if(tmp->data_type == REG_SZ) {
-			char *ret;
-	    	dat_len = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, dtmp, dat_len, (void **)&ret);
-			dtmp = ret;
-		}
-
-
 		tmp->data_blk = dtmp;
 		tmp->data_len = dat_len;
 	}

Modified: branches/SAMBA_4_0/source/registry.ldif
===================================================================
--- branches/SAMBA_4_0/source/registry.ldif	2004-12-15 01:25:24 UTC (rev 4212)
+++ branches/SAMBA_4_0/source/registry.ldif	2004-12-15 02:27:22 UTC (rev 4213)
@@ -1,43 +1,29 @@
-# editing 10 records
-# record 1
 dn: key=control,key=currentcontrolset,key=system,hive=
 key: control
 
-# record 2
 dn: key=services,key=control,key=currentcontrolset,key=system,hive=
 key: services
 
-# record 3
 dn: value=ProductType,key=productoptions,key=control,key=currentcontrolset,key=system,hive=
 value: ProductType
-data: WinNT
+data:: VwBpAG4ATgBUAA=
 type: 1
 
-# record 4
 dn: key=productoptions,key=control,key=currentcontrolset,key=system,hive=
 key: productoptions
 
-# record 5
 dn: key=system,hive=
 key: system
 
-# record 6
-dn: @BASEINFO
-sequenceNumber: 13
-
-# record 7
 dn: key=netlogon,key=services,key=currentcontrolset,key=system,hive=
 key: netlogon
 
-# record 8
 dn: key=services,key=currentcontrolset,key=system,hive=
 key: services
 
-# record 9
 dn: key=print,key=control,key=currentcontrolset,key=system,hive=
 key: print
 
-# record 10
 dn: key=currentcontrolset,key=system,hive=
 key: currentcontrolset
 

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-15 01:25:24 UTC (rev 4212)
+++ branches/SAMBA_4_0/source/rpc_server/winreg/rpc_winreg.c	2004-12-15 02:27:22 UTC (rev 4213)
@@ -360,10 +360,16 @@
 		return result;
 	}
 
+	/* Just asking for the size of the buffer */
 	r->out.type = &val->data_type;
-	r->out.size = r->in.size;
 	r->out.length = &val->data_len;
-	r->out.data = val->data_blk;
+	if (!r->in.data) {
+		r->out.size = talloc_p(mem_ctx, uint32);
+		*r->out.size = val->data_len;
+	} else {
+		r->out.size = r->in.size;
+		r->out.data = val->data_blk;
+	}
 
 	return WERR_OK;
 }



More information about the samba-cvs mailing list