From b32625b79f0f1b67c3e7579f7a2e959e89343180 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 27 Sep 2010 08:14:54 +0200 Subject: s4:torture/ldap: close connections with an UnbindRequest metze Autobuild-User: Stefan Metzmacher Autobuild-Date: Mon Sep 27 07:14:23 UTC 2010 on sn-devel-104 --- source4/torture/ldap/common.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'source4/torture/ldap') diff --git a/source4/torture/ldap/common.c b/source4/torture/ldap/common.c index 38911750e0..8c0eb02f04 100644 --- a/source4/torture/ldap/common.c +++ b/source4/torture/ldap/common.c @@ -96,6 +96,35 @@ NTSTATUS torture_ldap_connection2(struct torture_context *tctx, struct ldap_conn /* close an ldap connection to a server */ NTSTATUS torture_ldap_close(struct ldap_connection *conn) { + struct ldap_message *msg; + struct ldap_request *req; + NTSTATUS status; + + printf("Testing the most important error code -> error message conversions!\n"); + + msg = new_ldap_message(conn); + if (!msg) { + talloc_free(conn); + return NT_STATUS_NO_MEMORY; + } + + printf(" Try a AbandonRequest for an old message id\n"); + + msg->type = LDAP_TAG_UnbindRequest; + + req = ldap_request_send(conn, msg); + if (!req) { + talloc_free(conn); + return NT_STATUS_NO_MEMORY; + } + + status = ldap_request_wait(req); + if (!NT_STATUS_IS_OK(status)) { + printf("error in ldap unbind request - %s\n", nt_errstr(status)); + talloc_free(conn); + return status; + } + talloc_free(conn); return NT_STATUS_OK; } -- cgit