diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-12-09 23:59:42 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-12-09 23:59:42 +0000 |
commit | 31842f5d017f01922cec306f7bfa2fa0fe748ca2 (patch) | |
tree | 3a17ecc634f1079f60fcb81d05d3672d65b84aa0 /source3/nsswitch/winbindd_rpc.c | |
parent | e3d171ff55c7afec6687616a3808637f2d4cf456 (diff) | |
download | samba-31842f5d017f01922cec306f7bfa2fa0fe748ca2.tar.gz samba-31842f5d017f01922cec306f7bfa2fa0fe748ca2.tar.bz2 samba-31842f5d017f01922cec306f7bfa2fa0fe748ca2.zip |
completely new winbindd cache infrastructure
this one looks like just another winbind backend, and has the
following properties:
- does -ve and +ve cacheing of all queries
- can be disabled with -n switch to winbindd
- stores all records packed, so even huge domains are not a problem
for a complete cache
- handles the server being down
- uses sequence numbers for all entries
This fixes a lot of problems with winbindd. Serving from cache is now
*very* fast.
(This used to be commit fddb4f4c04473a60a97212c0c8e143d6a4d68380)
Diffstat (limited to 'source3/nsswitch/winbindd_rpc.c')
-rw-r--r-- | source3/nsswitch/winbindd_rpc.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c index 9f1d46b40f..8a98a2626d 100644 --- a/source3/nsswitch/winbindd_rpc.c +++ b/source3/nsswitch/winbindd_rpc.c @@ -403,7 +403,7 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain, } /* find the sequence number for a domain */ -static uint32 sequence_number(struct winbindd_domain *domain) +static NTSTATUS sequence_number(struct winbindd_domain *domain, uint32 *seq) { TALLOC_CTX *mem_ctx; CLI_POLICY_HND *hnd; @@ -415,8 +415,10 @@ static uint32 sequence_number(struct winbindd_domain *domain) BOOL got_dom_pol = False; uint32 des_access = SEC_RIGHTS_MAXIMUM_ALLOWED; + *seq = DOM_SEQUENCE_NONE; + if (!(mem_ctx = talloc_init())) - return DOM_SEQUENCE_NONE; + return NT_STATUS_NO_MEMORY; /* Get sam handle */ @@ -426,7 +428,7 @@ static uint32 sequence_number(struct winbindd_domain *domain) /* Get domain handle */ result = cli_samr_open_domain(hnd->cli, mem_ctx, &hnd->pol, - des_access, &domain->sid, &dom_pol); + des_access, &domain->sid, &dom_pol); if (!NT_STATUS_IS_OK(result)) goto done; @@ -436,7 +438,7 @@ static uint32 sequence_number(struct winbindd_domain *domain) /* Query domain info */ result = cli_samr_query_dom_info(hnd->cli, mem_ctx, &dom_pol, - switch_value, &ctr); + switch_value, &ctr); if (NT_STATUS_IS_OK(result)) { seqnum = ctr.info.inf2.seq_num; @@ -453,7 +455,9 @@ static uint32 sequence_number(struct winbindd_domain *domain) talloc_destroy(mem_ctx); - return seqnum; + *seq = seqnum; + + return result; } |