svn commit: samba r9387 - in branches/SAMBA_4_0/source/lib: ldb/common ldb/include registry

tridge at samba.org tridge at samba.org
Thu Aug 18 11:15:16 GMT 2005


Author: tridge
Date: 2005-08-18 11:15:15 +0000 (Thu, 18 Aug 2005)
New Revision: 9387

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

Log:
regedit uses "New Key #nn" for newly created keys, which conflicts with the stricter
DN rules in ldb. Escape the DN components to cope.

Simo, sorry for making a change in ldb_dn.c while you have changes
pending. Please feel free to revert these and switch reg_backend_ldb.c
to use the new dn construction code.

Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c
   branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
   branches/SAMBA_4_0/source/lib/registry/reg_backend_ldb.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c	2005-08-18 10:58:05 UTC (rev 9386)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c	2005-08-18 11:15:15 UTC (rev 9387)
@@ -56,7 +56,7 @@
 	return 1;
 }
 
-static char *ldb_dn_escape_value(void *mem_ctx, struct ldb_val value)
+char *ldb_dn_escape_value(void *mem_ctx, struct ldb_val value)
 {
 	const char *p, *s, *src;
 	char *d, *dst;

Modified: branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/include/ldb.h	2005-08-18 10:58:05 UTC (rev 9386)
+++ branches/SAMBA_4_0/source/lib/ldb/include/ldb.h	2005-08-18 11:15:15 UTC (rev 9387)
@@ -342,6 +342,7 @@
 
 int ldb_dn_cmp(struct ldb_context *ldb, const char *dn1, const char *dn2);
 int ldb_attr_cmp(const char *dn1, const char *dn2);
+char *ldb_dn_escape_value(void *mem_ctx, struct ldb_val value);
 
 /* case-fold a DN */
 char *ldb_dn_fold(void * mem_ctx,

Modified: branches/SAMBA_4_0/source/lib/registry/reg_backend_ldb.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/reg_backend_ldb.c	2005-08-18 10:58:05 UTC (rev 9386)
+++ branches/SAMBA_4_0/source/lib/registry/reg_backend_ldb.c	2005-08-18 11:15:15 UTC (rev 9387)
@@ -126,12 +126,24 @@
 	while(mypath) {
 		char *keyname;
 		begin = strrchr(mypath, '\\');
+		struct ldb_val val;
+		char *key;
 
-		if(begin) keyname = begin + 1;
+		if (begin) keyname = begin + 1;
 		else keyname = mypath;
 
-		if(strlen(keyname))
-			ret = talloc_asprintf_append(ret, "key=%s,", keyname);
+		val.data = keyname;
+		val.length = strlen(keyname);
+		
+		key = ldb_dn_escape_value(mem_ctx, val);
+		if (key == NULL) {
+			return NULL;
+		}
+
+		if (strlen(key))
+			ret = talloc_asprintf_append(ret, "key=%s,", key);
+
+		talloc_free(key);
 			
 		if(begin) {
 			*begin = '\0';



More information about the samba-cvs mailing list