summaryrefslogtreecommitdiff
path: root/source3/nsswitch/winbindd_util.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-02-26 12:21:01 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-02-26 12:21:01 +0000
commitcee64b535355ed14aa8c9a30f51432563391ea34 (patch)
tree9d884a16c80a9a6a35bcc2cdaec774dfdf9057e6 /source3/nsswitch/winbindd_util.c
parentf7bb6982980abf32b98fee8e2624bb5932554dfe (diff)
downloadsamba-cee64b535355ed14aa8c9a30f51432563391ea34.tar.gz
samba-cee64b535355ed14aa8c9a30f51432563391ea34.tar.bz2
samba-cee64b535355ed14aa8c9a30f51432563391ea34.zip
Kill RID-only and domain+RID madness from winbind.
Now we deal with SIDs in almost all of winbind (a couple of limited exceptions remain, but I'm looking into them - they use non-winbind structs ATM). This has particular benifits in returning out-of-domain SIDs for group membership (Need to look into this a bit more) as well as general code quality. This also removes much of the complexity from the idmap interface, which now only deals with mapping IDs, not with SID->domain translations. Breifly tested, but needs more. Fixes some valgrind-found bugs from my previous commit. Winbind cache chagned to using SID strings in some places, as I could not follow exactly how to save and restore multiple packed sids properly. Andrew Bartlett (This used to be commit 9247cf08c40f016a924d600ac906cfc6a7016777)
Diffstat (limited to 'source3/nsswitch/winbindd_util.c')
-rw-r--r--source3/nsswitch/winbindd_util.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c
index 3fa08029b6..fdbfd92b5a 100644
--- a/source3/nsswitch/winbindd_util.c
+++ b/source3/nsswitch/winbindd_util.c
@@ -271,14 +271,20 @@ BOOL winbindd_lookup_sid_by_name(struct winbindd_domain *domain,
enum SID_NAME_USE *type)
{
NTSTATUS result;
-
+ TALLOC_CTX *mem_ctx;
/* Don't bother with machine accounts */
-
+
if (name[strlen(name) - 1] == '$')
return False;
+ mem_ctx = talloc_init("lookup_sid_by_name for %s\n", name);
+ if (!mem_ctx)
+ return False;
+
/* Lookup name */
- result = domain->methods->name_to_sid(domain, name, sid, type);
+ result = domain->methods->name_to_sid(domain, mem_ctx, name, sid, type);
+
+ talloc_destroy(mem_ctx);
/* Return rid and type if lookup successful */
if (!NT_STATUS_IS_OK(result)) {
@@ -528,3 +534,20 @@ int winbindd_num_clients(void)
{
return _num_clients;
}
+
+/* Help with RID -> SID conversion */
+
+DOM_SID *rid_to_talloced_sid(struct winbindd_domain *domain,
+ TALLOC_CTX *mem_ctx,
+ uint32 rid)
+{
+ DOM_SID *sid;
+ sid = talloc(mem_ctx, sizeof(*sid));
+ if (!sid) {
+ smb_panic("rid_to_to_talloced_sid: talloc for DOM_SID failed!\n");
+ }
+ sid_copy(sid, &domain->sid);
+ sid_append_rid(sid, rid);
+ return sid;
+}
+