From: Andrew Bartlett Date: Wed, 15 Jun 2016 03:42:18 +0000 (+1200) Subject: lib/ldb-samba: We can confirm a GUID is a GUID by length X-Git-Tag: tdb-1.3.10~818 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=61cb3a6a3b948b2c1768d29236a59c3620fc4331;p=thirdparty%2Fsamba.git lib/ldb-samba: We can confirm a GUID is a GUID by length The GUID_from_ndr_blob() is pointless and costly Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Fri Jun 17 18:13:56 CEST 2016 on sn-devel-144 --- diff --git a/lib/ldb-samba/ldif_handlers.c b/lib/ldb-samba/ldif_handlers.c index 87c171e28d2..c0972a4a6a7 100644 --- a/lib/ldb-samba/ldif_handlers.c +++ b/lib/ldb-samba/ldif_handlers.c @@ -265,8 +265,6 @@ static bool ldif_comparision_objectGUID_isString(const struct ldb_val *v) 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; - NTSTATUS status; if (in->length == 36 && ldif_read_objectGUID(ldb, mem_ctx, in, out) == 0) { return 0; @@ -285,13 +283,13 @@ static int extended_dn_read_GUID(struct ldb_context *ldb, void *mem_ctx, (*out).length = strhex_to_str((char *)out->data, out->length, (const char *)in->data, in->length); - + /* Check it looks like a GUID */ - status = GUID_from_ndr_blob(out, &guid); - if (!NT_STATUS_IS_OK(status)) { + if ((*out).length != 16) { data_blob_free(out); return -1; } + return 0; }