summaryrefslogtreecommitdiff
path: root/source4/libnet
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-09-13 16:37:10 +1000
committerAndrew Tridgell <tridge@samba.org>2010-09-15 15:39:34 +1000
commit041c699f3ae10d189405b93977e3143813fb4525 (patch)
tree2d6dd07d45ece44142914f0e1c49b879676721e3 /source4/libnet
parent94fb6120d80d05de0f24ea71a93c761517fd4231 (diff)
downloadsamba-041c699f3ae10d189405b93977e3143813fb4525.tar.gz
samba-041c699f3ae10d189405b93977e3143813fb4525.tar.bz2
samba-041c699f3ae10d189405b93977e3143813fb4525.zip
s4-libnet: converted finddcs call to tevent_req
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/libnet')
-rw-r--r--source4/libnet/libnet_lookup.c34
-rw-r--r--source4/libnet/libnet_rpc.c16
2 files changed, 25 insertions, 25 deletions
diff --git a/source4/libnet/libnet_lookup.c b/source4/libnet/libnet_lookup.c
index 43a7654d4b..36c747b951 100644
--- a/source4/libnet/libnet_lookup.c
+++ b/source4/libnet/libnet_lookup.c
@@ -186,21 +186,21 @@ NTSTATUS libnet_LookupHost(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
/**
* Sends asynchronous LookupDCs request
*/
-struct composite_context* libnet_LookupDCs_send(struct libnet_context *ctx,
- TALLOC_CTX *mem_ctx,
- struct libnet_LookupDCs *io)
+struct tevent_req *libnet_LookupDCs_send(struct libnet_context *ctx,
+ TALLOC_CTX *mem_ctx,
+ struct libnet_LookupDCs *io)
{
- struct composite_context *c;
+ struct tevent_req *req;
struct messaging_context *msg_ctx =
messaging_client_init(mem_ctx,
- lpcfg_messaging_path(mem_ctx, ctx->lp_ctx),
- ctx->event_ctx);
-
- c = finddcs_send(mem_ctx, lpcfg_netbios_name(ctx->lp_ctx),
- lpcfg_nbt_port(ctx->lp_ctx), io->in.domain_name,
- io->in.name_type, NULL, ctx->resolve_ctx,
- ctx->event_ctx, msg_ctx);
- return c;
+ lpcfg_messaging_path(mem_ctx, ctx->lp_ctx),
+ ctx->event_ctx);
+
+ req = finddcs_send(mem_ctx, lpcfg_netbios_name(ctx->lp_ctx),
+ lpcfg_nbt_port(ctx->lp_ctx), io->in.domain_name,
+ io->in.name_type, NULL, ctx->resolve_ctx,
+ ctx->event_ctx, msg_ctx);
+ return req;
}
/**
@@ -212,12 +212,12 @@ struct composite_context* libnet_LookupDCs_send(struct libnet_context *ctx,
* @return nt status code of execution
*/
-NTSTATUS libnet_LookupDCs_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
+NTSTATUS libnet_LookupDCs_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
struct libnet_LookupDCs *io)
{
NTSTATUS status;
- status = finddcs_recv(c, mem_ctx, &io->out.num_dcs, &io->out.dcs);
- /* "c" already freed here */
+ status = finddcs_recv(req, mem_ctx, &io->out.num_dcs, &io->out.dcs);
+ /* "req" already freed here */
return status;
}
@@ -228,8 +228,8 @@ NTSTATUS libnet_LookupDCs_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
NTSTATUS libnet_LookupDCs(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
struct libnet_LookupDCs *io)
{
- struct composite_context *c = libnet_LookupDCs_send(ctx, mem_ctx, io);
- return libnet_LookupDCs_recv(c, mem_ctx, io);
+ struct tevent_req *req = libnet_LookupDCs_send(ctx, mem_ctx, io);
+ return libnet_LookupDCs_recv(req, mem_ctx, io);
}
diff --git a/source4/libnet/libnet_rpc.c b/source4/libnet/libnet_rpc.c
index 138b926742..f4760d418a 100644
--- a/source4/libnet/libnet_rpc.c
+++ b/source4/libnet/libnet_rpc.c
@@ -223,7 +223,7 @@ struct rpc_connect_dc_state {
};
-static void continue_lookup_dc(struct composite_context *ctx);
+static void continue_lookup_dc(struct tevent_req *req);
static void continue_rpc_connect(struct composite_context *ctx);
@@ -243,7 +243,7 @@ static struct composite_context* libnet_RpcConnectDC_send(struct libnet_context
{
struct composite_context *c;
struct rpc_connect_dc_state *s;
- struct composite_context *lookup_dc_req;
+ struct tevent_req *lookup_dc_req;
/* composite context allocation and setup */
c = composite_create(ctx, ctx->event_ctx);
@@ -280,7 +280,7 @@ static struct composite_context* libnet_RpcConnectDC_send(struct libnet_context
lookup_dc_req = libnet_LookupDCs_send(ctx, c, &s->f);
if (composite_nomem(lookup_dc_req, c)) return c;
- composite_continue(c, lookup_dc_req, continue_lookup_dc, c);
+ tevent_req_set_callback(lookup_dc_req, continue_lookup_dc, c);
return c;
}
@@ -289,19 +289,19 @@ static struct composite_context* libnet_RpcConnectDC_send(struct libnet_context
Step 2 of RpcConnectDC: get domain controller name and
initiate RpcConnect to it
*/
-static void continue_lookup_dc(struct composite_context *ctx)
+static void continue_lookup_dc(struct tevent_req *req)
{
struct composite_context *c;
struct rpc_connect_dc_state *s;
struct composite_context *rpc_connect_req;
struct monitor_msg msg;
struct msg_net_lookup_dc data;
-
- c = talloc_get_type(ctx->async.private_data, struct composite_context);
- s = talloc_get_type(c->private_data, struct rpc_connect_dc_state);
+
+ c = tevent_req_callback_data(req, struct composite_context);
+ s = talloc_get_type_abort(c->private_data, struct rpc_connect_dc_state);
/* receive result of domain controller lookup */
- c->status = libnet_LookupDCs_recv(ctx, c, &s->f);
+ c->status = libnet_LookupDCs_recv(req, c, &s->f);
if (!composite_is_ok(c)) return;
/* decide on preferred address type depending on DC type */