summaryrefslogtreecommitdiff
path: root/src/tools
AgeCommit message (Collapse)AuthorFilesLines
2013-06-07New utility function sss_get_domain_nameJakub Hrozek1-8/+4
Instead of copying a block of code that checks whether domain is a subdomain and uses only name of FQDN as appropriate, wrap the logic into a function.
2013-05-30Add utility functions for formatting fully-qualified namesJakub Hrozek1-2/+1
Instead of using printf-like functions directly, provide two wrappers that would encapsulate formatting the fully-qualified names. No functional change is present in this patch.
2013-05-21Move nscd.c from tools to utilOndrej Kos2-105/+0
Preparation for the following patch which will include the nscd.c in the monitor code due to newly introduced function for checking the nscd configuration file.
2013-05-20Fixing critical format string issues.Lukas Slebodnik5-8/+12
--missing arguments. --format '%s', but argument is integer. --wrong format string, examle: '%\n'
2013-04-17Inform about function duplication.Michal Zidek1-0/+3
sss_mc_set_recycled is a static function, that should not be used outside nsssrv_mmap_cache.c. The sss_cache tool is an exception, because in the case when sssd is not running, sss_cache must invalidate the memory cache file. That is why sss_mc_set_recycled was copied to the tools_mc_util.c (as helper function for sss_memcache_invalidate function). It was duplicated to allow this function to remain static (and invisible to any .h files), so that it is not used anywhere else. Wrong usage of this function might cause race conditions and corrupt the cache. I'll add comments about the duplication to the code.
2013-04-15sss_cache: Remove annoying messagesMichal Zidek1-8/+6
When requested entry was not found in one domain, an ERROR message was written to the user even if the entry was found in the next domain and deleted properly.
2013-04-15sss_cache: support for subdomainsMichal Zidek1-57/+117
https://fedorahosted.org/sssd/ticket/1741
2013-04-05Wrong condition after waitpid.Michal Zidek1-1/+1
On success, waitpid() returns pid of terminated child, not 0.
2013-04-05Check for waitpid failure at wrong place.Michal Zidek2-10/+9
Coverity bugs. https://fedorahosted.org/sssd/ticket/1865
2013-04-03Return errno, not -1 on failure in files.cJakub Hrozek1-0/+1
https://fedorahosted.org/sssd/ticket/1862
2013-03-13Reuse sss_open_cloexec at other places in code.Lukas Slebodnik1-66/+4
Functions open_cloexec and openat_cloexec were renamed with prefix "sss_" and moved to separete file. Replacing duplicated code of function sss_open_cloexec everywhere in the source code. https://fedorahosted.org/sssd/ticket/1794
2013-03-05Remove the alt_db_path parameter of sysdb_initMichal Zidek1-1/+1
This parameter was never used. https://fedorahosted.org/sssd/ticket/1765
2013-02-21tools: append new line to string from poptStrerror()Milan Cejnar1-1/+13
https://fedorahosted.org/sssd/ticket/1756 Messages from poptStrerror() passed to BAD_POPT_PARAMS macro were printed out to the console without new line character at the end of the message. BAD_POPT_PARAMS should now behave correctly with strings both with or without new line character at the end.
2013-02-10Add function get_next_domain()Simo Sorce2-3/+8
Use this function instead of explicitly calling domain->next This function allows to get the next primary domain or to descend into the subdomains and replaces also get_next_dom_or_subdom()
2013-01-29Unchecked return value in files.cMichal Zidek1-1/+9
Found by coverity. https://fedorahosted.org/sssd/ticket/1791
2013-01-28TOOLS: Compile on old platforms such as RHEL5Jakub Hrozek1-37/+140
Provides compatible declarations for modern file management functions such as futimens or opening with the O_CLOEXEC flag
2013-01-23TOOLS: Use file descriptor to avoid races when creating a home directoryJakub Hrozek3-351/+361
When creating a home directory, the destination tree can be modified in various ways while it is being constructed because directory permissions are set before populating the directory. This can lead to file creation and permission changes outside the target directory tree, using hard links. This security problem was assigned CVE-2013-0219 https://fedorahosted.org/sssd/ticket/1782
2013-01-23TOOLS: Use openat/unlinkat when removing the homedirJakub Hrozek1-42/+41
The removal of a home directory is sensitive to concurrent modification of the directory tree being removed and can unlink files outside the directory tree. This security issue was assigned CVE-2013-0219 https://fedorahosted.org/sssd/ticket/1782
2013-01-21TOOLS: invalidate parent groups in memory cache, tooJakub Hrozek4-8/+71
https://fedorahosted.org/sssd/ticket/1775 In addition to invalidating the group being added to when adding a member group/user, we also need to invalidate all its parent groups, otherwise this getgrnam("parent") wouldn't report the members newly added to its child groups.
2013-01-16tools: Respect use_fully_qualified_namesMichal Zidek1-0/+9
Tools for LOCAL domain should require FQDN if option 'use_fuly_quallified_names = TRUE' was configured. https://fedorahosted.org/sssd/ticket/1746
2013-01-16sss_cache: Call DEBUG_INIT soonerMichal Zidek1-2/+3
If bad parameteres were passed to sss_cache, the init function returned without calling DEBUG_INIT macro and unnecessary level 1 debug message was printed. https://fedorahosted.org/sssd/ticket/1745
2013-01-15TOOLS: Refresh memcache after changes to local users and groupsJakub Hrozek2-0/+42
2013-01-15TOOLS: Provide a convenience function to refresh a list of groupsJakub Hrozek2-0/+22
2013-01-15TOOLS: Split querying nss responder into a separate functionJakub Hrozek4-32/+68
The tools query the responder in order to sync the memcache after performing changes to the local database. The functions will be reused by other tools so I split them into a separate functions.
2013-01-15TOOLS: move memcache related functions to tools_mc_utils.cJakub Hrozek3-161/+188
The upcoming patches will link only users of this file with client libs, so it's better to have it separate. There is no functional change in this patch
2013-01-15TOOLS: set domain in check_group_namesJakub Hrozek1-0/+1
2013-01-15Add domain arguments to sysdb services functionsSimo Sorce1-2/+3
also fix sysdb_svc_add declarations
2013-01-15Add domain argument to sysdb autofs functionsSimo Sorce1-1/+1
2013-01-15Add domain arg to sysdb_search/delete_netgroup()Simo Sorce1-1/+2
2013-01-15Add domain argument to sysdb_search_groups()Simo Sorce2-2/+4
2013-01-15Add domain arg to sysdb_search_users()Simo Sorce1-1/+2
2013-01-15Add domain argument to sysdb_search_custom()Simo Sorce1-2/+5
Also changes sysdb_search_custom_by_name()
2013-01-15Add domain argument to sysdb_cache_password()Simo Sorce1-1/+1
2013-01-15Add domain arguments to sysdb_add_group functions.Simo Sorce1-1/+2
2013-01-15Add domain argument to sysdb_add_user()Simo Sorce2-2/+3
2013-01-15Add domain argument to sysdb_set_netgroup_attr()Simo Sorce1-1/+1
2013-01-15Add domain argument to sysdb_set_group_attr()Simo Sorce2-2/+3
2013-01-15Add domain argument to sysdb_set_user_attr()Simo Sorce2-7/+10
2013-01-15Add domain to sysdb_search_group_by_name()Simo Sorce1-3/+3
Also remove unused sysdb_search_domgroup_by_name()
2013-01-15Add domain to sysdb_search_user_by_name()Simo Sorce1-1/+1
Also remove unused sysdb_search_domuser_by_name()
2013-01-15Pass domain to sysdb_get<pw/gr>nam() functionsSimo Sorce2-5/+9
Also allows us to remove sysdb_subdom_get<pw/gr>nam() wrappers and restore fqnames proper value in subdomains, by testing for a parent domain being present or not.
2013-01-15Make sysdb_group_dn() require a domain explictly.Simo Sorce2-7/+7
2013-01-15Make sysdb_user_dn() require a domain explictly.Simo Sorce1-3/+3
2013-01-15Remove the sysdb_ctx_get_domain() function.Simo Sorce1-10/+11
We are deprecating sysdb->domain so kill the function that gives access to this member as we should stop relying on it being available (or correct).
2013-01-15Refactor single domain initializationSimo Sorce3-9/+6
Bring it out of sysdb, which will slowly remove internal dependencies on domains and instead will always require them to be passed by callers.
2013-01-15Refactor sysdb initializationSimo Sorce1-21/+10
Change the way sysdbs are initialized. Make callers responsible for providing the list of domains. Remove the returned array of sysdb contexts, it was used only by sss_cache and not really necessary there either as that tool can easily iterate the domains. Make sysdb ctx children of their respective domains. Neither sysdb context nor domains are ever freed until a program is done so there shouldn't be any memory hierarchy issue. As plus we simplify the code by removing a destructor and a setter function.
2013-01-14Use new sysdb_search_service() in sss_cacheSimo Sorce1-35/+4
Also fixes https://fedorahosted.org/sssd/ticket/1754
2013-01-09Revert "Add a default section to a switch-statement"Simo Sorce1-12/+8
This reverts commit d698499602461b98fd56f2d550f80c6cb25f12a9. And adds the correct fix. Also makes the function static,as it is used nowehere else.
2013-01-09Add a default section to a switch-statementSumit Bose1-0/+3
Besides adding the missing default this patch suppresses a compiler warning about ret being uninitialized.
2013-01-08Remove unhelpful vtable from sss_cacheSimo Sorce1-24/+30
Using a vtable like this has various drawacks, including the fact prototypes are not checked by the compiler so the code could silently break and still compile fine (in fact I found this out changing one of the prototypes). A switch statement is also better because it catches if the enum changed and won't risk allowing to access the table out of bounds.