History log of /sssd-io/src/tools/common/sss_tools.c
Revision Date Author Comments Expand
fe58f0fbf34de5931ce3305396e5e4467796a325 10-Apr-2018 Pavel Březina <pbrezina@redhat.com>

sssctl: move check for version error to correct place This check was added here: 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 490) int sss_tool_main(int argc, const char **argv, 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 491) struct sss_route_cmd *commands, 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 492) void *pvt) 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 493) { 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 494) struct sss_tool_ctx *tool_ctx; 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 495) uid_t uid; e98ccef2 (Pavel Březina 2016-06-09 16:13:34 +0200 496) errno_t ret; 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 497) 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 498) uid = getuid(); 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 499) if (uid != 0) { 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 500) DEBUG(SSSDBG_CRIT_FAILURE, "Running under %d, must be root\n", uid); 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 501) ERROR("%1$s must be run as root\n", argv[0]); 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 502) return EXIT_FAILURE; 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 503) } 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 504) a0b824ac (Jakub Hrozek 2016-07-01 13:26:38 +0200 505) ret = sss_tool_init(NULL, &argc, argv, &tool_ctx); a0b824ac (Jakub Hrozek 2016-07-01 13:26:38 +0200 506) if (ret == ERR_SYSDB_VERSION_TOO_OLD) { a0b824ac (Jakub Hrozek 2016-07-01 13:26:38 +0200 507) tool_ctx->init_err = ret; a0b824ac (Jakub Hrozek 2016-07-01 13:26:38 +0200 508) } else if (ret != EOK) { 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 509) DEBUG(SSSDBG_CRIT_FAILURE, "Unable to create tool context\n"); 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 510) return EXIT_FAILURE; 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 511) } But then the initialization code was moved from sss_tool_init to tool_cmd_init which is called from sss_tool_route. a0b824ac (Jakub Hrozek 2016-07-01 13:26:38 +0200 328) if (!sss_tools_handles_init_error(&commands[i], tool_ctx->init_err)) { a0b824ac (Jakub Hrozek 2016-07-01 13:26:38 +0200 329) DEBUG(SSSDBG_FATAL_FAILURE, a0b824ac (Jakub Hrozek 2016-07-01 13:26:38 +0200 330) "Command %s does not handle initialization error [%d] %s\n", a0b824ac (Jakub Hrozek 2016-07-01 13:26:38 +0200 331) cmdline.command, tool_ctx->init_err, a0b824ac (Jakub Hrozek 2016-07-01 13:26:38 +0200 332) sss_strerror(tool_ctx->init_err)); a0b824ac (Jakub Hrozek 2016-07-01 13:26:38 +0200 333) return tool_ctx->init_err; a0b824ac (Jakub Hrozek 2016-07-01 13:26:38 +0200 334) } a0b824ac (Jakub Hrozek 2016-07-01 13:26:38 +0200 335) cbee11e9 (Michal Židek 2016-10-12 13:09:37 +0200 336) ret = tool_cmd_init(tool_ctx, &commands[i]); cbee11e9 (Michal Židek 2016-10-12 13:09:37 +0200 337) if (ret != EOK) { cbee11e9 (Michal Židek 2016-10-12 13:09:37 +0200 338) DEBUG(SSSDBG_FATAL_FAILURE, cbee11e9 (Michal Židek 2016-10-12 13:09:37 +0200 339) "Command initialization failed [%d] %s\n", cbee11e9 (Michal Židek 2016-10-12 13:09:37 +0200 340) ret, sss_strerror(ret)); cbee11e9 (Michal Židek 2016-10-12 13:09:37 +0200 341) return ret; cbee11e9 (Michal Židek 2016-10-12 13:09:37 +0200 342) } cbee11e9 (Michal Židek 2016-10-12 13:09:37 +0200 343) 284937e6 (Pavel Březina 2015-07-22 10:02:02 +0200 344) return commands[i].fn(&cmdline, tool_ctx, pvt); This rendered the original change a dead code, because sss_tool_init only returns ENOMEM or EOK. Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>

b8db8c2d83d1d75c42c1e17145d3907211b3a146 10-Apr-2018 amitkuma <amitkuma@redhat.com>

sssctl: Showing help even when sssd not configured On a clean and unconfigured system, it's not possible to use --help. 1) dnf install sssd-tools 2) sssctl cache-remove --help Shows: [confdb_get_domains] (0x0010): No domains configured, fatal error! Solution: Donot check for confdb initialization when sssctl 3rd command line argument passed is '--help'. Please note when we run 'sssctl --help' on unconfigured system confdb check is not done and proper o/p is seen. Resolves: https://pagure.io/SSSD/sssd/issue/3634 Reviewed-by: Pavel Březina <pbrezina@redhat.com>

