summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common/ldb_dn.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-10-25 22:02:31 +1100
committerAndrew Tridgell <tridge@samba.org>2009-10-25 22:02:31 +1100
commit12c9af78179b71721e30b03ae9fc0edd7cda940b (patch)
treeb17ce216dbd3a58e2d263f843774964015d0bda5 /source4/lib/ldb/common/ldb_dn.c
parent54bd30f70632b8fcbe164133d2479092b7262a29 (diff)
downloadsamba-12c9af78179b71721e30b03ae9fc0edd7cda940b.tar.gz
samba-12c9af78179b71721e30b03ae9fc0edd7cda940b.tar.bz2
samba-12c9af78179b71721e30b03ae9fc0edd7cda940b.zip
s4-ldb: allow for unescaped '=' in a index DN
The ldb_dn_explode code normally enforces all special characters, including a '=', must be escaped. Unfortunately this conflicts with the ltdb index DNs, which for binary attributes may be base64 encoded. This allows a unescaped '=' as a special case for index DNs.
Diffstat (limited to 'source4/lib/ldb/common/ldb_dn.c')
-rw-r--r--source4/lib/ldb/common/ldb_dn.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c
index 2ba17b2a6b..639e8b2837 100644
--- a/source4/lib/ldb/common/ldb_dn.c
+++ b/source4/lib/ldb/common/ldb_dn.c
@@ -439,6 +439,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
unsigned x;
int l, ret;
char *parse_dn;
+ bool is_index;
if ( ! dn || dn->invalid) return false;
@@ -456,6 +457,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
return false;
}
+ is_index = (strncmp(parse_dn, "DN=@INDEX:", 10) == 0);
if (strncmp(parse_dn, "B:", 2) == 0) {
parse_dn = strchr(parse_dn, ':');
@@ -765,6 +767,17 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
continue;
case '=':
+ /* to main compatibility with earlier
+ versions of ldb indexing, we have to
+ accept the base64 encoded binary index
+ values, which contain a '=' */
+ if (is_index) {
+ if ( t ) t = NULL;
+ *d++ = *p++;
+ l++;
+ break;
+ }
+ /* fall through */
case '\n':
case '+':
case '<':