diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-03-28 00:44:14 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-03-28 00:44:14 +0100 |
commit | 18d80bdf1fc5a281358aef29324230698eb434d4 (patch) | |
tree | e2515f11577052f42a227bc04541d572d7f2e1ff /source4/winbind/wb_gid2sid.c | |
parent | ac604330871504e88e4bcd37433bbf3717d97a88 (diff) | |
parent | e15b35e3897e63b9e815a04101436439d4aebdef (diff) | |
download | samba-18d80bdf1fc5a281358aef29324230698eb434d4.tar.gz samba-18d80bdf1fc5a281358aef29324230698eb434d4.tar.bz2 samba-18d80bdf1fc5a281358aef29324230698eb434d4.zip |
Merge v4.0-test
(This used to be commit 977dbdeaf363c8905ed9fd0570eba4be80582833)
Diffstat (limited to 'source4/winbind/wb_gid2sid.c')
-rw-r--r-- | source4/winbind/wb_gid2sid.c | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/source4/winbind/wb_gid2sid.c b/source4/winbind/wb_gid2sid.c index f2577029aa..834d869845 100644 --- a/source4/winbind/wb_gid2sid.c +++ b/source4/winbind/wb_gid2sid.c @@ -3,7 +3,7 @@ Command backend for wbinfo -G - Copyright (C) Kai Blin 2007 + Copyright (C) 2007-2008 Kai Blin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,35 +33,60 @@ struct gid2sid_state { struct dom_sid *sid; }; +static void gid2sid_recv_sid(struct composite_context *ctx); + struct composite_context *wb_gid2sid_send(TALLOC_CTX *mem_ctx, struct wbsrv_service *service, gid_t gid) { - struct composite_context *result; + struct composite_context *result, *ctx; struct gid2sid_state *state; + struct unixid *unixid; + struct id_mapping *ids; DEBUG(5, ("wb_gid2sid_send called\n")); result = composite_create(mem_ctx, service->task->event_ctx); if (!result) return NULL; - state = talloc(mem_ctx, struct gid2sid_state); + state = talloc(result, struct gid2sid_state); if (composite_nomem(state, result)) return result; state->ctx = result; result->private_data = state; state->service = service; - state->ctx->status = idmap_gid_to_sid(service->idmap_ctx, mem_ctx, gid, - &state->sid); - if (NT_STATUS_EQUAL(state->ctx->status, NT_STATUS_RETRY)) { - state->ctx->status = idmap_gid_to_sid(service->idmap_ctx, - mem_ctx, gid, - &state->sid); + unixid = talloc(result, struct unixid); + if (composite_nomem(unixid, result)) return result; + unixid->id = gid; + unixid->type = ID_TYPE_GID; + + ids = talloc(result, struct id_mapping); + if (composite_nomem(ids, result)) return result; + ids->unixid = unixid; + ids->sid = NULL; + + ctx = wb_xids2sids_send(result, service, 1, ids); + if (composite_nomem(ctx, result)) return result; + + composite_continue(result, ctx, gid2sid_recv_sid, state); + return result; +} + +static void gid2sid_recv_sid(struct composite_context *ctx) +{ + struct gid2sid_state *state = talloc_get_type(ctx->async.private_data, + struct gid2sid_state); + struct id_mapping *ids = NULL; + state->ctx->status = wb_xids2sids_recv(ctx, &ids); + if (!composite_is_ok(state->ctx)) return; + + if (!NT_STATUS_IS_OK(ids->status)) { + composite_error(state->ctx, ids->status); + return; } - if (!composite_is_ok(state->ctx)) return result; + state->sid = ids->sid; composite_done(state->ctx); - return result; } NTSTATUS wb_gid2sid_recv(struct composite_context *ctx, TALLOC_CTX *mem_ctx, |