diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-03-09 15:46:55 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2010-03-12 15:25:48 +0100 |
commit | ff54cbe3d4c090003720eaef2a7321923404db39 (patch) | |
tree | 18db266427deb31eeec5253c581997297a503505 /source4/torture | |
parent | e9cae3b5bc9a59a45973c1671e2d7372d1c32b12 (diff) | |
download | samba-ff54cbe3d4c090003720eaef2a7321923404db39.tar.gz samba-ff54cbe3d4c090003720eaef2a7321923404db39.tar.bz2 samba-ff54cbe3d4c090003720eaef2a7321923404db39.zip |
s4:torture/rpc: make use of use tevent_req based dcerpc_binding_handle stubs
metze
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/rpc/echo.c | 13 | ||||
-rw-r--r-- | source4/torture/rpc/lsa.c | 16 | ||||
-rw-r--r-- | source4/torture/rpc/netlogon.c | 9 | ||||
-rw-r--r-- | source4/torture/rpc/samr.c | 8 | ||||
-rw-r--r-- | source4/torture/rpc/schannel.c | 20 |
5 files changed, 36 insertions, 30 deletions
diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c index e0ee8a580e..9cc3a01c49 100644 --- a/source4/torture/rpc/echo.c +++ b/source4/torture/rpc/echo.c @@ -218,9 +218,9 @@ static bool test_testcall2(struct torture_context *tctx, return true; } -static void test_sleep_done(struct rpc_request *rreq) +static void test_sleep_done(struct tevent_req *subreq) { - bool *done1 = (bool *)rreq->async.private_data; + bool *done1 = (bool *)tevent_req_callback_data_void(subreq); *done1 = true; } @@ -233,7 +233,7 @@ static bool test_sleep(struct torture_context *tctx, int i; NTSTATUS status; #define ASYNC_COUNT 3 - struct rpc_request *req[ASYNC_COUNT]; + struct tevent_req *req[ASYNC_COUNT]; struct echo_TestSleep r[ASYNC_COUNT]; bool done1[ASYNC_COUNT]; bool done2[ASYNC_COUNT]; @@ -254,10 +254,9 @@ static bool test_sleep(struct torture_context *tctx, snd[i] = timeval_current(); rcv[i] = timeval_zero(); r[i].in.seconds = ASYNC_COUNT-i; - req[i] = dcerpc_echo_TestSleep_send(p, tctx, &r[i]); + req[i] = dcerpc_echo_TestSleep_r_send(tctx, tctx->ev, p->binding_handle, &r[i]); torture_assert(tctx, req[i], "Failed to send async sleep request\n"); - req[i]->async.callback = test_sleep_done; - req[i]->async.private_data = &done1[i]; + tevent_req_set_callback(req[i], test_sleep_done, &done1[i]); } ctx = dcerpc_event_context(p); @@ -272,7 +271,7 @@ static bool test_sleep(struct torture_context *tctx, rcv[i] = timeval_current(); diff[i] = timeval_until(&snd[i], &rcv[i]); rounded_tdiff = (int)(0.5 + diff[i].tv_sec + (1.0e-6*diff[i].tv_usec)); - status = dcerpc_echo_TestSleep_recv(req[i]); + status = dcerpc_echo_TestSleep_r_recv(req[i], tctx); torture_comment(tctx, "rounded_tdiff=%d\n", rounded_tdiff); torture_assert_ntstatus_ok(tctx, status, talloc_asprintf(tctx, "TestSleep(%d) failed", i)); diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c index 4c402f3ba4..e2a44112fd 100644 --- a/source4/torture/rpc/lsa.c +++ b/source4/torture/rpc/lsa.c @@ -747,12 +747,13 @@ bool test_many_LookupSids(struct dcerpc_pipe *p, return true; } -static void lookupsids_cb(struct rpc_request *req) +static void lookupsids_cb(struct tevent_req *subreq) { - int *replies = (int *)req->async.private_data; + int *replies = (int *)tevent_req_callback_data_void(subreq); NTSTATUS status; - status = dcerpc_lsa_LookupSids_recv(req); + status = dcerpc_lsa_LookupSids_r_recv(subreq, subreq); + TALLOC_FREE(subreq); if (!NT_STATUS_IS_OK(status)) { printf("lookupsids returned %s\n", nt_errstr(status)); *replies = -1; @@ -773,7 +774,7 @@ static bool test_LookupSids_async(struct dcerpc_pipe *p, struct lsa_TransNameArray *names; struct lsa_LookupSids *r; struct lsa_RefDomainList *domains = NULL; - struct rpc_request **req; + struct tevent_req **req; int i, replies; bool ret = true; const int num_async_requests = 50; @@ -784,7 +785,7 @@ static bool test_LookupSids_async(struct dcerpc_pipe *p, torture_comment(tctx, "\nTesting %d async lookupsids request\n", num_async_requests); - req = talloc_array(tctx, struct rpc_request *, num_async_requests); + req = talloc_array(tctx, struct tevent_req *, num_async_requests); sids.num_sids = 1; sids.sids = &sidptr; @@ -806,14 +807,13 @@ static bool test_LookupSids_async(struct dcerpc_pipe *p, r[i].out.names = &names[i]; r[i].out.domains = &domains; - req[i] = dcerpc_lsa_LookupSids_send(p, req, &r[i]); + req[i] = dcerpc_lsa_LookupSids_r_send(tctx, tctx->ev, p->binding_handle, &r[i]); if (req[i] == NULL) { ret = false; break; } - req[i]->async.callback = lookupsids_cb; - req[i]->async.private_data = &replies; + tevent_req_set_callback(req[i], lookupsids_cb, &replies); } while (replies >= 0 && replies < num_async_requests) { diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index dd23c6eab0..4d14d6e0d5 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -2747,7 +2747,7 @@ static bool test_GetDomainInfo_async(struct torture_context *tctx, #define ASYNC_COUNT 100 struct netlogon_creds_CredentialState *creds; struct netlogon_creds_CredentialState *creds_async[ASYNC_COUNT]; - struct rpc_request *req[ASYNC_COUNT]; + struct tevent_req *req[ASYNC_COUNT]; int i; union netr_WorkstationInfo query; union netr_DomainInfo info; @@ -2781,7 +2781,7 @@ static bool test_GetDomainInfo_async(struct torture_context *tctx, netlogon_creds_client_authenticator(creds, &a); creds_async[i] = (struct netlogon_creds_CredentialState *)talloc_memdup(creds, creds, sizeof(*creds)); - req[i] = dcerpc_netr_LogonGetDomainInfo_send(p, tctx, &r); + req[i] = dcerpc_netr_LogonGetDomainInfo_r_send(tctx, tctx->ev, p->binding_handle, &r); /* even with this flush per request a w2k3 server seems to clag with multiple outstanding requests. bleergh. */ @@ -2790,7 +2790,10 @@ static bool test_GetDomainInfo_async(struct torture_context *tctx, } for (i=0;i<ASYNC_COUNT;i++) { - status = dcerpc_netr_LogonGetDomainInfo_recv(req[i]); + torture_assert_int_equal(tctx, tevent_req_poll(req[i], tctx->ev), true, + "tevent_req_poll() failed"); + + status = dcerpc_netr_LogonGetDomainInfo_r_recv(req[i], tctx); torture_assert_ntstatus_ok(tctx, status, "netr_LogonGetDomainInfo_async"); torture_assert_ntstatus_ok(tctx, r.out.result, "netr_LogonGetDomainInfo_async"); diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index 7fa08d7f76..0a839494b2 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -22,6 +22,7 @@ #include "includes.h" #include "torture/torture.h" +#include <tevent.h> #include "system/time.h" #include "librpc/gen_ndr/lsa.h" #include "librpc/gen_ndr/ndr_netlogon.h" @@ -5881,7 +5882,7 @@ static bool test_EnumDomainUsers_async(struct dcerpc_pipe *p, struct torture_con uint32_t resume_handle=0; int i; #define ASYNC_COUNT 100 - struct rpc_request *req[ASYNC_COUNT]; + struct tevent_req *req[ASYNC_COUNT]; if (!torture_setting_bool(tctx, "dangerous", false)) { torture_skip(tctx, "samr async test disabled - enable dangerous tests to use\n"); @@ -5896,11 +5897,12 @@ static bool test_EnumDomainUsers_async(struct dcerpc_pipe *p, struct torture_con r.out.resume_handle = &resume_handle; for (i=0;i<ASYNC_COUNT;i++) { - req[i] = dcerpc_samr_EnumDomainUsers_send(p, tctx, &r); + req[i] = dcerpc_samr_EnumDomainUsers_r_send(tctx, tctx->ev, p->binding_handle, &r); } for (i=0;i<ASYNC_COUNT;i++) { - status = dcerpc_samr_EnumDomainUsers_recv(req[i]); + tevent_req_poll(req[i], tctx->ev); + status = dcerpc_samr_EnumDomainUsers_r_recv(req[i], tctx); if (!NT_STATUS_IS_OK(status)) { torture_warning(tctx, "EnumDomainUsers[%d] failed - %s\n", i, nt_errstr(status)); diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c index 0e8fd5a02e..25098b7fba 100644 --- a/source4/torture/rpc/schannel.c +++ b/source4/torture/rpc/schannel.c @@ -554,7 +554,7 @@ static void torture_schannel_bench_connected(struct composite_context *c) } } -static void torture_schannel_bench_recv(struct rpc_request *req); +static void torture_schannel_bench_recv(struct tevent_req *subreq); static bool torture_schannel_bench_start(struct torture_schannel_bench_conn *conn) { @@ -562,7 +562,7 @@ static bool torture_schannel_bench_start(struct torture_schannel_bench_conn *con NTSTATUS status; DATA_BLOB names_blob, chal, lm_resp, nt_resp; int flags = CLI_CRED_NTLM_AUTH; - struct rpc_request *req; + struct tevent_req *subreq; struct cli_credentials *user_creds; if (conn->total % 2) { @@ -628,24 +628,26 @@ static bool torture_schannel_bench_start(struct torture_schannel_bench_conn *con conn->r.out.authoritative = talloc(conn->tmp, uint8_t); conn->r.out.flags = conn->r.in.flags; - req = dcerpc_netr_LogonSamLogonEx_send(conn->pipe, conn->tmp, &conn->r); - torture_assert(s->tctx, req, "Failed to setup LogonSamLogonEx request"); + subreq = dcerpc_netr_LogonSamLogonEx_r_send(s, s->tctx->ev, + conn->pipe->binding_handle, + &conn->r); + torture_assert(s->tctx, subreq, "Failed to setup LogonSamLogonEx request"); - req->async.callback = torture_schannel_bench_recv; - req->async.private_data = conn; + tevent_req_set_callback(subreq, torture_schannel_bench_recv, conn); return true; } -static void torture_schannel_bench_recv(struct rpc_request *req) +static void torture_schannel_bench_recv(struct tevent_req *subreq) { bool ret; struct torture_schannel_bench_conn *conn = - (struct torture_schannel_bench_conn *)req->async.private_data; + (struct torture_schannel_bench_conn *)tevent_req_callback_data_void(subreq); struct torture_schannel_bench *s = talloc_get_type(conn->s, struct torture_schannel_bench); - s->error = dcerpc_netr_LogonSamLogonEx_recv(req); + s->error = dcerpc_netr_LogonSamLogonEx_r_recv(subreq, subreq); + TALLOC_FREE(subreq); if (!NT_STATUS_IS_OK(s->error)) { return; } |