f405a4a3694957b5a5cb45d0f7ea2854d876cbb6 26-Mar-2018 Fabiano Fidêncio <fidencio@redhat.com>

TOOLS: Take into consideration app domains In order to properly show an app domain when listing domains using sssctl domain-list we have to expand the confdb, as already done in the monitor code. Resolves: https://pagure.io/SSSD/sssd/issue/3658 Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

37b108ec409711584f111a5e79ff7894b2f22846 13-Oct-2017 Lukas Slebodnik <lslebodn@redhat.com>

TOOLS: Hide option --debug in sssctl Related to old bug https://pagure.io/SSSD/sssd/issue/1224 Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>

d2c614143870e6efd4b3ab20c3a55cf714595256 25-Sep-2017 Justin Stephenson <jstephen@redhat.com>

SSSCTL: Move sss_debuglevel to sssctl debug-level Move code from sss_debuglevel to sssctl_logs.c and add new debug-logs sssctl command to perform the same task of changing debug level dynamically. POPT_CONTEXT_KEEP_FIRST Flag added to poptGetContext call in sssctl_debug_level() to fix argument parsing. Resolves: https://pagure.io/SSSD/sssd/issue/3057 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Michal Židek <mzidek@redhat.com>

a63d74f65db2db7389cd373cb37adcdaaa2d56ea 29-Mar-2017 Michal Židek <mzidek@redhat.com>

SUBDOMAINS: Allow use_fully_qualified_names for subdomains Allow option use_fully_qualified_names in subdomain section. This option was recently added to subdomain_inherit. Resolves: https://pagure.io/SSSD/sssd/issue/3337 Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>

cbee11e912bb391ba254b0bac8c1159c1f634533 27-Oct-2016 Michal Židek <mzidek@redhat.com>

sssctl: Flags for command initialization Allow passing flags for command specific initialization. Currently only one flag is available to skip the confdb initialization which is required to improve config-check command. Resolves: https://fedorahosted.org/sssd/ticket/3209 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>

a0b824ac01c6b58fe6055d48aa6e29e94219646d 07-Jul-2016 Jakub Hrozek <jhrozek@redhat.com>

TOOLS: Some tools command might not need initialization to succeed Since we want to use the sssctl tool during upgrade, we need to amend the tools initialization code to not error out if sysdb can't be instantiated, but rather return errno and let the tool handle the error. Each tool command now has a 'allowed errno' the command is able to handle. In this patch iteration, only a single errno can be handled and only the upgrade command is able to do so. Reviewed-by: Sumit Bose <sbose@redhat.com>

ebbeac5c6b8b87ab478ee5a04ec48fbbba0c9efc 07-Jul-2016 Jakub Hrozek <jhrozek@redhat.com>

SYSDB: Remove useless parameter from sysdb_init() The function sysdb_init() is never used to allow upgrade, so the allow_upgrade parameter was pointless. Reviewed-by: Sumit Bose <sbose@redhat.com>

cca497b4cbbbf05c4f9181b7d8113cde81754831 27-Jun-2016 Michal Židek <mzidek@redhat.com>

confdb: Make it possible to use config snippets Resolves: https://fedorahosted.org/sssd/ticket/2247 Signed-off-by: Lukas Slebodnik <lslebodn@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

d2d8f342cd5e90bb9fd947c448492225f959aa86 27-Jun-2016 Pavel Březina <pbrezina@redhat.com>

sss_tools: create confdb if not exist So tools (especially sssctl) may be run even when databases where removed. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

e98ccef2609811186711b79d8ef5d0a4450ab6e0 27-Jun-2016 Pavel Březina <pbrezina@redhat.com>

sss_tools: return errno_t instead of system code Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

81cde110402e088508053aea79670b38d450cb83 27-Jun-2016 Pavel Březina <pbrezina@redhat.com>

sss_tools: pad help message properly Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

b03ccb2764a4ccdadb77599cb624b6a17b633438 27-Jun-2016 Pavel Březina <pbrezina@redhat.com>

sss_tools: add commands delimiter Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

3bc651a611a3e5be508875f3ae58bfb5ece2525c 27-Jun-2016 Pavel Březina <pbrezina@redhat.com>

sss_tools: tell whether an option was provided Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

