]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:dsdb:util: add dsdb_do_list_object() helper
authorStefan Metzmacher <metze@samba.org>
Tue, 6 Oct 2020 09:21:34 +0000 (11:21 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 21 Oct 2020 07:25:37 +0000 (07:25 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14531

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
source4/dsdb/samdb/ldb_modules/util.c

index 8bc170305007b3551d1c80325858260052731716..0e8b72233f44eb2d985e36dc87074ac5506b4d86 100644 (file)
@@ -1412,6 +1412,27 @@ bool dsdb_user_password_support(struct ldb_module *module,
        return result;
 }
 
+bool dsdb_do_list_object(struct ldb_module *module,
+                        TALLOC_CTX *mem_ctx,
+                        struct ldb_request *parent)
+{
+       TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
+       bool result;
+       const struct ldb_val *hr_val = dsdb_module_find_dsheuristics(module,
+                                                                    tmp_ctx,
+                                                                    parent);
+       if (hr_val == NULL || hr_val->length < DS_HR_DOLISTOBJECT) {
+               result = false;
+       } else if (hr_val->data[DS_HR_DOLISTOBJECT -1] == '1') {
+               result = true;
+       } else {
+               result = false;
+       }
+
+       talloc_free(tmp_ctx);
+       return result;
+}
+
 /*
   show the chain of requests, useful for debugging async requests
  */