From: Douglas Bagnall Date: Wed, 17 Apr 2024 13:42:27 +0000 (+1200) Subject: ldb-samba: simplify ldif_canonicalise_objectSid() X-Git-Tag: tdb-1.4.11~817 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6c7cb8d4ba0e115034f4f0f7ff4a9943e54d914;p=thirdparty%2Fsamba.git ldb-samba: simplify ldif_canonicalise_objectSid() ldif_comparision_objectSid_isString() is doing not useful or accurate, and ldif_read_objectSid() checks properly. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10763 Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/lib/ldb-samba/ldif_handlers.c b/lib/ldb-samba/ldif_handlers.c index c9b4a910894..cfec5e1c86b 100644 --- a/lib/ldb-samba/ldif_handlers.c +++ b/lib/ldb-samba/ldif_handlers.c @@ -191,13 +191,11 @@ static int ldif_comparison_objectSid(struct ldb_context *ldb, void *mem_ctx, static int ldif_canonicalise_objectSid(struct ldb_context *ldb, void *mem_ctx, const struct ldb_val *in, struct ldb_val *out) { - if (ldif_comparision_objectSid_isString(in)) { - if (ldif_read_objectSid(ldb, mem_ctx, in, out) != 0) { - /* Perhaps not a string after all */ - return ldb_handler_copy(ldb, mem_ctx, in, out); - } + /* First try as a string SID */ + if (ldif_read_objectSid(ldb, mem_ctx, in, out) == 0) { return 0; } + /* not a string after all */ return ldb_handler_copy(ldb, mem_ctx, in, out); }