diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-12-10 11:27:09 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-12-10 17:51:27 +1100 |
commit | 2493776f59f13ce20a39c0767bdfe85de6b0bdcd (patch) | |
tree | 39cfb29aa740df1c3c814cf04194da4586b12928 /source4/lib/ldb-samba | |
parent | d337cefa92e959a611027307e52118de787ab7f5 (diff) | |
download | samba-2493776f59f13ce20a39c0767bdfe85de6b0bdcd.tar.gz samba-2493776f59f13ce20a39c0767bdfe85de6b0bdcd.tar.bz2 samba-2493776f59f13ce20a39c0767bdfe85de6b0bdcd.zip |
s4-ldb: simplify ldif handlers using new GUID functions
Diffstat (limited to 'source4/lib/ldb-samba')
-rw-r--r-- | source4/lib/ldb-samba/ldif_handlers.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source4/lib/ldb-samba/ldif_handlers.c b/source4/lib/ldb-samba/ldif_handlers.c index a74687173a..86bb1a1c7c 100644 --- a/source4/lib/ldb-samba/ldif_handlers.c +++ b/source4/lib/ldb-samba/ldif_handlers.c @@ -237,10 +237,10 @@ static int ldif_write_objectGUID(struct ldb_context *ldb, void *mem_ctx, const struct ldb_val *in, struct ldb_val *out) { struct GUID guid; - enum ndr_err_code ndr_err; - ndr_err = ndr_pull_struct_blob_all(in, mem_ctx, NULL, &guid, - (ndr_pull_flags_fn_t)ndr_pull_GUID); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + NTSTATUS status; + + status = GUID_from_ndr_blob(in, &guid); + if (!NT_STATUS_IS_OK(status)) { return -1; } out->data = (uint8_t *)GUID_string(mem_ctx, &guid); @@ -263,7 +263,8 @@ static int extended_dn_read_GUID(struct ldb_context *ldb, void *mem_ctx, const struct ldb_val *in, struct ldb_val *out) { struct GUID guid; - enum ndr_err_code ndr_err; + NTSTATUS status; + if (in->length == 36 && ldif_read_objectGUID(ldb, mem_ctx, in, out) == 0) { return 0; } @@ -283,9 +284,9 @@ static int extended_dn_read_GUID(struct ldb_context *ldb, void *mem_ctx, (const char *)in->data, in->length); /* Check it looks like a GUID */ - ndr_err = ndr_pull_struct_blob_all(out, mem_ctx, NULL, &guid, - (ndr_pull_flags_fn_t)ndr_pull_GUID); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + status = GUID_from_ndr_blob(out, &guid); + if (!NT_STATUS_IS_OK(status)) { + data_blob_free(out); return -1; } return 0; |