summaryrefslogtreecommitdiff
path: root/source3/nsswitch/winbindd_rpc.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-12-03 08:17:46 +0000
committerAndrew Tridgell <tridge@samba.org>2001-12-03 08:17:46 +0000
commitc868fe502bb9ea2b5c5452a49f89ec19ab58f2ba (patch)
tree86edb9b1c7ecf32553539a22e1bd232c99358845 /source3/nsswitch/winbindd_rpc.c
parentb6b84cf7099c3b2cee777cf9514b3e6665a4025f (diff)
downloadsamba-c868fe502bb9ea2b5c5452a49f89ec19ab58f2ba.tar.gz
samba-c868fe502bb9ea2b5c5452a49f89ec19ab58f2ba.tar.bz2
samba-c868fe502bb9ea2b5c5452a49f89ec19ab58f2ba.zip
added name_to_sid to the backend
(This used to be commit 816e40a51af80a7f703c0451304de406deab3dd8)
Diffstat (limited to 'source3/nsswitch/winbindd_rpc.c')
-rw-r--r--source3/nsswitch/winbindd_rpc.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c
index ba428c5aed..fe2540f33d 100644
--- a/source3/nsswitch/winbindd_rpc.c
+++ b/source3/nsswitch/winbindd_rpc.c
@@ -121,10 +121,43 @@ static NTSTATUS enum_dom_groups(struct winbindd_domain *domain,
return status;
}
+/* convert a single name to a sid in a domain */
+static NTSTATUS name_to_sid(struct winbindd_domain *domain,
+ const char *name,
+ DOM_SID *sid,
+ enum SID_NAME_USE *type)
+{
+ TALLOC_CTX *mem_ctx;
+ CLI_POLICY_HND *hnd;
+ NTSTATUS status;
+ DOM_SID *sids = NULL;
+ uint32 *types = NULL;
+ int num_sids;
+
+ if (!(mem_ctx = talloc_init()))
+ return NT_STATUS_NO_MEMORY;
+
+ if (!(hnd = cm_get_lsa_handle(domain->name)))
+ return NT_STATUS_UNSUCCESSFUL;
+
+ status = cli_lsa_lookup_names(hnd->cli, mem_ctx, &hnd->pol, 1, &name,
+ &sids, &types, &num_sids);
+
+ /* Return rid and type if lookup successful */
+ if (NT_STATUS_IS_OK(status)) {
+ sid_copy(sid, &sids[0]);
+ *type = types[0];
+ }
+
+ talloc_destroy(mem_ctx);
+ return status;
+}
+
/* the rpc backend methods are exposed via this structure */
struct winbindd_methods msrpc_methods = {
query_dispinfo,
- enum_dom_groups
+ enum_dom_groups,
+ name_to_sid
};