The branch, master has been updated
       via  a2b1970a378 acl_read: Fix regression caused by 
db15fcfa899e1fe4d6994f68ceb299921b8aa6f1 for empty lists
       via  24efa3ca539 ldb: cmocka test for empty attributes bug
       via  7f1b6455fdc paged_search: perf testing paged search
      from  11f25834203 s3:smbd: fix max_buffer handling of initial notify 
requests

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit a2b1970a37836e46d6c9eb6bda9bd20185de96ce
Author: Garming Sam <[email protected]>
Date:   Wed Mar 13 10:52:19 2019 +1300

    acl_read: Fix regression caused by db15fcfa899e1fe4d6994f68ceb299921b8aa6f1 
for empty lists
    
    The original code never dereferenced attrs and only added "*" if attrs
    was NULL (not if attrs[0] was NULL).
    
    This causes significant performance issues with the new paged_results
    module introduced for 4.10 as the initial GUID search requests no
    attributes. This GUID search turns into a search for "*" and ends up
    allocating memory for the entire database.
    
    This never appears to cause changes in the final result set, only
    intermediate processing.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13836
    
    Signed-off-by: Garming Sam <[email protected]>
    Reviewed-by: Andrew Bartlett <[email protected]>
    
    Autobuild-User(master): Andrew Bartlett <[email protected]>
    Autobuild-Date(master): Fri Mar 29 18:37:29 UTC 2019 on sn-devel-144

commit 24efa3ca5399d5cf538c3be504014a954685f1ed
Author: Aaron Haslett <[email protected]>
Date:   Mon Mar 25 13:13:33 2019 +1300

    ldb: cmocka test for empty attributes bug
    
    Cmocka test exposing LDB bug where a request with an empty attributes
    list returns a response containing all attributes.  The bug is in the
    ACL module and will be fixed in the next commit.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13836
    
    Signed-off-by: Aaron Haslett <[email protected]>
    Reviewed-by: Garming Sam <[email protected]>
    Reviewed-by: Andrew Bartlett <[email protected]>

commit 7f1b6455fdc1d7767bdfd3dc81851abb682cc087
Author: Aaron Haslett <[email protected]>
Date:   Thu Mar 28 15:03:17 2019 +1300

    paged_search: perf testing paged search
    
    Adding medley performance run with paged search module.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13836
    
    Signed-off-by: Aaron Haslett <[email protected]>
    Reviewed-by: Garming Sam <[email protected]>
    Reviewed-by: Andrew Bartlett <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 selftest/perf_tests.py                             | 17 ++++
 source4/dsdb/common/tests/dsdb.c                   | 93 ++++++++++++++++++++++
 source4/dsdb/samdb/ldb_modules/acl_read.c          |  3 -
 .../dsdb/tests/python/ad_dc_medley_performance.py  | 11 ++-
 source4/selftest/tests.py                          |  3 +
 source4/torture/wscript_build                      |  9 +++
 6 files changed, 131 insertions(+), 5 deletions(-)
 create mode 100644 source4/dsdb/common/tests/dsdb.c


Changeset truncated at 500 lines:

diff --git a/selftest/perf_tests.py b/selftest/perf_tests.py
index bc08075c6d1..a3fdbf4b1b3 100644
--- a/selftest/perf_tests.py
+++ b/selftest/perf_tests.py
@@ -74,6 +74,11 @@ 
plantestsuite_loadlist("samba4.ldb.multi_connect.python(ad_dc_ntvfs)",
                         'tdb://$PREFIX_ABS/ad_dc_ntvfs/private/sam.ldb'
                         '$LOADLIST', '$LISTOPT'])
 
