s4:torture/ldap: close connections with an UnbindRequest
authorStefan Metzmacher <metze@samba.org>
Mon, 27 Sep 2010 06:14:54 +0000 (08:14 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 27 Sep 2010 07:14:23 +0000 (07:14 +0000)
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Mon Sep 27 07:14:23 UTC 2010 on sn-devel-104

source4/torture/ldap/common.c

index 38911750e07bd63175962498702d48b092a1f06f..8c0eb02f042784b076ac4007ffd9acc5c76821f7 100644 (file)
@@ -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;
 }