a6cd927f298ff5c9a603db5acb6c1b0ebea178c0 27-Jun-2016 Pavel Březina <pbrezina@redhat.com>

sss_tools: unify description of --debug Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

b963ed8079a4a284611d50d1b79695116c40295d 27-Jun-2016 Pavel Březina <pbrezina@redhat.com>

sss_tools: add help commands to usage message Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

cf3ba77997dfbd076a1f30fdbb33c7973766ac03 27-Jun-2016 Pavel Březina <pbrezina@redhat.com>

sss_tools: add command description Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

3a8b5ccf7c27b72054e1d8b3ab355cb1e28efda9 13-Apr-2016 Sumit Bose <sbose@redhat.com>

tools: read additional data of the master domain Resolves: https://fedorahosted.org/sssd/ticket/2989 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>

4940ba14100ad11b0ed1f2a8a4fea5daa34d56ee 30-Oct-2015 Pavel Březina <pbrezina@redhat.com>

sss_tools: do not allow unexpected free argument Reviewed-by: Pavel Reichl <preichl@redhat.com>

16065cc731687eb8779d31b79436bbf79c5e3ed3 30-Oct-2015 Pavel Březina <pbrezina@redhat.com>

sss_tools: always show common and help options popt don't handle merging NULL option table, thus common and help options were not displayed when command doesn't have any options. Reviewed-by: Pavel Reichl <preichl@redhat.com>

877b92e80bde510d5cd9f03dbf01e2bcf73ab072 23-Oct-2015 Michal Židek <mzidek@redhat.com>

util: Update get_next_domain's interface Update get next domain to be able to include disbled domains and change the interface to accept flags instead of multiple booleans. Ticket: https://fedorahosted.org/sssd/ticket/2673 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

/sssd-io/src/confdb/confdb.c /sssd-io/src/db/sysdb_subdomains.c /sssd-io/src/monitor/monitor.c /sssd-io/src/providers/ad/ad_subdomains.c /sssd-io/src/providers/dp_refresh.c /sssd-io/src/providers/ipa/ipa_subdomains.c /sssd-io/src/providers/ipa/ipa_subdomains_server.c /sssd-io/src/providers/ldap/sdap_domain.c /sssd-io/src/responder/autofs/autofssrv_cmd.c /sssd-io/src/responder/common/negcache.c /sssd-io/src/responder/common/responder_cache_req.c /sssd-io/src/responder/common/responder_common.c /sssd-io/src/responder/common/responder_get_domains.c /sssd-io/src/responder/ifp/ifp_cache.c /sssd-io/src/responder/ifp/ifp_domains.c /sssd-io/src/responder/ifp/ifp_groups.c /sssd-io/src/responder/ifp/ifp_users.c /sssd-io/src/responder/nss/nsssrv_cmd.c /sssd-io/src/responder/nss/nsssrv_netgroup.c /sssd-io/src/responder/nss/nsssrv_services.c /sssd-io/src/responder/pam/pamsrv_cmd.c /sssd-io/src/responder/sudo/sudosrv_get_sudorules.c /sssd-io/src/tests/cmocka/test_utils.c sss_tools.c /sssd-io/src/tools/sss_cache.c /sssd-io/src/tools/sss_debuglevel.c /sssd-io/src/tools/sss_override.c /sssd-io/src/util/domain_info_utils.c /sssd-io/src/util/usertools.c /sssd-io/src/util/util.h
bda8039465a0084fb380e878c8f9ea3e900505ea 02-Oct-2015 Pavel Březina <pbrezina@redhat.com>

sss tools: improve option handling The crash describe by ticket #2802 is caused by providing NULL options in popt and yet trying to iterate over them. Instead of simply testing for NULL this patch creates a new option table table merges several option tables together, thus improving and simplifying usage string. Resolves: https://fedorahosted.org/sssd/ticket/2802 Reviewed-by: Pavel Reichl <preichl@redhat.com>

5e2ffb69dcdd157ea422c6aec256111653e4206b 31-Aug-2015 Pavel Březina <pbrezina@redhat.com>

sss_override: document --debug options Resolves: https://fedorahosted.org/sssd/ticket/2758 Reviewed-by: Petr Cech <pcech@redhat.com>

284937e6b5b0c9d7a1d3382d0d2820d1168842fb 27-Jul-2015 Pavel Březina <pbrezina@redhat.com>

TOOLS: add common command framework Add general framework to simplify creating "cmd COMMAND [OPTIONS...]" style tools. Preparation for: https://fedorahosted.org/sssd/ticket/2584 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>