summaryrefslogtreecommitdiff
path: root/src/util/util.h
AgeCommit message (Collapse)AuthorFilesLines
2013-09-27ipa_server_mode: write capaths to krb5 include fileSumit Bose1-1/+2
If there are member domains in a trusted forest which are DNS-wise not proper children of the forest root the IPA KDC needs some help to determine the right authentication path. In general this should be done internally by the IPA KDC but this works requires more effort than letting sssd write the needed data to the include file for krb5.conf. If this functionality is available for the IPA KDC this patch might be removed from the sssd tree. Fixes https://fedorahosted.org/sssd/ticket/2093
2013-09-27IPA: store forest name for forest member domainsSumit Bose1-1/+2
In order to fix https://fedorahosted.org/sssd/ticket/2093 the name of the forest must be known for a member domain of the forest.
2013-09-26util: add get_domains_head()Pavel Březina1-0/+2
This function will return head of the domain list. Resolves: https://fedorahosted.org/sssd/ticket/2066
2013-09-18BE: Log domain name to journald if availableJakub Hrozek1-0/+2
If the SSSD is compiled with journald support, then all sss_log() statements will include a new field called "SSSD_DOMAIN" that includes the domain name. Filtering only messages from the single domain is then as easy as: # journalctl SSSD_DOMAIN=foo.example.com
2013-09-17util: add find_subdomain_by_object_name()Pavel Březina1-0/+4
This function will parse object name into name and domain name part and return appropriate sss domain. Resolves: https://fedorahosted.org/sssd/ticket/2034
2013-09-17util: add find_subdomain_by_sid()Pavel Březina1-0/+2
This function takes domain SID (doesn't have the last component) or object SID (have all components) and returns subdomain. The subdomain is found by comparing domain->domainid with the SID. E.g. domain SID: S-1-5-21-3940105347-3434501867-2690409756 object SID: S-1-5-21-3940105347-3434501867-2690409756-513 Resolves: https://fedorahosted.org/sssd/ticket/2034
2013-09-11Enable printf format string checkingLukas Slebodnik1-2/+8
https://fedorahosted.org/sssd/ticket/1945
2013-09-11Adding new header for printf formating macrosLukas Slebodnik1-0/+1
2013-09-11Fix formating of variables with type: longLukas Slebodnik1-2/+2
2013-09-05utils: add is_host_in_domain()Pavel Březina1-0/+2
2013-08-28UTIL: Create new wraper header file sss_endian.hLukas Slebodnik1-19/+0
Some platform have header file endian.h and anothers have sys/endian.h. We nedd to use conditional build to handle it correctly, therefore new header file sss_endian.h was created.
2013-08-28Add a new option to control subdomain enumerationJakub Hrozek1-1/+3
2013-08-28Read enumerate state for subdomains from cacheJakub Hrozek1-1/+2
The enumerate flag will be read from the cache for subdomains and the domain object will be created accordingly.
2013-08-19UTIL: Remove obsolete compat macrosJakub Hrozek1-19/+0
All supported tevent releases contain these macros.
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