summaryrefslogtreecommitdiff
path: root/src/util/util.h
AgeCommit message (Collapse)AuthorFilesLines
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
2011-08-25New DEBUG facility - SSSDBG_UNRESOLVED changed from -1 to 0Pavel Březina1-4/+9
Removed: SSS_UNRESOLVED_DEBUG_LEVEL (completely replaced with SSSDBG_UNRESOLVED) Added new macro: CONVERT_AND_SET_DEBUG_LEVEL(new_value) Changes unresolved debug level value (SSSDBG_UNRESOLVED) from -1 to 0 so DEBUG macro could be reduced by one condition. Anyway, it has a minor effect, every time you want to load debug_level from command line parameters, you have to use following pattern: /* Set debug level to invalid value so we can deside if -d 0 was used. */ debug_level = SSSDBG_INVALID; pc = poptGetContext(argv[0], argc, argv, long_options, 0); while((opt = poptGetNextOpt(pc)) != -1) { ... } CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
2011-08-25New DEBUG facility - conversionPavel Březina1-1/+0
https://fedorahosted.org/sssd/ticket/925 Conversion of the old debug_level format to the new one. (only where it was necessary) Removed: SSS_DEFAULT_DEBUG_LEVEL (completely replaced with SSSDBG_DEFAULT)
2011-08-25New DEBUG facility - modified DEBUGPavel Březina1-6/+41
https://fedorahosted.org/sssd/ticket/925 Modified: DEBUG() macro to work with new levels There are several new macros in util/util.h: - DEBUG_MSG(level, function, message) which will format the debug message like "(time) [prg_name] [function] (level): message\n" - DEBUG_IS_SET(level) that you should use to check if the level is allowed to be logged You can use it like: if (DEBUG_IS_SET(SSSDBG_TRACE_LIBS)) {...}
2011-08-25New DEBUG facility - new levelsPavel Březina1-2/+19
https://fedorahosted.org/sssd/ticket/925 Added functions: - debug_convert_old_level() to convert levels 0-9 to appropriate bitmask debug_convert_old_level(5) returns 0x03F0 (= 0 | 1 | 2 | 3 | 4 | 5) - debug_get_level() to convert old level number to its new value debug_get_level(5) returns 0x0200 (= 5) There are several new macros in util/util.h: - SSSDBG_* to reflect a debug level (same names as in the ticket) - please, don't use magic numbers anymore
2011-08-08debug_timestamps fixesPavel Březina1-0/+3
Fixed: could not overwrite debug_timestamps when set in sssd.conf Fixed: invalid description of debug_timestamps in sssd man page
2011-07-11Move IP adress escaping from the LDAP namespaceJakub Hrozek1-0/+3
2011-05-23Import config.h earlierStephen Gallagher1-2/+1
On RHEL 5 and other older platforms, failing to set _GNU_SOURCE early would cause some functions - such as strndup() - to be unavailable.
2011-05-04Override config file debug_level with command-lineStephen Gallagher1-0/+3
This patch also makes the following changes: 1) The [sssd] debug_level setting no longer acts as a default for all other sections. 2) We will now skip passing the debug argument to the child processes from the master unless the SSSD was run with a command-line argument for the debug level. https://fedorahosted.org/sssd/ticket/764
2011-01-11Add overflow check to SAFEALIGN_COPY_*_CHECK macrosSumit Bose1-3/+6
2011-01-11Validate user supplied size of data itemsSumit Bose1-0/+5
Specially crafted packages might lead to an integer overflow and the parsing of the input buffer might not continue as expected. This issue was identified by Sebastian Krahmer <krahmer@suse.de>.
2010-12-20Introduce sss_hash_create_ex()Sumit Bose1-0/+10
2010-12-03krb5_child returns TGT lifetimeSumit Bose1-0/+6
2010-12-02Add a special filter type to handle enumerationsSumit Bose1-0/+2
2010-11-15Add utility function to sanitize LDAP/LDB filtersStephen Gallagher1-0/+11
Also adds a unit test.
2010-10-13Add a missing include fileSumit Bose1-0/+1
strcasecmp() is defined in strings.h which might not be included under certain conditions.
2010-10-08Add common hash table setupStephen Gallagher1-0/+5
sss_hash_create() produces a dhash table living in the talloc hierarchy.
2010-09-08Add safe copy/move macros for uint16_tJakub Hrozek1-1/+11
2010-08-03Add dup_string_list() utility functionStephen Gallagher1-0/+6
2010-08-03Add diff_string_lists utility functionStephen Gallagher1-0/+13
Includes a unit test
2010-07-09Add sss_log() functionStephen Gallagher1-0/+12
Right now, this log function writes to the syslog. In the future, it could be modified to work with ELAPI or another logging API.
2010-05-27Move parse_args() to utilSumit Bose1-0/+2
2010-05-16Add ldap_krb5_ticket_lifetime optionSumit Bose1-0/+5
2010-05-07Clean up kdcinfo and kpasswdinfo files when exitingStephen Gallagher1-0/+1
2010-04-16Avoid accessing half-deallocated memory when using talloc_zfree macro.eindenbom1-1/+5
The correct memory deallocation sequence is: - clear pointer to memory first - then deallocate memory
2010-04-06Protect against check-and-open race conditionsStephen Gallagher1-0/+29
There is a small window between running lstat() on a filename and opening it where it's possible for the file to have been modified. We were protecting against this by saving the stat data from the original file and verifying that it was the same file (by device and inode) when we opened it again, but this is an imperfect solution, as it is still possible for an attacker to modify the permissions during this window. It is much better to simply open the file and test on the active file descriptor. Resolves https://fedorahosted.org/sssd/ticket/425 incidentally, as without the initial lstat, we are implicitly accepting symlinks and only verifying the target file.
2010-03-08Reopen logs when SIGHUP is caughtJakub Hrozek1-0/+1
Upon receiving SIGHUP, the monitor signals all services to reopen their debug logs. It is also possible to signal individual services to reopen their particular files. Fixes: #332
2010-03-03Improve safe alignment buffer handling macrosSimo Sorce1-15/+24
Make the counter optional so that alignment safe macros can be used also where there is no counter to update. Change arguments names so that they are not deceiving (ptr normlly identify a pointer) Turn the memcpy substitute into an inline function so that passing a pointer to rp and checking for it doesn't make the compiler spit lots of warnings.