mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
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>
This commit is contained in:
parent
03282bfd41
commit
f065100639
@ -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,
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user