diff options
author | Volker Lendecke <vl@samba.org> | 2009-06-20 18:43:58 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-06-20 18:54:07 +0200 |
commit | 4aade2768b40b805b50578ec6fa99fe57525b147 (patch) | |
tree | 35a6f10deaafbc394cf03fd3f29f07f7342da1f6 /source3/torture | |
parent | a3eb0a32a9f36cc9799e11e43f4b95fa0df272a9 (diff) | |
download | samba-4aade2768b40b805b50578ec6fa99fe57525b147.tar.gz samba-4aade2768b40b805b50578ec6fa99fe57525b147.tar.xz samba-4aade2768b40b805b50578ec6fa99fe57525b147.zip |
Add tldap paged searches, together with two helper routines
Diffstat (limited to 'source3/torture')
-rw-r--r-- | source3/torture/torture.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 7a4a5fc46e..888010406f 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -5585,12 +5585,39 @@ static bool run_shortname_test(int dummy) return correct; } +static void pagedsearch_cb(struct tevent_req *req) +{ + int rc; + struct tldap_message *msg; + char *dn; + + rc = tldap_search_paged_recv(req, talloc_tos(), &msg); + if (rc != TLDAP_SUCCESS) { + d_printf("tldap_search_paged_recv failed: %s\n", + tldap_err2string(rc)); + return; + } + if (tldap_msg_type(msg) != TLDAP_RES_SEARCH_ENTRY) { + TALLOC_FREE(msg); + return; + } + if (!tldap_entry_dn(msg, &dn)) { + d_printf("tldap_entry_dn failed\n"); + return; + } + d_printf("%s\n", dn); + TALLOC_FREE(msg); +} + static bool run_tldap(int dummy) { struct tldap_context *ld; int fd, rc; NTSTATUS status; struct sockaddr_storage addr; + struct tevent_context *ev; + struct tevent_req *req; + char *basedn; if (!resolve_name(host, &addr, 0)) { d_printf("could not find host %s\n", host); @@ -5616,6 +5643,34 @@ static bool run_tldap(int dummy) return false; } + basedn = tldap_talloc_single_attribute( + tldap_rootdse(ld), "defaultNamingContext", talloc_tos()); + if (basedn == NULL) { + d_printf("no defaultNamingContext\n"); + return false; + } + d_printf("defaultNamingContext: %s\n", basedn); + + ev = tevent_context_init(talloc_tos()); + if (ev == NULL) { + d_printf("tevent_context_init failed\n"); + return false; + } + + req = tldap_search_paged_send(talloc_tos(), ev, ld, basedn, + TLDAP_SCOPE_SUB, "(objectclass=*)", + NULL, 0, 0, + NULL, 0, NULL, 0, 0, 0, 0, 5); + if (req == NULL) { + d_printf("tldap_search_paged_send failed\n"); + return false; + } + tevent_req_set_callback(req, pagedsearch_cb, NULL); + + tevent_req_poll(req, ev); + + TALLOC_FREE(req); + TALLOC_FREE(ld); return true; } |