From 756f83796fd307ed769bbc049d50c017f5eb4423 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 19 Jun 2009 13:06:02 +0200 Subject: Add tiny tldap test --- source3/Makefile.in | 2 +- source3/torture/torture.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) (limited to 'source3') diff --git a/source3/Makefile.in b/source3/Makefile.in index c657786b14..5d03886634 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -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) diff --git a/source3/torture/torture.c b/source3/torture/torture.c index baa8a15da4..7a4a5fc46e 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -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}, -- cgit