Add tiny tldap test
authorVolker Lendecke <vl@samba.org>
Fri, 19 Jun 2009 11:06:02 +0000 (13:06 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 19 Jun 2009 12:28:22 +0000 (14:28 +0200)
source3/Makefile.in
source3/torture/torture.c

index c657786b14685d04e482c7731147726cc7c7f939..5d03886634eeb54cf9288a9dccbfc6f71e44e75e 100644 (file)
@@ -1005,7 +1005,7 @@ NMBLOOKUP_OBJ = utils/nmblookup.o $(PARAM_OBJ) $(LIBNMB_OBJ) \
 SMBTORTURE_OBJ1 = torture/torture.o torture/nbio.o torture/scanner.o torture/utable.o \
                torture/denytest.o torture/mangle_test.o
 
-SMBTORTURE_OBJ = $(SMBTORTURE_OBJ1) $(PARAM_OBJ) \
+SMBTORTURE_OBJ = $(SMBTORTURE_OBJ1) $(PARAM_OBJ) $(TLDAP_OBJ) \
        $(LIBSMB_OBJ) $(LDB_OBJ) $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) \
        @LIBWBCLIENT_STATIC@ \
        $(LIBNDR_GEN_OBJ0)
index baa8a15da4af45109d8376561b7646f5325c8482..7a4a5fc46e77cb63eb1b5b3024eed130ed377ef5 100644 (file)
@@ -5585,6 +5585,41 @@ static bool run_shortname_test(int dummy)
        return correct;
 }
 
+static bool run_tldap(int dummy)
+{
+       struct tldap_context *ld;
+       int fd, rc;
+       NTSTATUS status;
+       struct sockaddr_storage addr;
+
+       if (!resolve_name(host, &addr, 0)) {
+               d_printf("could not find host %s\n", host);
+               return false;
+       }
+       status = open_socket_out(&addr, 389, 9999, &fd);
+       if (!NT_STATUS_IS_OK(status)) {
+               d_printf("open_socket_out failed: %s\n", nt_errstr(status));
+               return false;
+       }
+
+       ld = tldap_context_create(talloc_tos(), fd);
+       if (ld == NULL) {
+               close(fd);
+               d_printf("tldap_context_create failed\n");
+               return false;
+       }
+
+       rc = tldap_fetch_rootdse(ld);
+       if (rc != TLDAP_SUCCESS) {
+               d_printf("tldap_fetch_rootdse failed: %s\n",
+                        tldap_errstr(talloc_tos(), ld, rc));
+               return false;
+       }
+
+       TALLOC_FREE(ld);
+       return true;
+}
+
 static bool run_local_substitute(int dummy)
 {
        bool ok = true;
@@ -6250,6 +6285,7 @@ static struct {
        { "WINDOWS-WRITE", run_windows_write, 0},
        { "CLI_ECHO", run_cli_echo, 0},
        { "GETADDRINFO", run_getaddrinfo_send, 0},
+       { "TLDAP", run_tldap },
        { "LOCAL-SUBSTITUTE", run_local_substitute, 0},
        { "LOCAL-GENCACHE", run_local_gencache, 0},
        { "LOCAL-RBTREE", run_local_rbtree, 0},