svn commit: samba r6669 - in trunk/source/nsswitch: .
vlendec at samba.org
vlendec at samba.org
Sun May 8 19:21:01 GMT 2005
Author: vlendec
Date: 2005-05-08 19:21:01 +0000 (Sun, 08 May 2005)
New Revision: 6669
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6669
Log:
More cleanup
Modified:
trunk/source/nsswitch/winbindd_async.c
trunk/source/nsswitch/winbindd_misc.c
trunk/source/nsswitch/winbindd_util.c
Changeset:
Modified: trunk/source/nsswitch/winbindd_async.c
===================================================================
--- trunk/source/nsswitch/winbindd_async.c 2005-05-08 18:08:48 UTC (rev 6668)
+++ trunk/source/nsswitch/winbindd_async.c 2005-05-08 19:21:01 UTC (rev 6669)
@@ -84,7 +84,33 @@
&state->response, do_async_recv, state);
}
+static void do_async_domain(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
+ const struct winbindd_request *request,
+ void (*cont)(TALLOC_CTX *mem_ctx, BOOL success,
+ struct winbindd_response *response,
+ void *c, void *private),
+ void *c, void *private)
+{
+ struct do_async_state *state;
+ state = TALLOC_ZERO_P(mem_ctx, struct do_async_state);
+ if (state == NULL) {
+ DEBUG(0, ("talloc failed\n"));
+ cont(mem_ctx, False, NULL, c, private);
+ return;
+ }
+
+ state->mem_ctx = mem_ctx;
+ state->request = *request;
+ state->request.length = sizeof(state->request);
+ state->cont = cont;
+ state->c = c;
+ state->private = private;
+
+ async_domain_request(mem_ctx, domain, &state->request,
+ &state->response, do_async_recv, state);
+}
+
static void idmap_set_mapping_recv(TALLOC_CTX *mem_ctx, BOOL success,
struct winbindd_response *response,
void *c, void *private)
@@ -295,8 +321,8 @@
request.cmd = WINBINDD_LOOKUPSID;
fstrcpy(request.data.sid, sid_string_static(sid));
- do_async(mem_ctx, &domain->child, &request, lookupsid_recv,
- cont, private);
+ do_async_domain(mem_ctx, domain, &request, lookupsid_recv,
+ cont, private);
}
enum winbindd_result winbindd_dual_lookupsid(struct winbindd_cli_state *state)
@@ -386,8 +412,8 @@
fstrcpy(request.data.name.dom_name, dom_name);
fstrcpy(request.data.name.name, name);
- do_async(mem_ctx, &domain->child, &request, lookupname_recv,
- cont, private);
+ do_async_domain(mem_ctx, domain, &request, lookupname_recv,
+ cont, private);
}
enum winbindd_result winbindd_dual_lookupname(struct winbindd_cli_state *state)
@@ -552,8 +578,8 @@
fstrcpy(request.domain_name, domain->name);
fstrcpy(request.data.dual_sidaliases.cache_key, keystr);
- do_async(mem_ctx, &domain->child, &request, getsidaliases_recv,
- cont, private);
+ do_async_domain(mem_ctx, domain, &request, getsidaliases_recv,
+ cont, private);
}
enum winbindd_result winbindd_dual_getsidaliases(struct winbindd_cli_state *state)
@@ -689,8 +715,8 @@
request.cmd = WINBINDD_GETUSERDOMGROUPS;
fstrcpy(request.data.sid, sid_string_static(user_sid));
- do_async(mem_ctx, &domain->child, &request, gettoken_recvdomgroups,
- NULL, state);
+ do_async_domain(mem_ctx, domain, &request, gettoken_recvdomgroups,
+ NULL, state);
}
static void gettoken_recvdomgroups(TALLOC_CTX *mem_ctx, BOOL success,
@@ -993,7 +1019,7 @@
ZERO_STRUCT(request);
request.cmd = WINBINDD_DUAL_USERINFO;
sid_to_string(request.data.sid, sid);
- do_async(mem_ctx, &domain->child, &request, query_user_recv,
- cont, private);
+ do_async_domain(mem_ctx, domain, &request, query_user_recv,
+ cont, private);
}
Modified: trunk/source/nsswitch/winbindd_misc.c
===================================================================
--- trunk/source/nsswitch/winbindd_misc.c 2005-05-08 18:08:48 UTC (rev 6668)
+++ trunk/source/nsswitch/winbindd_misc.c 2005-05-08 19:21:01 UTC (rev 6669)
@@ -31,12 +31,20 @@
enum winbindd_result winbindd_check_machine_acct(struct winbindd_cli_state *state)
{
+ struct winbindd_domain *domain;
+
DEBUG(3, ("[%5lu]: check machine account\n",
(unsigned long)state->pid));
- async_request(state->mem_ctx, &find_our_domain()->child,
- &state->request, &state->response,
- request_finished_cont, state);
+ domain = find_our_domain();
+ if (domain == NULL) {
+ DEBUG(0, ("Could not find our domain\n"));
+ return WINBINDD_ERROR;
+ }
+
+ async_domain_request(state->mem_ctx, domain,
+ &state->request, &state->response,
+ request_finished_cont, state);
return WINBINDD_PENDING;
}
@@ -113,9 +121,9 @@
domain = find_our_domain();
- async_request(state->mem_ctx, &domain->child,
- &state->request, &state->response,
- request_finished_cont, state);
+ async_domain_request(state->mem_ctx, domain,
+ &state->request, &state->response,
+ request_finished_cont, state);
return WINBINDD_PENDING;
}
@@ -166,15 +174,24 @@
enum winbindd_result winbindd_getdcname(struct winbindd_cli_state *state)
{
+ struct winbindd_domain *domain;
+
state->request.domain_name
[sizeof(state->request.domain_name)-1] = '\0';
DEBUG(3, ("[%5lu]: Get DC name for %s\n", (unsigned long)state->pid,
state->request.domain_name));
- async_request(state->mem_ctx, &find_our_domain()->child,
- &state->request, &state->response,
- request_finished_cont, state);
+ domain = find_our_domain();
+
+ if (domain == NULL) {
+ DEBUG(0, ("Could not find our domain\n"));
+ return WINBINDD_ERROR;
+ }
+
+ async_domain_request(state->mem_ctx, domain,
+ &state->request, &state->response,
+ request_finished_cont, state);
return WINBINDD_PENDING;
}
Modified: trunk/source/nsswitch/winbindd_util.c
===================================================================
--- trunk/source/nsswitch/winbindd_util.c 2005-05-08 18:08:48 UTC (rev 6668)
+++ trunk/source/nsswitch/winbindd_util.c 2005-05-08 19:21:01 UTC (rev 6669)
@@ -221,7 +221,8 @@
static void trustdom_recv(void *private, BOOL success)
{
extern struct winbindd_methods cache_methods;
- struct trustdom_state *state = private;
+ struct trustdom_state *state =
+ talloc_get_type_abort(private, struct trustdom_state);
struct winbindd_response *response = state->response;
char *p;
@@ -375,7 +376,8 @@
static void init_child_getdc_recv(void *private, BOOL success)
{
- struct init_child_state *state = private;
+ struct init_child_state *state =
+ talloc_get_type_abort(private, struct init_child_state);
const char *dcname = "";
DEBUG(10, ("Received getdcname response\n"));
@@ -396,7 +398,8 @@
static void init_child_recv(void *private, BOOL success)
{
- struct init_child_state *state = private;
+ struct init_child_state *state =
+ talloc_get_type_abort(private, struct init_child_state);
if ((!success) || (state->response->result != WINBINDD_OK)) {
DEBUG(3, ("Could not init child\n"));
More information about the samba-cvs
mailing list