summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-04-25 11:40:30 +0200
committerVolker Lendecke <vl@samba.org>2010-04-25 12:32:02 +0200
commitd53e3450c775a4eae9f5237ec85ed212479fbcbd (patch)
tree51e58d9fa4f77a0295b11776ec9cf75f94f51c66 /source3/winbindd
parentd41836fb62e3059e042bf72d4392c2e85b55c582 (diff)
downloadsamba-d53e3450c775a4eae9f5237ec85ed212479fbcbd.tar.gz
samba-d53e3450c775a4eae9f5237ec85ed212479fbcbd.tar.bz2
samba-d53e3450c775a4eae9f5237ec85ed212479fbcbd.zip
s3: Convert add_trusted_domains() to wb_domain_request_send()
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/winbindd_util.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c
index 83cc36b350..eb471e8d13 100644
--- a/source3/winbindd/winbindd_util.c
+++ b/source3/winbindd/winbindd_util.c
@@ -238,51 +238,48 @@ bool domain_is_forest_root(const struct winbindd_domain *domain)
struct trustdom_state {
struct winbindd_domain *domain;
- struct winbindd_response *response;
+ struct winbindd_request request;
};
-static void trustdom_recv(void *private_data, bool success);
+static void trustdom_list_done(struct tevent_req *req);
static void rescan_forest_root_trusts( void );
static void rescan_forest_trusts( void );
static void add_trusted_domains( struct winbindd_domain *domain )
{
- struct winbindd_request *request;
- struct winbindd_response *response;
struct trustdom_state *state;
+ struct tevent_req *req;
state = TALLOC_ZERO_P(NULL, struct trustdom_state);
if (state == NULL) {
- DEBUG(0, ("talloc_init failed\n"));
+ DEBUG(0, ("talloc failed\n"));
return;
}
+ state->domain = domain;
- request = TALLOC_ZERO_P(state, struct winbindd_request);
- response = TALLOC_P(state, struct winbindd_response);
+ state->request.length = sizeof(state->request);
+ state->request.cmd = WINBINDD_LIST_TRUSTDOM;
- if ((request == NULL) || (response == NULL)) {
- DEBUG(0, ("talloc failed\n"));
+ req = wb_domain_request_send(state, winbind_event_context(),
+ domain, &state->request);
+ if (req == NULL) {
+ DEBUG(1, ("wb_domain_request_send failed\n"));
TALLOC_FREE(state);
return;
}
- state->response = response;
- state->domain = domain;
-
- request->length = sizeof(*request);
- request->cmd = WINBINDD_LIST_TRUSTDOM;
-
- async_domain_request(state, domain, request, response,
- trustdom_recv, state);
+ tevent_req_set_callback(req, trustdom_list_done, state);
}
-static void trustdom_recv(void *private_data, bool success)
+static void trustdom_list_done(struct tevent_req *req)
{
- struct trustdom_state *state =
- talloc_get_type_abort(private_data, struct trustdom_state);
- struct winbindd_response *response = state->response;
+ struct trustdom_state *state = tevent_req_callback_data(
+ req, struct trustdom_state);
+ struct winbindd_response *response;
+ int res, err;
char *p;
- if ((!success) || (response->result != WINBINDD_OK)) {
+ res = wb_domain_request_recv(req, state, &response, &err);
+ if ((res == -1) || (response->result != WINBINDD_OK)) {
DEBUG(1, ("Could not receive trustdoms\n"));
TALLOC_FREE(state);
return;