Skip to content

Commit

Permalink
auth: Fix auth CLI commands not being available.
Browse files Browse the repository at this point in the history
* Fix auth-related CLI commands not getting registered.
* Adds new CLI commands to view and manage cached auth info.
  • Loading branch information
InterLinked1 committed Jan 8, 2024
1 parent e0844e9 commit 5ab5155
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bbs/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions bbs/bbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 5ab5155

Please sign in to comment.