summaryrefslogtreecommitdiffstats
path: root/src/tools/common
Commit message (Collapse)AuthorAgeFilesLines
* TOOLS: Some tools command might not need initialization to succeedJakub Hrozek2016-07-072-14/+42
| | | | | | | | | | | | 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>
* SYSDB: Remove useless parameter from sysdb_init()Jakub Hrozek2016-07-071-1/+1
| | | | | | | The function sysdb_init() is never used to allow upgrade, so the allow_upgrade parameter was pointless. Reviewed-by: Sumit Bose <sbose@redhat.com>
* confdb: Make it possible to use config snippetsMichal Židek2016-06-271-1/+3
| | | | | | | | | | 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>
* sss_tools: create confdb if not existPavel Březina2016-06-271-4/+5
| | | | | | | So tools (especially sssctl) may be run even when databases where removed. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sss_tools: add test if sssd is runningPavel Březina2016-06-272-0/+155
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sss_tools: return errno_t instead of system codePavel Březina2016-06-272-68/+70
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sss_tools: pad help message properlyPavel Březina2016-06-271-8/+31
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sss_tools: add commands delimiterPavel Březina2016-06-272-0/+19
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sss_tools: tell whether an option was providedPavel Březina2016-06-272-12/+23
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sss_tools: unify description of --debugPavel Březina2016-06-271-1/+1
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sss_tools: add help commands to usage messagePavel Březina2016-06-271-0/+6
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sss_tools: add command descriptionPavel Březina2016-06-272-1/+9
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* tools: read additional data of the master domainSumit Bose2016-04-131-0/+8
| | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/2989 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TOOLS: Add comments on functions in colondbPetr Cech2016-02-241-0/+23
| | | | | | | | | | | | | | | | | | The colondb API provides three function: * sss_colondb_open() * sss_colondb_write_field() * sss_colondb_read_field() It is not obvious that sss_colondb_open() add destructor on talloc context which close the colondb during free context. And there is expectation that SSS_COLONDB_SENTINEL is type of last item in line. So this patch adds simple lightening comments in doxygen style. Resolves: https://fedorahosted.org/sssd/ticket/2764 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TOOLS: Fix memory leak after getline() failedPetr Cech2016-02-241-0/+4
| | | | | | | | | | | | | | | | | | This patch fixes buffer freeing in case if getline() failed in function sss_colondb_readline(). ssize_t getline(char **lineptr, size_t *n, FILE *stream); If *lineptr is set to NULL and *n is set 0 before the call, then getline() will allocate a buffer for storing the line. This buffer should be freed by the user program even if getline() failed. man 3 getline This patch fix buffer freeing in case if getline() failed. Resolves: https://fedorahosted.org/sssd/ticket/2764 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TOOLS: Fix minor memory leak in sss_colondb_writelineLukas Slebodnik2016-02-241-0/+7
| | | | | | | | | | The variable line was initialized to NULL. The we created temporary context tmp_ctx. We use talloc_asprintf_append to append string to line which is initially NULL and therefore new context which was not connected to tmp_ctx. man 3 talloc_string -> talloc_asprintf_append Reviewed-by: Petr Cech <pcech@redhat.com>
* DEBUG: Add missing new linesLukas Slebodnik2015-12-141-1/+1
| | | | Reviewed-by: Petr Cech <pcech@redhat.com>
* sss_tools: do not allow unexpected free argumentPavel Březina2015-10-301-2/+11
| | | | Reviewed-by: Pavel Reichl <preichl@redhat.com>
* sss_tools: always show common and help optionsPavel Březina2015-10-301-1/+14
| | | | | | | 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>
* util: Update get_next_domain's interfaceMichal Židek2015-10-231-2/+4
| | | | | | | | | | | | 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>
* sss tools: improve option handlingPavel Březina2015-10-021-18/+30
| | | | | | | | | | | | 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>
* sss_override: document --debug optionsPavel Březina2015-08-311-4/+21
| | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/2758 Reviewed-by: Petr Cech <pcech@redhat.com>
* TOOLS: add sss_colondb APIPavel Březina2015-08-202-0/+378
| | | | | | To simplify import/export users and groups. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TOOLS: add common command frameworkPavel Březina2015-07-272-0/+497
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>