summaryrefslogtreecommitdiff
path: root/source4/winbind
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2007-08-13 15:22:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:01:44 -0500
commitf4b928fbf2bc29a48f3d75b59cac0dfadb0285a7 (patch)
tree719d21064511d87c9bc27fbe9c70cd1c36185361 /source4/winbind
parent0188d0c9a3117c61ed92db7d48b7356092a23dc4 (diff)
downloadsamba-f4b928fbf2bc29a48f3d75b59cac0dfadb0285a7.tar.gz
samba-f4b928fbf2bc29a48f3d75b59cac0dfadb0285a7.tar.bz2
samba-f4b928fbf2bc29a48f3d75b59cac0dfadb0285a7.zip
r24365: Implemet backend for wbinfo -S, sid2uid
(This used to be commit 682e7124fb4218ce599fdcea1399b6a7a46079e2)
Diffstat (limited to 'source4/winbind')
-rw-r--r--source4/winbind/config.mk1
-rw-r--r--source4/winbind/wb_sid2uid.c78
2 files changed, 79 insertions, 0 deletions
diff --git a/source4/winbind/config.mk b/source4/winbind/config.mk
index 79dc4b6315..2033c8a225 100644
--- a/source4/winbind/config.mk
+++ b/source4/winbind/config.mk
@@ -16,6 +16,7 @@ OBJ_FILES = \
wb_dom_info_trusted.o \
wb_sid2domain.o \
wb_name2domain.o \
+ wb_sid2uid.o \
wb_connect_lsa.o \
wb_connect_sam.o \
wb_cmd_lookupname.o \
diff --git a/source4/winbind/wb_sid2uid.c b/source4/winbind/wb_sid2uid.c
new file mode 100644
index 0000000000..449596ef38
--- /dev/null
+++ b/source4/winbind/wb_sid2uid.c
@@ -0,0 +1,78 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Map a SID to a uid
+
+ 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 sid2uid_state {
+ struct composite_context *ctx;
+ struct wbsrv_service *service;
+ uid_t uid;
+};
+
+struct composite_context *wb_sid2uid_send(TALLOC_CTX *mem_ctx,
+ struct wbsrv_service *service, const struct dom_sid *sid)
+{
+ struct composite_context *result;
+ struct sid2uid_state *state;
+
+ DEBUG(5, ("wb_sid2uid_send called\n"));
+
+ result = composite_create(mem_ctx, service->task->event_ctx);
+ if (!result) return NULL;
+
+ state = talloc(result, struct sid2uid_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. */
+ state->ctx->status = dom_sid_split_rid(result, sid, NULL, &state->uid);
+ if(!composite_is_ok(state->ctx)) return result;
+
+ DEBUG(5, ("Rid is %d\n", state->uid));
+
+ composite_done(state->ctx);
+ return result;
+}
+
+NTSTATUS wb_sid2uid_recv(struct composite_context *ctx, uid_t *uid)
+{
+ NTSTATUS status = composite_wait(ctx);
+
+ DEBUG(5, ("wb_sid2uid_recv called\n"));
+
+ if (NT_STATUS_IS_OK(status)) {
+ struct sid2uid_state *state =
+ talloc_get_type(ctx->private_data,
+ struct sid2uid_state);
+ *uid = state->uid;
+ }
+ talloc_free(ctx);
+ return status;
+}
+