Merge branch 'master' of ssh://git.samba.org/data/git/samba
authorAndrew Tridgell <tridge@samba.org>
Sun, 25 Oct 2009 12:14:56 +0000 (23:14 +1100)
committerAndrew Tridgell <tridge@samba.org>
Sun, 25 Oct 2009 12:14:56 +0000 (23:14 +1100)
source4/lib/ldb/common/ldb_dn.c
source4/lib/ldb/ldb_tdb/ldb_index.c

index 2ba17b2a6b29595279a4d34ca35f916af4ae7385..639e8b2837f003f85046b9807dc521b5b4d3cd8a 100644 (file)
@@ -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 '<':
index 252154ffd921041938393552e43facd5f99ad384..5002de527bf35ccc42e85cb0d1a64a7f57f7e0d5 100644 (file)
@@ -401,10 +401,6 @@ static struct ldb_dn *ltdb_index_key(struct ldb_context *ldb,
        if (ldb_should_b64_encode(ldb, &v)) {
                char *vstr = ldb_base64_encode(ldb, (char *)v.data, v.length);
                if (!vstr) return NULL;
-               /* remove trailing '=' to make it a valid DN */
-               if (vstr[strlen(vstr)-1] == '=') {
-                       vstr[strlen(vstr)-1] = 0;
-               }
                ret = ldb_dn_new_fmt(ldb, ldb, "%s:%s::%s", LTDB_INDEX, attr_folded, vstr);
                talloc_free(vstr);
        } else {