summaryrefslogtreecommitdiffstats
path: root/src/tools
Commit message (Collapse)AuthorAgeFilesLines
* SSSCTL: Add cache-expire commandJustin Stephenson2017-09-253-0/+49
| | | | | | | | | Add sssctl cache-expire as a wrapper for the sss_cache utility to invalidate cached objects. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Michal Židek <mzidek@redhat.com>
* SSSCTL: Replace sss_debuglevel with shell wrapperJustin Stephenson2017-09-251-0/+4
| | | | | | | | | | | | | The sss_debuglevel binary is replaced by a shell wrapper calling sssctl debug-level as part of merging sss_debuglevel into sssctl. The wrapper will redirect sss_debuglevel to the sssctl debug-level command performing the same task. The sss_debuglevel(8) man page is updated to indicate that sss_debuglevel is deprecated and functionality exists now in sssctl. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Michal Židek <mzidek@redhat.com>
* SSSCTL: Move sss_debuglevel to sssctl debug-levelJustin Stephenson2017-09-256-331/+303
| | | | | | | | | | | | | | | | 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>
* SSSCTL: Use get_ prefix for the sssctl_attr_fn functionsFabiano Fidêncio2017-09-251-19/+19
| | | | | | | | As done for the attr_name_fn to avoid "-Wshadow", let's be consistent and do the same for all the other sssctl_attr_fn functions. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* SSSCTL: Fix "-Wunitialized" caught by GCCFabiano Fidêncio2017-09-251-1/+1
| | | | | | | This warning only happens when building SSSD on RHEL6. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* SSSCTL: Fix "-Wshadow" warning caught by GCCFabiano Fidêncio2017-09-251-6/+6
| | | | | | | This warning only happens when building SSSD on RHEL6. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TOOLS: Fix "-Wstack-protector" caught by GCCFabiano Fidêncio2017-09-251-4/+3
| | | | | | | This warning only happens when building SSSD on RHEL6. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* UTIL: move {files,selinux}.c under util directoryFabiano Fidêncio2017-08-286-916/+4
| | | | | | | | | | | | | | | | | | | | | | | | | files.c has at least one function that will be re-used for the new session provider that's about to be added. Also, a few other functions may be added and files.c seems the right place for those. selinux.c has been moved together with files.c as the latter takes advantage of some functions from the former and we do not want to always link agains the tools code. The public functions from files.c got a "sss_" prefix and it has been changed whenever they're used. Last but not least, all the places that included "tools/tools_util.h" due to the functions on files.c had this include removed (as they were already including "util/util.h". Related: https://pagure.io/SSSD/sssd/issue/2995 Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* Fix minor typosYuri Chornoivan2017-08-161-1/+1
| | | | | | Merges: https://pagure.io/SSSD/sssd/pull-request/3456 Reviewed-by: Michal Židek <mzidek@redhat.com>
* SSSCTL: Add parent or trusted domain typeJustin Stephenson2017-06-081-0/+50
| | | | | | | | | | | | Add verbose option to sssctl domain-list, when this option is provided SSSD will print the domain type(primary or trusted domain) retrieved from infopipe API, in addition to the domain name. Resolves: https://pagure.io/SSSD/sssd/issue/3065 Reviewed-by: Michal Židek <mzidek@redhat.com> Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
* UTIL: Remove signal.h from util/util.hLukas Slebodnik2017-06-084-0/+4
| | | | | | | | signal.h is not used directly by util/util.h. The header file signal.h must be included in 8 files and removing it from util.h it had to be added only to 5 missing file. But util/util.h is include in 377 files Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
* sssctl: show user name used for authentication in user-checksSumit Bose2017-06-011-1/+10
| | | | | | | | | | Since there are cases where the user name is not entered directly but determined by other means the user-checks should show the name of the user used for authentication. Related to https://pagure.io/SSSD/sssd/issue/3395 Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
* CONFDB: Use default configuration with missing sssd.confLukas Slebodnik2017-05-231-2/+3
| | | | | | | | Resolves: https://pagure.io/SSSD/sssd/issue/3339 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* config-check: Message when sssd.conf is missingMichal Židek2017-04-101-1/+4
| | | | | | | | | | sssctl config-check should print a message for user if no sssd.conf was found. Resolves: https://pagure.io/SSSD/sssd/issue/3330 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* sssctl: integrate pam_test_client into sssctlSumit Bose2017-04-103-0/+295
| | | | Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* SUBDOMAINS: Allow use_fully_qualified_names for subdomainsMichal Židek2017-03-292-2/+2
| | | | | | | | | | 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>
* sss_cache: User/groups invalidation in domain cachePetr Čech2017-03-081-0/+26
| | | | | | | | | | | | | | | | | | When a group/users are invalidated from sss_cache, the group/user information in domain and timestamps cache are inconsistent with regard to dataExpireTimestamp attribute. This patch fixes the problem by explicitly invalidating the domain cache's entry when the timestamp cache entry is invalidated by sss_cache call. There is one new function: * sysdb_invalidate_cache_entry() provided for this purpose and used only in sss_cache utility. Resolves: https://fedorahosted.org/sssd/ticket/3164 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
* SYSTEMD: Don't mix up responders' socket and monitor activationFabiano Fidêncio2017-03-021-0/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | Let's ensure that in case a responder is explicitly configured in the sssd.conf its socket won't even start. The patchset introduces a new binary that will be distributed and will be called before starting the responders' sockets, ensuring the sockets will only start in case the responder is supposed to be socket-activated and its been configured accordingly. Otherwise the responders' socket startup will fail with a quite helpful debug message leading the admins to choose between using systemd or not and what has to be done to achieve their desire. This suggestion came from Sumit Bose. The reason for adding a new binary instead of a simple python script is to avoid dragging unnecessary dependencies to sssd-common package. Resolves: https://pagure.io/SSSD/sssd/issue/3300 Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* sssctl: Fix warning may be used uninitializedLukas Slebodnik2017-02-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | gcc 7 probably does some new optimisations which might cause few wariables to be uninitialized. src/tools/sssctl/sssctl_cache.c: In function ‘sssctl_print_object’: src/tools/sssctl/sssctl_cache.c:523:13: error: ‘dom’ may be used uninitialized in this function [-Werror=maybe-uninitialized] ret = info[i].attr_fn(tmp_ctx, entry, dom, info[i].attr, &value); ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/tools/sssctl/sssctl_cache.c:472:15: error: ‘entry’ may be used uninitialized in this function [-Werror=maybe-uninitialized] *_entry = talloc_steal(mem_ctx, entry); ^~~~~~~~~~~~ src/tools/sssctl/sssctl_cache.c:437:25: note: ‘entry’ was declared here struct sysdb_attrs *entry; ^~~~~ Another workaround would be to remove static modifier from function sssctl_find_object which probably prevents some inlinig + optimisation. Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
* TOOLS: Fix warning format-truncationLukas Slebodnik2017-02-011-2/+2
| | | | | | | | | | | | | | | src/tools/sss_groupshow.c: In function ‘print_group_info’: src/tools/sss_groupshow.c:612:22: error: ‘%d’ directive output truncated writing between 10 and 11 bytes into a region of size 7 [-Werror=format-truncation=] snprintf(fmt, 8, "%%%ds", level*PADDING_SPACES); ^~~~~~~ src/tools/sss_groupshow.c:612:22: note: using the range [-2147483648, 2147483647] for directive argument src/tools/sss_groupshow.c:612:5: note: ‘snprintf’ output between 13 and 14 bytes into a destination of size 8 snprintf(fmt, 8, "%%%ds", level*PADDING_SPACES); Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
* sssctl: Case insensitive filtersMichal Židek2016-12-151-0/+8
| | | | | | | | | Lowercase the filter in case insensitive domains. Resolves: https://fedorahosted.org/sssd/ticket/3235 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sssctl: Search by aliasMichal Židek2016-12-151-2/+4
| | | | | | | | | Also search by alias when using sssctl to query the cache. Resolves: https://fedorahosted.org/sssd/ticket/3235 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sssctl: Fix missing declarationLukas Slebodnik2016-11-251-0/+1
| | | | | | | | | | | | | | | | | | | | The WEXITSTATUS is defined in stdlib.h on linux. There is a nice comment in stdlib.h: /* Define the macros <sys/wait.h> also would define this way. */ It's better to not rely on this and use more platfom friendly way with including "sys/wait.h". For example the libc on FreeBSD does not provide WEXITSTATUS in stdlib.h. I found this macro mentioned only in the manual page for wait(2) and there is mentioned just the "sys/wait.h" and not "stdlib.h" src/tools/sssctl/sssctl.c: In function 'sssctl_run_command': src/tools/sssctl/sssctl.c:110: error: implicit declaration of function 'WEXITSTATUS' gmake[2]: *** [Makefile:22383: src/tools/sssctl/sssctl-sssctl.o] Error 1 Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
* sssctl: Flags for command initializationMichal Židek2016-10-273-44/+63
| | | | | | | | | | | 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>
* sssctl: Fix a typo in preprocessor macroJakub Hrozek2016-10-141-1/+1
| | | | Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* sssctl: call service with absolute pathPavel Březina2016-10-111-3/+3
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sssctl: use systemd D-Bus APIPavel Březina2016-10-113-10/+153
| | | | | | | | | If systemd is used we leverage it's D-Bus API instead of running systemctl. Resolves: https://fedorahosted.org/sssd/ticket/3056 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sss_cache: improve option argument handlingJustin Stephenson2016-10-101-0/+8
| | | | | | | | | | Print informational message and exit when multiple arguments are provided for single-argument options with sss_cache Resolves: https://fedorahosted.org/sssd/ticket/3180 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* Remove double semicolon at the end of lineLukas Slebodnik2016-09-211-1/+1
| | | | Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* TOOLS: sss_groupshow fails to show MPGMichal Židek2016-09-131-2/+10
| | | | | | | | | | | The MPG search uses it's own search function that used sysdb operation with shortname, but it expects internal fqname. Resolves: https://fedorahosted.org/sssd/ticket/3184 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TOOLS: sss_override without name overrideMichal Židek2016-09-131-10/+14
| | | | | | | | | | sss_override failed to export user/group overrides if user had no overrides for name. Resolves: https://fedorahosted.org/sssd/ticket/3179 Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* TOOLS: sss_mc_refresh_nested_group short/fqname usageMichal Židek2016-09-071-19/+47
| | | | | | | | | | | We use shortname to refresh memory cache, but in case of nested groups, we used internal_fqname to refresh parent groups. We also wrongly used the shortname for sysdb_search operation. Which caused error message to be printed when sss_usermod -a or sss_groupmod -a where called. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TOOLS: use internal fqdn for DNMichal Židek2016-09-071-1/+10
| | | | | | | | | Use internal fqdn when creating sysdb group dn. Resolves: https://fedorahosted.org/sssd/ticket/3178 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TOOLS: sss_groupshow did not workMichal Židek2016-09-071-2/+11
| | | | | | | | | | | | sss_groupshow used shortname to search in sysdb database. We have to u e sysdb_fqname (aka internal_fqname) format for all sysdb oprations. Resolves: https://fedorahosted.org/sssd/ticket/3175 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TOOLS: Fix a typo in groupadd()Jakub Hrozek2016-09-071-1/+1
| | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/3173 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* SSSCTL: More helpful error message when InfoPipe is disabledJustin Stephenson2016-08-181-1/+3
| | | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/3130 Reviewed-by: Petr Čech <pcech@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* sssctl: print active server and server listPavel Březina2016-08-161-7/+175
| | | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/3069 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sssctl: use talloc with sifpPavel Březina2016-08-163-34/+88
| | | | | | | | This way we completely move D-Bus memory management to talloc and we reduce number of code lines needed to send and receive reply. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: add utility function to simplify message and reply handlingPavel Březina2016-08-161-25/+7
| | | | | | | | | | | This patch adds the ability to hook DBusMessage to a talloc context to remove the need of calling dbus_message_unref(). It also provides an automatical way to detect error in a reply so the caller does not need to parse it manually and the whole code around DBusError can be avoided. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sssctl: use internal API to remove filesPavel Březina2016-08-092-5/+4
| | | | Reviewed-by: Petr Cech <pcech@redhat.com>
* utils: add remove_subtreePavel Březina2016-08-092-7/+29
| | | | | | | Remove all entries in a directory but will not remove the directory itself. Reviewed-by: Petr Cech <pcech@redhat.com>
* UTILS: Fixing duplication of pid file declarationPetr Cech2016-08-092-6/+0
| | | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/2978 Reviewed-by: Fabiano Fidêncio <fabiano@fidencio.org> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sssctl: Generic help for cache-upgrade and config-checkMichal Židek2016-08-092-0/+12
| | | | | | | | | | | sssctl COMMAND --help should print at least generic help, even if the command does not accept any command specific options. Resolves: https://fedorahosted.org/sssd/ticket/3086 Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* tools: Add missing gettext macroMichal Židek2016-08-051-1/+1
| | | | | | The message in SSS_TOOL_DELIMITER should be translated. Reviewed-by: Petr Čech <pcech@redhat.com>
* sssctl: Consistent commands namingMichal Židek2016-08-058-68/+69
| | | | | | | | | | | Use TOPIC-ACTION pattern for sssctl command names. Resolves: https://fedorahosted.org/sssd/ticket/3087 Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* Amend debug messages after failure of unlinkLukas Slebodnik2016-07-252-4/+6
| | | | | | | | Some messages did not have errno or name of problematic file. There was also improper use of negative value. The function strerror was called with -1 instead of errno Reviewed-by: Petr Čech <pcech@redhat.com>
* sssctl: Use localtime for time stampsFabiano Fidêncio2016-07-181-1/+1
| | | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/3096 Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* sssctl: improve readability of a conditionPavel Březina2016-07-131-4/+4
| | | | Reviewed-by: Fabiano Fidêncio <fabiano@fidencio.org>
* sssctl: move filter creation to separate functionPavel Březina2016-07-131-35/+46
| | | | Reviewed-by: Fabiano Fidêncio <fabiano@fidencio.org>
* TOOLS: Prevent dereference of null pointerLukas Slebodnik2016-07-121-35/+28
| | | | | | | | | | VAR_CHECK is called with (var, EOK, ...) EOK would be returned in case of "var != EOK" and output argument _attrs would not be initialized. Therefore there could be dereference of null pointer after calling function usermod_build_attrs. Reviewed-by: Pavel Březina <pbrezina@redhat.com>