summaryrefslogtreecommitdiff
path: root/src/util/util.h
AgeCommit message (Collapse)AuthorFilesLines
2013-06-28Read mpg state for subdomains from cacheSumit Bose1-1/+2
The mpg flag will be read from the cache for subdomains and the domain object will be created accordingly.
2013-06-27AD: Write out domain-realm mappingsJakub Hrozek1-0/+2
This patch reuses the code from IPA provider to make sure that domain-realm mappings are written even for AD sub domains.
2013-06-07New utility function sss_get_domain_nameJakub Hrozek1-0/+7
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-06-07Move domain_to_basedn outside IPA subtreeJakub Hrozek1-0/+2
The utility function will be reused to guess search base from the base DN of AD trusted domains.
2013-05-30Allow flat name in the FQname formatJakub Hrozek1-0/+9
https://fedorahosted.org/sssd/ticket/1648 Adds another expansion in the printf format that allows the user to use the domain flat name in the format.
2013-05-30Add utility functions for formatting fully-qualified namesJakub Hrozek1-0/+16
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-21Check NSCD configuration fileOndrej Kos1-0/+2
https://fedorahosted.org/sssd/ticket/1785 nscd.conf file is now checked for the presence of caching settings for databases controlled by SSSD. Syslog warning is now written only if NSCD is running with interfering configuration or if configuration file couldn't be loaded. New configure option added to support non-standard locations --with-nscd-conf=PATH (defaultly set to /etc/nscd.conf) This is just a workaround until the following bugzilla is resolved: https://bugzilla.redhat.com/show_bug.cgi?id=963908
2013-05-21Move nscd.c from tools to utilOndrej Kos1-0/+8
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-14Rename SAFEALIGN macros.Michal Zidek1-61/+1
https://fedorahosted.org/sssd/ticket/1772 SAFEALIGN macros have been renamed in this patch to make it easy to pick the right macro when data is copied from byte buffer to a variable or vice versa. The renamed macros are placed in new header file to avoid code duplication (the old ones were defined in two files, one for the client code and one for the rest of sssd).
2013-05-07UTIL: Add function sss_names_init_from_argsJan Cholasta1-0/+7
This function allows initializing sss_names_ctx using a regular expression and fully qualified format string specified in its arguments.
2013-03-18Fix sss_client breakage.Lukas Slebodnik1-3/+1
Adding missing dependencies for linker. Missing dependency was introduced by commit 22d381367c27910fe82f476a76b9f4ede555e35a in changed file src/sss_client/nss_mc_common.c All function declaration for io.c was moved from util.h to separate file io.h, https://fedorahosted.org/sssd/ticket/1838
2013-03-13More generalized function open_debug_file_ex()Lukas Slebodnik1-1/+1
Function open_debug_file_ex() set flag FD_CLOEXEC to opened file according to the value of third parameter. Removed duplicity of unsetting FD_CLOEXEC after calling function open_debug_file_ex()
2013-03-13Reuse sss_open_cloexec at other places in code.Lukas Slebodnik1-0/+3
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-04Return ERR_INTERNAL instead of EIOSimo Sorce1-1/+1
EIO has always been an odd match, but was used as an error to indicate that something had gone wrong internally before we had specific SSSD errors available. Use ERR_INTERNAL instead going forward.
2013-03-04Add SSSD specific error codes and definitionsSimo Sorce1-7/+1
This code adds a new range of error codes specific to SSSD, It also provides helper functions to print out error defintions like you can do with system error messages and the strerror() function. The sss_strerror() function can accept both the new sssd errors and system errno_t errors falling back to the system strerror() if the error code provide is not a valid SSSD error code.
2013-02-10Introduce IS_SUBDOMAIN() macroSimo Sorce1-0/+2
Fixes https://fedorahosted.org/sssd/ticket/1766
2013-02-10Change the way domains are linked.Simo Sorce1-2/+4
- Use a double-linked list for domains and subdomains. - Never remove a subdomain, simply mark it as disabled if it becomes unused. - Rework the way subdomains are refreshed. Now sysdb_update_subdomains() actually updates the current subdomains and marks as disabled the ones not found in the sysdb or add new ones found. It never removes them. Removal of missing domains from sysdb is deferred to the providers, which will perform it at refresh time, for the ipa provider that is done by ipa_subdomains_write_mappings() now. sysdb_update_subdomains() is then used to update the memory hierarchy of the subdomains. - Removes sysdb_get_subdomains() - Removes copy_subdomain() - Add sysdb_subdomain_delete()
2013-02-10Add function get_next_domain()Simo Sorce1-0/+2
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-02-10Add realm info to sss_domain_infoSimo Sorce1-0/+1
2013-01-15Refactor single domain initializationSimo Sorce1-0/+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-10Add function to safely wipe memory.Simo Sorce1-0/+9
This is useful for wiping passwords, as it prevents the compiler from optimizing out a memset to zero before a free()
2013-01-02failover: Protect against empty host namesMichal Zidek1-1/+2
Added new parameter to split_on_separator that allows to skip empty values. The whole function was rewritten. Unit test case was added to check the new implementation. https://fedorahosted.org/sssd/ticket/1484
2012-11-28Avoid const warnings when deallocating memorySimo Sorce1-1/+1
In some case we allocate and assign data to a const pointer. When we then try to free it we would get a const warning because talloc_free accepts a void, not a const void pointer. Use discard_const to avoid the warning, it is safe in this case.
2012-11-28Revert "Avoid accessing half-deallocated memory when using talloc_zfree macro."Simo Sorce1-5/+1
This reverts commit ff57c6aeb80a52b1f52bd1dac9308a69dc7a4774. This commit doesn't really make sense, we are never accessing freed memory as all we are dealing with is a pointer which is never itsef part of the memory we are freeing (if it were, it would be an error in the caller and we shouldn't mask it in this macro).
2012-11-26debug: print fatal and critical errors if debug level is unresolvedMichal Zidek1-1/+4
If global variable debug_level has value SSSDBG_UNRESOLVED, we should print at least fatal and critical errors. https://fedorahosted.org/sssd/ticket/1345
2012-11-14Always start PAC responder if IPA ID provider is configuredSumit Bose1-0/+6
Since the PAC responder is used during the authentication of users from trusted realms it is started automatically if the IPA ID provider is configured for a domain to simplify the configuration. Fixes https://fedorahosted.org/sssd/ticket/1613
2012-11-14Add string_in_list() and add_string_to_list() with testsSumit Bose1-0/+6
string_in_list() and add_string_to_list() are two utilities for NULL terminated strings arrays. add_string_to_list() adds a new string to an existing list or creates a new one with the strings as only item if there is not list. string_in_list() checks if a given string is in the list. It can be used case sensitive or in-sensitive.
2012-11-08util_lock.c: sss_br_lock_file accepted invalid parameter valueMichal Zidek1-1/+1
Return EINVAL if number of tries is <= 0. Also the parameter retries was renamed to num_tries, so it is more obvious that it also includes the first try.
2012-11-06util: Added new file util_lock.cMichal Zidek1-0/+4
2012-11-06exit original process after sssd is initializedPavel Březina1-0/+1
https://fedorahosted.org/sssd/ticket/1357 Neither systemd or our init script use pid file as a notification that sssd is finished initializing. They will continue starting up next service right after the original (not daemonized) sssd process is terminated. If any of the responders fail to start, we will never terminate the original process via signal and "service sssd start" will hang. Thus we take this as an error and terminate the daemon with a non-zero value. This will also terminate the original process and init script or systemd will print failure.
2012-11-06add SSSDBG_IMPORTANT_INFO macroPavel Březina1-0/+1
We currently have only SSSDBG_FATAL_FAILURE macro that corresponds to original debug level 0. But there are several level 0 messages that are not actually failures but an important information. We should use this new macro to represent them.
2012-10-29Include talloc log in our debug facilityMichal Zidek1-5/+10
https://fedorahosted.org/sssd/ticket/1495
2012-10-02monitor: create pid file after all responders are startedPavel Březina1-0/+1
https://fedorahosted.org/sssd/ticket/1357
2012-09-24sss_cache tool invalidates records in memory cache.Michal Zidek1-0/+2
2012-08-23Fix: IPv6 address with square brackets doesn't work.Michal Zidek1-0/+9
https://fedorahosted.org/sssd/ticket/1365
2012-08-23Consolidation of functions that make realm upper-caseOndrej Kos1-0/+3
2012-06-12Make re_expression and full_name_format per domain optionsStef Walter1-0/+1
* Allows different user/domain qualified names for different domains. For example Domain\User or user@domain. * The global re_expression and full_name_format options remain as defaults for the domains. * Subdomains get the re_expression and full_name_format of their parent domain. https://bugzilla.redhat.com/show_bug.cgi?id=811663
2012-05-04Fix endian issue in SID conversionSumit Bose1-0/+2
Since the byte-order is only important when dealing with the binary SID the sub-auth values are stored in host order and are only converted while reading or writing the binary SID.
2012-05-02Handle endianness issues on older systemsStephen Gallagher1-0/+17
Older versions of glibc (like that on RHEL 5) do not have the le32toh() function exposed. We need this for handling the Active Directory ID-mapping, so we'll copy these macros from endian.h on a newer glibc.
2012-04-24Add some utility functions for subdomainsJan Zeleny1-0/+9
2012-04-20Move atomic io function to a separate moduleJakub Hrozek1-5/+2
We'll be using it on various places of the SSSD. The function is in its own file to allow using just the one piece without having to drag in the whole util.c module.
2012-03-29Add sss_get_cased_name_list utility functionJakub Hrozek1-0/+4
2012-03-21Make the string_equal() function publicJakub Hrozek1-0/+1
2012-02-26UTIL: Add function for atomic I/OJan Cholasta1-0/+5
2012-01-23Move sized_string declaration to utilsStephen Gallagher1-0/+8
2011-12-21sss_get_cased_name utility functionJakub Hrozek1-0/+4
2011-12-16sss_utf8_tolower utility function+unit testsJakub Hrozek1-0/+6
2011-10-13Add option to follow symlinks to check_file()Jakub Hrozek1-1/+1
2011-09-28Multiline macro cleanupJakub Hrozek1-2/+2
This is mostly a cosmetic patch. The purpose of wrapping a multi-line macro in a do { } while(0) is to make the macro usable as a regular statement, not a compound statement. When the while(0) is terminated with a semicolon, the do { } while(0); block becomes a compound statement again.
2011-09-08DEBUG timestamps offer higher precisionPavel Březina1-13/+48
https://fedorahosted.org/sssd/ticket/956 Added: --debug-microseconds=0/1 Added: debug_microseconds to sssd.conf