diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-10-02 13:03:40 -0700 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-10-02 21:11:52 -0700 |
commit | e36f20d39dae2f20ebfcf8be156963e10e150066 (patch) | |
tree | 04ed097c96914fede7d32d05e204379a0f1608b5 /source4 | |
parent | 87f0145d078d1598c9889e2cc2942e654794ae4a (diff) | |
download | samba-e36f20d39dae2f20ebfcf8be156963e10e150066.tar.gz samba-e36f20d39dae2f20ebfcf8be156963e10e150066.tar.bz2 samba-e36f20d39dae2f20ebfcf8be156963e10e150066.zip |
s4-ldif: get rid of the ndr_pull_error message on startup
detect if the prefixmap blob is text or binary using the first 4 bytes
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/ldb-samba/ldif_handlers.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/source4/lib/ldb-samba/ldif_handlers.c b/source4/lib/ldb-samba/ldif_handlers.c index 1c366104c0..324209b836 100644 --- a/source4/lib/ldb-samba/ldif_handlers.c +++ b/source4/lib/ldb-samba/ldif_handlers.c @@ -527,17 +527,22 @@ static int ldif_read_prefixMap(struct ldb_context *ldb, void *mem_ctx, return -1; } - ndr_err = ndr_pull_struct_blob(in, tmp_ctx, 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; + /* use the switch value to detect if this is in the binary + * format + */ + if (in->length >= 4 && IVAL(in->data, 0) == PREFIX_MAP_VERSION_DSDB) { + ndr_err = ndr_pull_struct_blob(in, tmp_ctx, 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; } - return 0; } /* If this does not parse, then it is probably the text version, and we should try it that way */ |