svn commit: samba r12748 - in branches/SAMBA_4_0/source/lib/ldb/common: .

idra at samba.org idra at samba.org
Fri Jan 6 21:39:37 GMT 2006


Author: idra
Date: 2006-01-06 21:39:37 +0000 (Fri, 06 Jan 2006)
New Revision: 12748

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

Log:

Fix wrong handling of separation characters for RDNs
allow escaped separation chars as part of the attr value
of an RDN


Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.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	2006-01-06 21:20:09 UTC (rev 12747)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c	2006-01-06 21:39:37 UTC (rev 12748)
@@ -214,8 +214,8 @@
 
 static char *seek_to_separator(char *string, const char *separators)
 {
-	char *p;
-	int ret, qs, qe;
+	char *p, *q;
+	int ret, qs, qe, escaped;
 
 	if (string == NULL || separators == NULL) return NULL;
 
@@ -242,11 +242,21 @@
 	}
 
 	/* no quotes found seek to separators */
-	ret = strcspn(p, separators);
-	if (ret == 0) /* no separators ?! bail out */
+	q = p;
+	do {
+		escaped = 0;
+		ret = strcspn(q, separators);
+		
+		if (q[ret - 1] == '\\') {
+			escaped = 1;
+			q = q + ret + 1;
+		}
+	} while (escaped);
+
+	if (ret == 0 && p == q) /* no separators ?! bail out */
 		return NULL;
 
-	return p + ret;
+	return q + ret;
 
 failed:
 	return NULL;



More information about the samba-cvs mailing list