]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ldb-samba: simplify ldif_canonicalise_objectSid()
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 17 Apr 2024 13:42:27 +0000 (01:42 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 7 May 2024 23:25:35 +0000 (23:25 +0000)
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 <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb-samba/ldif_handlers.c

index c9b4a9108945481d9aa9a53dfadca8598383bc43..cfec5e1c86bea8caaa770b1e89c4f5d2407ccaf7 100644 (file)
@@ -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);
 }