return;
}
+static void winbindd_allocate_gid_recv(TALLOC_CTX *mem_ctx, bool success,
+ struct winbindd_ndr_call *c,
+ void *private_data,
+ void *_cont,
+ void *_cont_private)
+{
+ struct winbindd_cli_state *state =
+ talloc_get_type_abort(private_data, struct winbindd_cli_state);
+ struct winbind_set_idmap *r =
+ talloc_get_type_abort(c->ndr.r, struct winbind_set_idmap);
+
+ if (!success) {
+ DEBUG(5, ("Could not set_idmap(allocate_gid)\n"));
+ request_error(state);
+ return;
+ }
+
+ if (r->out.result != WINBIND_STATUS_OK) {
+ DEBUG(5, ("set_idmap(allocate_gid) returned an error:0x%08X\n",
+ r->out.result));
+ request_error(state);
+ return;
+ }
+
+ if (r->out.rep->gid > UINT32_MAX) {
+ DEBUG(1, ("set_idmap(allocate_gid) returned a 64bit gid %llu\n",
+ (unsigned long long)r->out.rep->gid));
+ request_error(state);
+ return;
+ }
+
+ state->response.data.gid = r->out.rep->gid;
+ request_ok(state);
+}
+
void winbindd_allocate_gid(struct winbindd_cli_state *state)
{
+ struct winbind_set_idmap *r = NULL;
+
if ( !state->privileged ) {
DEBUG(2, ("winbindd_allocate_gid: non-privileged access "
"denied!\n"));
return;
}
- sendto_child(state, idmap_child());
+ r = TALLOC_P(state->mem_ctx, struct winbind_set_idmap);
+ if (!r) goto nomem;
+ r->in.level = TALLOC_P(r, enum winbind_set_idmap_level);
+ if (!r->in.level) goto nomem;
+
+ *r->in.level = WINBIND_SET_IDMAP_LEVEL_ALLOCATE_GID;
+
+ do_async_ndr(state->mem_ctx, idmap_child(),
+ NDR_WINBIND_SET_IDMAP, r,
+ winbindd_allocate_gid_recv, state,
+ NULL, NULL);
+ return;
+nomem:
+ request_error(state);
+ return;
}
enum winbindd_result winbindd_dual_allocate_gid(struct winbindd_domain *domain,