summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-01-06 21:39:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:49:49 -0500
commit528470d4a74b1e2068fdc98b62076e8b19db47fc (patch)
tree10350ce3be2d45c795ade94e5731f9f12f96ab8f /source4/lib
parent66700b484f674d66692f4a5a498f511f69db7faa (diff)
downloadsamba-528470d4a74b1e2068fdc98b62076e8b19db47fc.tar.gz
samba-528470d4a74b1e2068fdc98b62076e8b19db47fc.tar.bz2
samba-528470d4a74b1e2068fdc98b62076e8b19db47fc.zip
r12748: Fix wrong handling of separation characters for RDNs
allow escaped separation chars as part of the attr value of an RDN (This used to be commit 7ba341d6c3745cd99c4c79933f9bd54f41e12a9c)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/common/ldb_dn.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c
index 5ed54ae316..4164814f4f 100644
--- a/source4/lib/ldb/common/ldb_dn.c
+++ b/source4/lib/ldb/common/ldb_dn.c
@@ -214,8 +214,8 @@ failed:
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 @@ static char *seek_to_separator(char *string, const char *separators)
}
/* 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;