summaryrefslogtreecommitdiff
path: root/source4/torture/ldap
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-09-27 08:14:54 +0200
committerStefan Metzmacher <metze@samba.org>2010-09-27 07:14:23 +0000
commitb32625b79f0f1b67c3e7579f7a2e959e89343180 (patch)
tree3ed9d00ed4875188454e2df44552f4d72f48dc2d /source4/torture/ldap
parentb1ffacb43736c2a2366fbcb0039384b7b8d1683e (diff)
downloadsamba-b32625b79f0f1b67c3e7579f7a2e959e89343180.tar.gz
samba-b32625b79f0f1b67c3e7579f7a2e959e89343180.tar.bz2
samba-b32625b79f0f1b67c3e7579f7a2e959e89343180.zip
s4:torture/ldap: close connections with an UnbindRequest
metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Mon Sep 27 07:14:23 UTC 2010 on sn-devel-104
Diffstat (limited to 'source4/torture/ldap')
-rw-r--r--source4/torture/ldap/common.c29
1 files changed, 29 insertions, 0 deletions
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;
}