s4:dsdb Allow a binary prefix map to be specified in the LDIF
authorAndrew Bartlett <abartlet@samba.org>
Wed, 9 Jun 2010 22:51:30 +0000 (08:51 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 12 Jun 2010 01:17:59 +0000 (11:17 +1000)
This allows it to be specified in either binary or as a string.

Andrew Bartlett

source4/lib/ldb-samba/ldif_handlers.c

index 91abefcacec4a03fd595b7e7ee47eacc68ba105e..f335d6c4c9073ef47052445b6c54df36c0f303a5 100644 (file)
@@ -526,6 +526,20 @@ static int ldif_read_prefixMap(struct ldb_context *ldb, void *mem_ctx,
                return -1;
        }
 
+       ndr_err = ndr_pull_struct_blob(in, blob, blob,
+                                      (ndr_pull_flags_fn_t)ndr_pull_prefixMapBlob);
+       if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               ndr_err = ndr_push_struct_blob(out, mem_ctx,
+                                              blob,
+                                              (ndr_push_flags_fn_t)ndr_push_prefixMapBlob);
+               talloc_free(tmp_ctx);
+               if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+                       return -1;
+               }
+               return 0;
+       }
+
+       /* If this does not parse, then it is probably the text version, and we should try it that way */
        blob->version = PREFIX_MAP_VERSION_DSDB;
        
        string = talloc_strndup(mem_ctx, (const char *)in->data, in->length);