summaryrefslogtreecommitdiff
path: root/source4/torture/ldap
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-06-15 17:55:43 +0200
committerAndrew Bartlett <abartlet@samba.org>2009-06-18 13:49:26 +1000
commitb250c8de3930ed95c876219e13ceb1375b07d228 (patch)
treed1120da2fafca96b639c5b5c2b70a0bda41df1cb /source4/torture/ldap
parentef45b31886bbe34856abba718448972b62b48d3e (diff)
downloadsamba-b250c8de3930ed95c876219e13ceb1375b07d228.tar.gz
samba-b250c8de3930ed95c876219e13ceb1375b07d228.tar.bz2
samba-b250c8de3930ed95c876219e13ceb1375b07d228.zip
Fixes for the "cldap" tests
- Insert a check after the "tsocket" library call to make sure that the call terminated correctly - Add a comment to explain why on further calls of "cldap_socket_init" the destination address hasn't to be specified
Diffstat (limited to 'source4/torture/ldap')
-rw-r--r--source4/torture/ldap/cldap.c5
-rw-r--r--source4/torture/ldap/cldapbench.c20
2 files changed, 19 insertions, 6 deletions
diff --git a/source4/torture/ldap/cldap.c b/source4/torture/ldap/cldap.c
index 814c9ac86d..d0e9719188 100644
--- a/source4/torture/ldap/cldap.c
+++ b/source4/torture/ldap/cldap.c
@@ -54,6 +54,7 @@ static bool test_cldap_netlogon(struct torture_context *tctx, const char *dest)
dest,
lp_cldap_port(tctx->lp_ctx),
&dest_addr);
+ CHECK_VAL(ret, 0);
status = cldap_socket_init(tctx, NULL, NULL, dest_addr, &cldap);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -251,6 +252,7 @@ static bool test_cldap_netlogon_flags(struct torture_context *tctx,
uint32_t server_type;
struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(tctx->lp_ctx);
+ /* cldap_socket_init should now know about the dest. address */
status = cldap_socket_init(tctx, NULL, NULL, NULL, &cldap);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -361,9 +363,9 @@ static bool test_cldap_netlogon_flag_ds_dns_forest(struct torture_context *tctx,
uint32_t server_type;
struct netlogon_samlogon_response n1;
struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(tctx->lp_ctx);
-
bool result = true;
+ /* cldap_socket_init should now know about the dest. address */
status = cldap_socket_init(tctx, NULL, NULL, NULL, &cldap);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -437,6 +439,7 @@ static bool test_cldap_generic(struct torture_context *tctx, const char *dest)
const char *attrs2[] = { "currentTime", "highestCommittedUSN", "netlogon", NULL };
const char *attrs3[] = { "netlogon", NULL };
+ /* cldap_socket_init should now know about the dest. address */
status = cldap_socket_init(tctx, NULL, NULL, NULL, &cldap);
CHECK_STATUS(status, NT_STATUS_OK);
diff --git a/source4/torture/ldap/cldapbench.c b/source4/torture/ldap/cldapbench.c
index a422732b03..1614120294 100644
--- a/source4/torture/ldap/cldapbench.c
+++ b/source4/torture/ldap/cldapbench.c
@@ -25,6 +25,9 @@
#include "libcli/resolve/resolve.h"
#include "torture/torture.h"
#include "param/param.h"
+#include "../lib/tsocket/tsocket.h"
+
+#define CHECK_VAL(v, correct) torture_assert_int_equal(tctx, (v), (correct), "incorrect value");
struct bench_state {
struct torture_context *tctx;
@@ -58,13 +61,20 @@ static bool bench_cldap_netlogon(struct torture_context *tctx, const char *addre
struct cldap_socket *cldap;
int num_sent=0;
struct timeval tv = timeval_current();
- bool ret = true;
int timelimit = torture_setting_int(tctx, "timelimit", 10);
struct cldap_netlogon search;
struct bench_state *state;
NTSTATUS status;
+ struct tsocket_address *dest_addr;
+ int ret;
- status = cldap_socket_init(tctx, tctx->ev, NULL, NULL, &cldap);
+ ret = tsocket_address_inet_from_strings(tctx, "ip",
+ address,
+ lp_cldap_port(tctx->lp_ctx),
+ &dest_addr);
+ CHECK_VAL(ret, 0);
+
+ status = cldap_socket_init(tctx, tctx->ev, NULL, dest_addr, &cldap);
torture_assert_ntstatus_ok(tctx, status, "cldap_socket_init");
state = talloc_zero(tctx, struct bench_state);
@@ -107,7 +117,7 @@ static bool bench_cldap_netlogon(struct torture_context *tctx, const char *addre
state->fail_count);
talloc_free(cldap);
- return ret;
+ return true;
}
static void request_rootdse_handler(struct tevent_req *req)
@@ -134,12 +144,12 @@ static bool bench_cldap_rootdse(struct torture_context *tctx, const char *addres
struct cldap_socket *cldap;
int num_sent=0;
struct timeval tv = timeval_current();
- bool ret = true;
int timelimit = torture_setting_int(tctx, "timelimit", 10);
struct cldap_search search;
struct bench_state *state;
NTSTATUS status;
+ /* cldap_socket_init should now know about the dest. address */
status = cldap_socket_init(tctx, tctx->ev, NULL, NULL, &cldap);
torture_assert_ntstatus_ok(tctx, status, "cldap_socket_init");
@@ -183,7 +193,7 @@ static bool bench_cldap_rootdse(struct torture_context *tctx, const char *addres
state->fail_count);
talloc_free(cldap);
- return ret;
+ return true;
}
/*