summaryrefslogtreecommitdiff
path: root/source3/nsswitch/winbindd_cache.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-11-15 06:55:56 +0000
committerTim Potter <tpot@samba.org>2001-11-15 06:55:56 +0000
commitc32b4b61610338f12093f3ad552c27b4f972e8fd (patch)
tree6e75b4a4f64eb930e5566b6975f2e9ddae354b1f /source3/nsswitch/winbindd_cache.c
parent1539c2f34b52b3fbc7ff2f9e7515f04f5aaf0f5d (diff)
downloadsamba-c32b4b61610338f12093f3ad552c27b4f972e8fd.tar.gz
samba-c32b4b61610338f12093f3ad552c27b4f972e8fd.tar.bz2
samba-c32b4b61610338f12093f3ad552c27b4f972e8fd.zip
Caching user, group and domain sam handles was a stupid idea.
Now we just keep a record of the open pipes. (This used to be commit 77c287e9460eed7bde7004c7e6c8cb0099c6ba6f)
Diffstat (limited to 'source3/nsswitch/winbindd_cache.c')
-rw-r--r--source3/nsswitch/winbindd_cache.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/source3/nsswitch/winbindd_cache.c b/source3/nsswitch/winbindd_cache.c
index 00e1905d76..02639f25fb 100644
--- a/source3/nsswitch/winbindd_cache.c
+++ b/source3/nsswitch/winbindd_cache.c
@@ -56,20 +56,40 @@ static uint32 domain_sequence_number(struct winbindd_domain *domain)
uint16 switch_value = 2;
NTSTATUS result;
uint32 seqnum = DOM_SEQUENCE_NONE;
+ POLICY_HND dom_pol;
+ BOOL got_dom_pol = False;
+ uint32 des_access = SEC_RIGHTS_MAXIMUM_ALLOWED;
if (!(mem_ctx = talloc_init()))
return DOM_SEQUENCE_NONE;
- if (!(hnd = cm_get_sam_dom_handle(domain->name, &domain->sid)))
+ /* Get sam handle */
+
+ if (!(hnd = cm_get_sam_handle(domain->name)))
+ goto done;
+
+ /* Get domain handle */
+
+ result = cli_samr_open_domain(hnd->cli, mem_ctx, &hnd->pol,
+ des_access, &domain->sid, &dom_pol);
+
+ if (!NT_STATUS_IS_OK(result))
goto done;
- result = cli_samr_query_dom_info(hnd->cli, mem_ctx, &hnd->pol,
+ got_dom_pol = True;
+
+ /* Query domain info */
+
+ result = cli_samr_query_dom_info(hnd->cli, mem_ctx, &dom_pol,
switch_value, &ctr);
if (NT_STATUS_IS_OK(result))
seqnum = ctr.info.inf2.seq_num;
done:
+ if (got_dom_pol)
+ cli_samr_close(hnd->cli, mem_ctx, &dom_pol);
+
talloc_destroy(mem_ctx);
return seqnum;