}
static void query_user_recv(TALLOC_CTX *mem_ctx, bool success,
- struct winbindd_response *response,
- void *c, void *private_data)
+ struct winbindd_ndr_call *c,
+ void *_private_data,
+ void *_cont,
+ void *cont_private)
{
- void (*cont)(void *priv, bool succ, const char *acct_name,
- const char *full_name, const char *homedir,
- const char *shell, uint32 gid, uint32 group_rid) =
+ void (*cont)(void *private_data, bool success,
+ const char *acct_name,
+ const char *full_name,
+ const char *homedir,
+ const char *shell,
+ gid_t gid,
+ uint32 group_rid) =
(void (*)(void *, bool, const char *, const char *,
- const char *, const char *, uint32, uint32))c;
+ const char *,const char *, gid_t, uint32_t))_cont;
+ struct winbind_lookup *r =
+ talloc_get_type_abort(_private_data, struct winbind_lookup);
if (!success) {
- DEBUG(5, ("Could not trigger query_user\n"));
- cont(private_data, False, NULL, NULL, NULL, NULL, -1, -1);
+ DEBUG(5, ("Could not trigger lookup(sid2userinfo)\n"));
+ TALLOC_FREE(r);
+ cont(cont_private, false, NULL, NULL, NULL, NULL, (gid_t)-1, 0);
return;
}
- if (response->result != WINBINDD_OK) {
- DEBUG(5, ("query_user returned an error\n"));
- cont(private_data, False, NULL, NULL, NULL, NULL, -1, -1);
+ if (r->out.result != WINBIND_STATUS_OK) {
+ DEBUG(5, ("Could not trigger lookup(sid2userinfo): 0x%08X\n",
+ r->out.result));
+ TALLOC_FREE(r);
+ cont(cont_private, false, NULL, NULL, NULL, NULL, (gid_t)-1, 0);
return;
}
- cont(private_data, True, response->data.user_info.acct_name,
- response->data.user_info.full_name,
- response->data.user_info.homedir,
- response->data.user_info.shell,
- response->data.user_info.primary_gid,
- response->data.user_info.group_rid);
+ cont(cont_private, true,
+ r->out.rep->user_info.account,
+ r->out.rep->user_info.gecos,
+ r->out.rep->user_info.homedir,
+ r->out.rep->user_info.shell,
+ r->out.rep->user_info.primary_gid,
+ r->out.rep->user_info.primary_rid);
}
void query_user_async(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
uint32 group_rid),
void *private_data)
{
- struct winbindd_request request;
- ZERO_STRUCT(request);
- request.cmd = WINBINDD_DUAL_USERINFO;
- sid_to_fstring(request.data.sid, sid);
- do_async_domain(mem_ctx, domain, &request, query_user_recv,
- (void *)cont, private_data);
+ struct winbind_lookup *r = NULL;
+
+ r = TALLOC_P(mem_ctx, struct winbind_lookup);
+ if (!r) goto nomem;
+ r->in.level = TALLOC_P(r, enum winbind_lookup_level);
+ if (!r->in.level) goto nomem;
+
+ *r->in.level = WINBIND_LOOKUP_LEVEL_SID2USERINFO;
+ r->in.req.sid = sid_dup_talloc(r, sid);
+ if (!r->in.req.sid) goto nomem;
+
+ do_async_ndr_domain(mem_ctx, domain,
+ NDR_WINBIND_LOOKUP, r,
+ query_user_recv, r,
+ (void *)cont, private_data);
+ return;
+nomem:
+ TALLOC_FREE(r);
+ cont(private_data, false, NULL, NULL, NULL, NULL, (gid_t)-1, 0);
+ return;
}