1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

tests/tldap: Actually check the paging return code

The test never worked correctly because the code was overlooked. It was
also the case that the connection was never authenticated, and so an
LDAP BIND call has now been added.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14029
This commit is contained in:
Garming Sam 2019-07-31 15:29:07 +12:00 committed by Andrew Bartlett
parent bff466943e
commit 85a7b594c5

View File

@ -11555,6 +11555,8 @@ static bool run_shortname_test(int dummy)
return correct;
}
TLDAPRC callback_code;
static void pagedsearch_cb(struct tevent_req *req)
{
TLDAPRC rc;
@ -11565,6 +11567,7 @@ static void pagedsearch_cb(struct tevent_req *req)
if (!TLDAP_RC_IS_SUCCESS(rc)) {
d_printf("tldap_search_paged_recv failed: %s\n",
tldap_rc2string(rc));
callback_code = rc;
return;
}
if (tldap_msg_type(msg) != TLDAP_RES_SEARCH_ENTRY) {
@ -11629,6 +11632,18 @@ static bool run_tldap(int dummy)
return false;
}
rc = tldap_gensec_bind(ld, torture_creds, "ldap", host, NULL,
loadparm_init_s3(talloc_tos(),
loadparm_s3_helpers()),
GENSEC_FEATURE_SIGN | GENSEC_FEATURE_SEAL);
if (!TLDAP_RC_IS_SUCCESS(rc)) {
d_printf("tldap_gensec_bind failed\n");
return false;
}
callback_code = TLDAP_SUCCESS;
req = tldap_search_paged_send(talloc_tos(), ev, ld, basedn,
TLDAP_SCOPE_SUB, "(objectclass=*)",
NULL, 0, 0,
@ -11643,6 +11658,14 @@ static bool run_tldap(int dummy)
TALLOC_FREE(req);
rc = callback_code;
if (!TLDAP_RC_IS_SUCCESS(rc)) {
d_printf("tldap_search with paging failed: %s\n",
tldap_errstr(talloc_tos(), ld, rc));
return false;
}
/* test search filters against rootDSE */
filter = "(&(|(name=samba)(nextRid<=10000000)(usnChanged>=10)(samba~=ambas)(!(name=s*m*a)))"
"(|(name:=samba)(name:dn:2.5.13.5:=samba)(:dn:2.5.13.5:=samba)(!(name=*samba))))";