summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2007-08-13 16:45:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:01:49 -0500
commit5a0aaafb1b4d196cfc873753e7ae7833c067202b (patch)
treec32545de509e1f5a13c8a524db6539bcbf33d5bb /source4
parenta4439c5a1ff423a56eb299f342dcbb8037db3652 (diff)
downloadsamba-5a0aaafb1b4d196cfc873753e7ae7833c067202b.tar.gz
samba-5a0aaafb1b4d196cfc873753e7ae7833c067202b.tar.bz2
samba-5a0aaafb1b4d196cfc873753e7ae7833c067202b.zip
r24376: Missed this file from the checkin, sorry.
(This used to be commit c81b0980cac901e70e52dfd0eb013ad4d6f15540)
Diffstat (limited to 'source4')
-rw-r--r--source4/winbind/wb_gid2sid.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/source4/winbind/wb_gid2sid.c b/source4/winbind/wb_gid2sid.c
new file mode 100644
index 0000000000..40fd9b6c35
--- /dev/null
+++ b/source4/winbind/wb_gid2sid.c
@@ -0,0 +1,78 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Command backend for wbinfo -G
+
+ Copyright (C) Kai Blin 2007
+
+ 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
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "libcli/composite/composite.h"
+#include "winbind/wb_server.h"
+#include "smbd/service_task.h"
+#include "winbind/wb_helper.h"
+#include "libcli/security/proto.h"
+
+struct gid2sid_state {
+ struct composite_context *ctx;
+ struct wbsrv_service *service;
+ struct dom_sid *sid;
+};
+
+struct composite_context *wb_gid2sid_send(TALLOC_CTX *mem_ctx,
+ struct wbsrv_service *service, uid_t uid)
+{
+ struct composite_context *result;
+ struct gid2sid_state *state;
+
+ 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);
+ if (composite_nomem(state, result)) return result;
+
+ state->ctx = result;
+ result->private_data = state;
+ state->service = service;
+
+ /* FIXME: This is a stub so far.
+ * We cheat by just using the uid as RID with the domain SID.*/
+ state->sid = dom_sid_add_rid(result, service->primary_sid, uid);
+ if (composite_nomem(state->sid, state->ctx)) return result;
+
+ composite_done(state->ctx);
+ return result;
+}
+
+NTSTATUS wb_gid2sid_recv(struct composite_context *ctx, TALLOC_CTX *mem_ctx,
+ struct dom_sid **sid)
+{
+ NTSTATUS status = composite_wait(ctx);
+
+ DEBUG(5, ("wb_gid2sid_recv called.\n"));
+
+ if (NT_STATUS_IS_OK(status)) {
+ struct gid2sid_state *state =
+ talloc_get_type(ctx->private_data,
+ struct gid2sid_state);
+ *sid = talloc_steal(mem_ctx, state->sid);
+ }
+ talloc_free(ctx);
+ return status;
+}
+