+plantestsuite_loadlist("samba4.ldap.vlv.python(ad_dc_ntvfs)", "ad_dc_ntvfs",
+                       [python,
+                        os.path.join(samba4srcdir, "dsdb/tests/python/vlv.py"),
+                        '$SERVER', '-U"$USERNAME%$PASSWORD"',
+                        '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
 
 # this one doesn't tidy itself up fully, so leave it as last unless
 # you want a messy database.
@@ -85,3 +90,15 @@ 
plantestsuite_loadlist("samba4.ldap.ad_dc_medley_performance.python(ad_dc_ntvfs)
                         '$SERVER', '-U"$USERNAME%$PASSWORD"',
                         '--workgroup=$DOMAIN',
                         '$LOADLIST', '$LISTOPT'])
+
+# again with paged search module
+plantestsuite_loadlist("samba4.ldap.ad_dc_medley_performance.paged_search."+\
+                           "python(ad_dc_ntvfs)",
+                       "ad_dc_ntvfs",
+                       [python,
+                        os.path.join(samba4srcdir,
+                              "dsdb/tests/python/ad_dc_medley_performance.py"),
+                        '$SERVER', '-U"$USERNAME%$PASSWORD"',
+                        '--workgroup=$DOMAIN',
+                        '--use-paged-search',
+                        '$LOADLIST', '$LISTOPT'])
diff --git a/source4/dsdb/common/tests/dsdb.c b/source4/dsdb/common/tests/dsdb.c
new file mode 100644
index 00000000000..b38dee1c262
--- /dev/null
+++ b/source4/dsdb/common/tests/dsdb.c
@@ -0,0 +1,93 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   Test DSDB search
+
+   Copyright (C) Andrew Bartlet <[email protected]> 2019
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include <ldb_module.h>
+#include "ldb_wrap.h"
+#include "param/param.h"
+#include "param/loadparm.h"
+#include "torture/smbtorture.h"
+#include "torture/dsdb_proto.h"
+#include "auth/auth.h"
+
+bool torture_ldb_no_attrs(struct torture_context *torture)
+{
+       struct ldb_context *ldb;
+       int ret;
+       struct ldb_request *req;
+       struct ldb_result *ctx;
+       struct ldb_dn *dn;
+       const char *attrs[] = { NULL };
+
+       struct auth_session_info *session;
+       struct dom_sid *domain_sid = NULL;
+       const char *path;
+
+       path = lpcfg_private_path(NULL, torture->lp_ctx, "sam.ldb");
+       torture_assert(torture, path != NULL,
+                      "Couldn't find sam.ldb. Run with -s $SERVERCONFFILE");
+
+       domain_sid = dom_sid_parse_talloc(NULL, SID_BUILTIN);
+       session = admin_session(NULL, torture->lp_ctx, domain_sid);
+       ldb = ldb_wrap_connect(torture, torture->ev, torture->lp_ctx,
+                              path, session, NULL, 0);
+       torture_assert(torture, ldb, "Failed to connect to LDB target");
+
+       ctx = talloc_zero(ldb, struct ldb_result);
+
+       dn = ldb_get_default_basedn(ldb);
+       ldb_dn_add_child_fmt(dn, "cn=users");
+       ret = ldb_build_search_req(&req, ldb, ctx, dn, LDB_SCOPE_SUBTREE,
+                                  "(objectClass=*)", attrs, NULL,
+                                  ctx, ldb_search_default_callback, NULL);
+       torture_assert(torture, ret == LDB_SUCCESS,
+                      "Failed to build search request");
+       ldb_req_mark_untrusted(req);
+
+       ret = ldb_request(ldb, req);
+       torture_assert(torture, ret == LDB_SUCCESS, ldb_errstring(ldb));
+
+       ret = ldb_wait(req->handle, LDB_WAIT_ALL);
+       torture_assert(torture, ret == LDB_SUCCESS, ldb_errstring(ldb));
+
+       torture_assert(torture, ctx->count > 0, "Users container empty");
+       torture_assert_int_equal(torture, ctx->msgs[0]->num_elements, 0,
+                                "Attributes returned for request "
+                                "with empty attribute list");
+
+       return true;
+}
+
+NTSTATUS torture_dsdb_init(TALLOC_CTX *mem_ctx)
+{
+       struct torture_suite *suite = torture_suite_create(mem_ctx, "dsdb");
+
+       if (suite == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+       torture_suite_add_simple_test(suite, "no_attrs", torture_ldb_no_attrs);
+
+       suite->description = talloc_strdup(suite, "DSDB tests");
+
+       torture_register_suite(mem_ctx, suite);
+
+       return NT_STATUS_OK;
+}
diff --git a/source4/dsdb/samdb/ldb_modules/acl_read.c 
b/source4/dsdb/samdb/ldb_modules/acl_read.c
index 5a193e6d925..1e016b970ee 100644
--- a/source4/dsdb/samdb/ldb_modules/acl_read.c
+++ b/source4/dsdb/samdb/ldb_modules/acl_read.c
@@ -797,9 +797,6 @@ static int aclread_search(struct ldb_module *module, struct 
ldb_request *req)
        if (attrs == NULL) {
                all_attrs = true;
                attrs = _all_attrs;
-       } else if (attrs[0] == NULL) {
-               all_attrs = true;
-               attrs = _all_attrs;
        } else if (ldb_attr_in_list(attrs, "*")) {
                all_attrs = true;
        }
diff --git a/source4/dsdb/tests/python/ad_dc_medley_performance.py 
b/source4/dsdb/tests/python/ad_dc_medley_performance.py
index 1be8ef6ce39..e0f0e19651a 100644
--- a/source4/dsdb/tests/python/ad_dc_medley_performance.py
+++ b/source4/dsdb/tests/python/ad_dc_medley_performance.py
@@ -42,6 +42,9 @@ from ldb import ERR_NO_SUCH_OBJECT
 
 parser = optparse.OptionParser("ad_dc_performance.py [options] <host>")
 sambaopts = options.SambaOptions(parser)
+sambaopts.add_option("-p", "--use-paged-search", action="store_true",
+                     help="Use paged search module")
+
 parser.add_option_group(sambaopts)
 parser.add_option_group(options.VersionOptions(parser))
 
@@ -54,7 +57,6 @@ credopts = options.CredentialsOptions(parser)
 parser.add_option_group(credopts)
 opts, args = parser.parse_args()
 
-
 if len(args) < 1:
     parser.print_usage()
     sys.exit(1)
@@ -103,8 +105,13 @@ class UserTests(samba.tests.TestCase):
         super(UserTests, self).setUp()
         self.state = GlobalState  # the class itself, not an instance
         self.lp = lp
+
+        kwargs = {}
+        if opts.use_paged_search:
+            kwargs["options"] = ["modules:paged_searches"]
+
         self.ldb = SamDB(host, credentials=creds,
-                         session_info=system_session(lp), lp=lp)
+                         session_info=system_session(lp), lp=lp, **kwargs)
         self.base_dn = self.ldb.domain_dn()
         self.ou = "OU=pid%s,%s" % (os.getpid(), self.base_dn)
         self.ou_users = "OU=users,%s" % self.ou
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index 5a3f69f232d..7e0ce96c45c 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -152,6 +152,9 @@ for options in ['-U"$USERNAME%$PASSWORD"']:
 for t in smbtorture4_testsuites("ldap."):
     plansmbtorture4testsuite(t, "ad_dc_default", '-U"$USERNAME%$PASSWORD" 
//$SERVER_IP/_none_')
 
+for t in smbtorture4_testsuites("dsdb."):
+    plansmbtorture4testsuite(t, "ad_dc:local", "localhost")
+
 ldbdir = os.path.join(srcdir(), "lib/ldb")
 # Don't run LDB tests when using system ldb, as we won't have ldbtest installed
 if os.path.exists(os.path.join(samba4bindir, "ldbtest")):
diff --git a/source4/torture/wscript_build b/source4/torture/wscript_build
index 09904134d3e..0189300aca9 100644
--- a/source4/torture/wscript_build
+++ b/source4/torture/wscript_build
@@ -344,3 +344,12 @@ bld.SAMBA_BINARY('locktest',
        deps='popt POPT_SAMBA POPT_CREDENTIALS samba-util LIBCLI_SMB 
samba-hostconfig param_options',
        )
 
+bld.SAMBA_MODULE('TORTURE_DSDB',
+       source="../../source4/dsdb/common/tests/dsdb.c",
+       autoproto='dsdb_proto.h',
+       subsystem='smbtorture',
+       init_function='torture_dsdb_init',
+       deps="TORTURE_UTIL samba-util",
+       internal_module=True,
+       enabled=bld.PYTHON_BUILD_IS_ENABLED()
+       )


-- 
Samba Shared Repository

Reply via email to