From dceca3d8ae0220bb8d23325a0a771533bf946217 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 24 May 2010 14:58:07 +1000 Subject: s4:winbind Change idmap API to match that used by the source3/ idmap subsystem This makes it much easier to write an idmap module that bridges the gap. We should finish the change to the new API, but for the moment this choke point works for the conversion. Andrew Bartlett --- source4/winbind/wb_xids2sids.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'source4/winbind/wb_xids2sids.c') diff --git a/source4/winbind/wb_xids2sids.c b/source4/winbind/wb_xids2sids.c index 9d95ac012c..aeec2ee5be 100644 --- a/source4/winbind/wb_xids2sids.c +++ b/source4/winbind/wb_xids2sids.c @@ -33,10 +33,12 @@ struct xids2sids_state { struct composite_context *wb_xids2sids_send(TALLOC_CTX *mem_ctx, struct wbsrv_service *service, - int count, struct id_map *ids) + unsigned int count, struct id_map *ids) { struct composite_context *result; struct xids2sids_state *state; + struct id_map **pointer_array; + unsigned int i; DEBUG(5, ("wb_xids2sids_send called\n")); @@ -52,8 +54,19 @@ struct composite_context *wb_xids2sids_send(TALLOC_CTX *mem_ctx, state->count = count; state->ids = ids; + /* We need to convert between calling conventions here - the + * values are filled in by reference, so we just need to + * provide pointers to them */ + pointer_array = talloc_array(state, struct id_map *, count+1); + if (composite_nomem(pointer_array, result)) return result; + + for (i=0; i < count; i++) { + pointer_array[i] = &ids[i]; + } + pointer_array[i] = NULL; + state->ctx->status = idmap_xids_to_sids(service->idmap_ctx, mem_ctx, - count, state->ids); + pointer_array); if (!composite_is_ok(state->ctx)) return result; composite_done(state->ctx); @@ -69,6 +82,9 @@ NTSTATUS wb_xids2sids_recv(struct composite_context *ctx, DEBUG(5, ("wb_xids2sids_recv called.\n")); + /* We don't have to mess with pointer_array on the way out, as + * the results are filled into the pointers the caller + * supplied */ *ids = state->ids; talloc_free(ctx); -- cgit