summaryrefslogtreecommitdiff
path: root/source3/nsswitch/winbindd_rpc.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-12-05 07:52:44 +0000
committerAndrew Tridgell <tridge@samba.org>2001-12-05 07:52:44 +0000
commitaddea9645d48bc77f88ed3fa724cdd522e2f31ce (patch)
tree7c466475596b1a0936038e41c8e3b1739437d546 /source3/nsswitch/winbindd_rpc.c
parent5329af6e11f9005d27395eb57c1185029d893ae8 (diff)
downloadsamba-addea9645d48bc77f88ed3fa724cdd522e2f31ce.tar.gz
samba-addea9645d48bc77f88ed3fa724cdd522e2f31ce.tar.bz2
samba-addea9645d48bc77f88ed3fa724cdd522e2f31ce.zip
moved the sequence number fetch into the backend, and fetch the
sequence number via ldap when using ads (This used to be commit 9a084f0bb91883224ad44e2b76417d10c15cce42)
Diffstat (limited to 'source3/nsswitch/winbindd_rpc.c')
-rw-r--r--source3/nsswitch/winbindd_rpc.c57
1 files changed, 56 insertions, 1 deletions
diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c
index c04bcdc954..9f1d46b40f 100644
--- a/source3/nsswitch/winbindd_rpc.c
+++ b/source3/nsswitch/winbindd_rpc.c
@@ -402,6 +402,60 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
return result;
}
+/* find the sequence number for a domain */
+static uint32 sequence_number(struct winbindd_domain *domain)
+{
+ TALLOC_CTX *mem_ctx;
+ CLI_POLICY_HND *hnd;
+ SAM_UNK_CTR ctr;
+ 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;
+
+ /* 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;
+
+ 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;
+ DEBUG(10,("domain_sequence_number: for domain %s is %u\n", domain->name, (unsigned)seqnum ));
+ } else {
+ DEBUG(10,("domain_sequence_number: failed to get sequence number (%u) for domain %s\n",
+ (unsigned)seqnum, domain->name ));
+ }
+
+ done:
+
+ if (got_dom_pol)
+ cli_samr_close(hnd->cli, mem_ctx, &dom_pol);
+
+ talloc_destroy(mem_ctx);
+
+ return seqnum;
+}
+
/* the rpc backend methods are exposed via this structure */
struct winbindd_methods msrpc_methods = {
@@ -411,6 +465,7 @@ struct winbindd_methods msrpc_methods = {
sid_to_name,
query_user,
lookup_usergroups,
- lookup_groupmem
+ lookup_groupmem,
+ sequence_number
};