diff options
author | Uri Simchoni <urisimchoni@gmail.com> | 2015-07-13 21:08:16 +0300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2015-07-15 22:41:13 +0200 |
commit | f065100639cc31de03970d41ee82a3e0ddce9c2d (patch) | |
tree | 516e59973ce6ac7a0d934e1b3b3d3422e62da2a2 /source3 | |
parent | 03282bfd41a90a1c725d8831ee6ae7ccea07e6a2 (diff) | |
download | samba-f065100639cc31de03970d41ee82a3e0ddce9c2d.tar.gz |
winbindd: add service routines to support a sorted client list
Add some routines that support keeping the client list sorted
(by last access time) and traversing the list from oldest to
newest
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11397
Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/winbindd/winbindd_proto.h | 4 | ||||
-rw-r--r-- | source3/winbindd/winbindd_util.c | 22 |
2 files changed, 26 insertions, 0 deletions
diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h index 5ad69e244fc..9920a3f3e7a 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -430,8 +430,12 @@ char *fill_domain_username_talloc(TALLOC_CTX *ctx, const char *user, bool can_assume); struct winbindd_cli_state *winbindd_client_list(void); +struct winbindd_cli_state *winbindd_client_list_tail(void); +struct winbindd_cli_state * +winbindd_client_list_prev(struct winbindd_cli_state *cli); void winbindd_add_client(struct winbindd_cli_state *cli); void winbindd_remove_client(struct winbindd_cli_state *cli); +void winbindd_promote_client(struct winbindd_cli_state *cli); int winbindd_num_clients(void); NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx, diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index d73327c311b..0108504e72a 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -1206,6 +1206,21 @@ struct winbindd_cli_state *winbindd_client_list(void) return _client_list; } +/* Return list-tail of all connected clients */ + +struct winbindd_cli_state *winbindd_client_list_tail(void) +{ + return DLIST_TAIL(_client_list); +} + +/* Return previous (read:newer) client in list */ + +struct winbindd_cli_state * +winbindd_client_list_prev(struct winbindd_cli_state *cli) +{ + return DLIST_PREV(cli); +} + /* Add a connection to the list */ void winbindd_add_client(struct winbindd_cli_state *cli) @@ -1222,6 +1237,13 @@ void winbindd_remove_client(struct winbindd_cli_state *cli) _num_clients--; } +/* Move a client to head or list */ + +void winbindd_promote_client(struct winbindd_cli_state *cli) +{ + DLIST_PROMOTE(_client_list, cli); +} + /* Return number of open clients */ int winbindd_num_clients(void) |