Skip to content

Commit

Permalink
TOOLS: get rid of unused void *pvt
Browse files Browse the repository at this point in the history
in the chain `sss_tool_main()` -> ... -> end functions.
  • Loading branch information
alexey-tikhonov committed Sep 4, 2024
1 parent cb3d32e commit 98d502e
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 136 deletions.
10 changes: 4 additions & 6 deletions src/tools/common/sss_tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,7 @@ static int tool_cmd_init(struct sss_tool_ctx *tool_ctx,

static errno_t sss_tool_route(int argc, const char **argv,
struct sss_tool_ctx *tool_ctx,
struct sss_route_cmd *commands,
void *pvt)
struct sss_route_cmd *commands)
{
struct sss_cmdline cmdline;
const char *cmd;
Expand Down Expand Up @@ -347,7 +346,7 @@ static errno_t sss_tool_route(int argc, const char **argv,
}
}

return commands[i].fn(&cmdline, tool_ctx, pvt);
return commands[i].fn(&cmdline, tool_ctx);
}
}

Expand Down Expand Up @@ -527,8 +526,7 @@ errno_t sss_tool_popt(struct sss_cmdline *cmdline,
}

int sss_tool_main(int argc, const char **argv,
struct sss_route_cmd *commands,
void *pvt)
struct sss_route_cmd *commands)
{
struct sss_tool_ctx *tool_ctx;
errno_t ret;
Expand All @@ -539,7 +537,7 @@ int sss_tool_main(int argc, const char **argv,
return EXIT_FAILURE;
}

ret = sss_tool_route(argc, argv, tool_ctx, commands, pvt);
ret = sss_tool_route(argc, argv, tool_ctx, commands);
SYSDB_VERSION_ERROR(ret);
talloc_free(tool_ctx);
if (ret != EOK) {
Expand Down
6 changes: 2 additions & 4 deletions src/tools/common/sss_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ struct sss_cmdline {

typedef errno_t
(*sss_route_fn)(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

#define SSS_TOOL_COMMAND_FLAGS(cmd, msg, fn, flags) \
{cmd, _(msg), fn, flags}
Expand Down Expand Up @@ -90,8 +89,7 @@ errno_t sss_tool_popt(struct sss_cmdline *cmdline,
void *popt_fn_pvt);

int sss_tool_main(int argc, const char **argv,
struct sss_route_cmd *commands,
void *pvt);
struct sss_route_cmd *commands);

errno_t sss_tool_parse_name(TALLOC_CTX *mem_ctx,
struct sss_tool_ctx *tool_ctx,
Expand Down
38 changes: 13 additions & 25 deletions src/tools/sss_override.c
Original file line number Diff line number Diff line change
Expand Up @@ -1410,8 +1410,7 @@ static errno_t group_export(const char *filename,
}

static int override_user_add(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt)
struct sss_tool_ctx *tool_ctx)
{
struct override_user user = {NULL};
errno_t ret;
Expand Down Expand Up @@ -1441,8 +1440,7 @@ static int override_user_add(struct sss_cmdline *cmdline,
}

static int override_user_del(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt)
struct sss_tool_ctx *tool_ctx)
{
struct override_user user = {NULL};
errno_t ret;
Expand Down Expand Up @@ -1473,8 +1471,7 @@ static int override_user_del(struct sss_cmdline *cmdline,
}

static int override_user_find(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt)
struct sss_tool_ctx *tool_ctx)
{
struct sss_domain_info *dom;
bool iterate;
Expand Down Expand Up @@ -1503,8 +1500,7 @@ static int override_user_find(struct sss_cmdline *cmdline,
}

static int override_user_show(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt)
struct sss_tool_ctx *tool_ctx)
{
TALLOC_CTX *tmp_ctx;
struct override_user input = {NULL};
Expand Down Expand Up @@ -1574,8 +1570,7 @@ static int override_user_show(struct sss_cmdline *cmdline,
}

static int override_user_import(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt)
struct sss_tool_ctx *tool_ctx)
{
TALLOC_CTX *tmp_ctx;
struct sss_colondb *db;
Expand Down Expand Up @@ -1657,8 +1652,7 @@ static int override_user_import(struct sss_cmdline *cmdline,
}

static int override_user_export(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt)
struct sss_tool_ctx *tool_ctx)
{
const char *filename = NULL;
errno_t ret;
Expand All @@ -1684,8 +1678,7 @@ static int override_user_export(struct sss_cmdline *cmdline,
}

static int override_group_add(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt)
struct sss_tool_ctx *tool_ctx)
{
struct override_group group = {NULL};
errno_t ret;
Expand Down Expand Up @@ -1715,8 +1708,7 @@ static int override_group_add(struct sss_cmdline *cmdline,
}

static int override_group_del(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt)
struct sss_tool_ctx *tool_ctx)
{
struct override_group group = {NULL};
errno_t ret;
Expand Down Expand Up @@ -1748,8 +1740,7 @@ static int override_group_del(struct sss_cmdline *cmdline,
}

static int override_group_find(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt)
struct sss_tool_ctx *tool_ctx)
{
struct sss_domain_info *dom;
bool iterate;
Expand Down Expand Up @@ -1778,8 +1769,7 @@ static int override_group_find(struct sss_cmdline *cmdline,
}

static int override_group_show(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt)
struct sss_tool_ctx *tool_ctx)
{
TALLOC_CTX *tmp_ctx;
struct override_group input = {NULL};
Expand Down Expand Up @@ -1849,8 +1839,7 @@ static int override_group_show(struct sss_cmdline *cmdline,
}

static int override_group_import(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt)
struct sss_tool_ctx *tool_ctx)
{
TALLOC_CTX *tmp_ctx;
struct sss_colondb *db;
Expand Down Expand Up @@ -1927,8 +1916,7 @@ static int override_group_import(struct sss_cmdline *cmdline,
}

static int override_group_export(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt)
struct sss_tool_ctx *tool_ctx)
{
const char *filename = NULL;
errno_t ret;
Expand Down Expand Up @@ -1971,5 +1959,5 @@ int main(int argc, const char **argv)
SSS_TOOL_LAST
};

return sss_tool_main(argc, argv, commands, NULL);
return sss_tool_main(argc, argv, commands);
}
2 changes: 1 addition & 1 deletion src/tools/sssctl/sssctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,5 +357,5 @@ int main(int argc, const char **argv)
SSS_TOOL_LAST
};

return sss_tool_main(argc, argv, commands, NULL);
return sss_tool_main(argc, argv, commands);
}
75 changes: 25 additions & 50 deletions src/tools/sssctl/sssctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,104 +60,79 @@ errno_t sssctl_systemd_stop(void);
errno_t sssctl_systemd_restart(void);

errno_t sssctl_domain_list(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_domain_status(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_client_data_backup(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_client_data_restore(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_cache_remove(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_cache_expire(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_cache_index(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_logs_remove(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_logs_fetch(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_debug_level(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_analyze(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_user_show(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_group_show(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_netgroup_show(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_config_check(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_user_checks(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_access_report(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_cert_show(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_cert_map(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);
#ifdef BUILD_PASSKEY
errno_t sssctl_passkey_register(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);
#endif /* BUILD_PASSKEY */

errno_t sssctl_cert_eval_rule(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_gpo_show(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_gpo_list(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_gpo_remove(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

errno_t sssctl_gpo_purge(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt);
struct sss_tool_ctx *tool_ctx);

#endif /* _SSSCTL_H_ */
3 changes: 1 addition & 2 deletions src/tools/sssctl/sssctl_access_report.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,7 @@ sssctl_dom_access_reporter_fn get_report_fn(const char *provider)
}

errno_t sssctl_access_report(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx,
void *pvt)
struct sss_tool_ctx *tool_ctx)
{
errno_t ret;
const char *domname = NULL;
Expand Down
Loading

0 comments on commit 98d502e

Please sign in to comment.