diff --git a/bbs/auth.c b/bbs/auth.c index 2082cd4..4fbedf1 100644 --- a/bbs/auth.c +++ b/bbs/auth.c @@ -810,8 +810,27 @@ static int cli_authproviders(struct bbs_cli_args *a) return 0; } +static int cli_cachedauth_list(struct bbs_cli_args *a) +{ + struct cached_login *l; + bbs_dprintf(a->fdout, "%-15s %s\n", "Username", "IP"); + RWLIST_TRAVERSE(&cached_logins, l, entry) { + bbs_dprintf(a->fdout, "%-15s %s\n", S_IF(l->username), S_IF(l->ip)); + } + return 0; +} + +static int cli_cachedauth_clear(struct bbs_cli_args *a) +{ + UNUSED(a); + RWLIST_WRLOCK_REMOVE_ALL(&cached_logins, entry, cached_login_destroy); + return 0; +} + static struct bbs_cli_entry cli_commands_auth[] = { BBS_CLI_COMMAND(cli_authproviders, "authproviders", 1, "List all auth providers", NULL), + BBS_CLI_COMMAND(cli_cachedauth_list, "cachedauth list", 2, "List all cached authentication", NULL), + BBS_CLI_COMMAND(cli_cachedauth_clear, "cachedauth clear", 2, "Clear all cached authentication", NULL), }; static int check_authproviders(void) diff --git a/bbs/bbs.c b/bbs/bbs.c index 192b8b4..c2cba68 100644 --- a/bbs/bbs.c +++ b/bbs/bbs.c @@ -999,6 +999,7 @@ int main(int argc, char *argv[]) CHECK_INIT(bbs_init_system()); CHECK_INIT(bbs_transfer_config_load()); CHECK_INIT(bbs_mail_init()); + CHECK_INIT(bbs_init_auth()); CHECK_INIT(bbs_groups_init()); CHECK_INIT(bbs_load_menus(0)); CHECK_INIT(bbs_init_menu_handlers());