summaryrefslogtreecommitdiffstats
path: root/src/tests/util-tests.c
Commit message (Collapse)AuthorAgeFilesLines
* UTIL-TESTS: More restrictive permissionsPetr Cech2015-10-141-1/+1
| | | | | | | | | | | This test suite tries to write into and to read from temp. files. There is no reason to have executable permission. So this patch replaces SSS_DFL_X_UMASK with SSS_DFL_UMASK. Resolves: https://fedorahosted.org/sssd/ticket/2424 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* REFACTOR: umask(077) --> umask(SSS_DFL_X_UMASK)Petr Cech2015-10-141-1/+1
| | | | | | | | | | | There are many calls of umask function with 077 argument. This patch add new constant SSS_DFL_X_UMASK which stands fot 077. So all occurences of umask(077) are replaced by constant SSS_DFL_X_UMASK. Resolves: https://fedorahosted.org/sssd/ticket/2424 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* UTIL: Add sss_filter_sanitize_exJakub Hrozek2015-07-151-0/+9
| | | | | | | | | | | Related: https://fedorahosted.org/sssd/ticket/2553 In order to support wildcard request, we need to introduce an optionally relaxed version of sss_filter_sanitize that allows to select which characters are exempt from sanitizing. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* util-tests: Add validation of internal error messagesLukas Slebodnik2015-06-011-0/+24
| | | | | | | The function sss_strerror() should not return a sentence. It shoudl return string; the same as strerror() Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* tests: Revert strcmp conditionJakub Hrozek2015-04-081-1/+1
| | | | Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* util-tests: Initialize boolean variable to default valueLukas Slebodnik2015-04-081-1/+1
| | | | | | | | The boolean variable found_nss could be used uninitialized in test test_known_service if service "nss" would not be found. We would catch it with valgind. Reviewed-by: Pavel Reichl <preichl@redhat.com>
* test: Check ERR_LASTMichal Zidek2015-03-131-0/+10
| | | | | | Check if number of error codes and messages is the same. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* UTIL: convert GeneralizedTime to unix timePavel Reichl2015-03-051-0/+57
| | | | | | | | New utility function *sss_utc_to_time_t* to convert GeneralizedTime to unix time. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* UTIL: Unify the fd_nonblocking implementationJakub Hrozek2015-01-151-0/+21
| | | | | | | The responder and child_common modules each had their own implementation. Unify it instead and add a unit test. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* TOOLS: Always debug to stderrJakub Hrozek2014-07-091-1/+1
| | | | | | | | | https://fedorahosted.org/sssd/ticket/2348 Programs that are supposed to only be executed on the foreground should log to stderr automatically. Reviewed-by: Michal Židek <mzidek@redhat.com>
* UTIL: Fix access out of bound in parse_argsLukas Slebodnik2014-07-081-4/+26
| | | | | | | | | | | | | | | | While parsing string with multiple whitespaces, it may happen variable i is zero and we want to test end of argument "tmp[i-1] != '\0'". Side effect of this bug is duplicite string output array. Input string: "foo b" Expected output: { "foo", "a", NULL } Output: { "foo", "foo", "a", NULL } This patch uses inverted logic. Instead of testing whether to read next char or skip multiple whitespaces, we will test whether we have new argument which should be stored in output array. Reviewed-by: Pavel Reichl <preichl@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* tests: Add test for get_known_servicesJakub Hrozek2014-05-281-0/+22
| | | | Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* TEST: Fix warning invalid printf argument typeLukas Slebodnik2014-02-261-1/+1
| | | | | | | | | Reported by: cppcheck "%d" in format string (no. 1) requires 'int' but the argument type is 'unsigned int' Reviewed-by: Michal Žídek <mzidek@redhat.com>
* util: Add functions to check if IP addresses is specialMichal Zidek2013-10-171-0/+124
| | | | | Added functions to check if given IP address is a special address (broadcast, multicast...).
* utils: add is_host_in_domain()Pavel Březina2013-09-051-0/+28
|
* UTIL: Use standard maximum value of type size_tLukas Slebodnik2013-09-031-6/+6
| | | | | | | It is better to use standard constant for maximum value of type size_t, instead of reinventing wheel with own defined constant SIZE_T_MAX This patch replace string "SIZE_T_MAX" -> "SIZE_MAX"
* Make leak checks usable in tests that do not utilize checkJakub Hrozek2013-04-171-3/+3
| | | | | | * Remove check-specific failure reporting from common_check.c * Check-specific abstraction over memleak checks * Rename common_check.c to leak_check.c
* failover: Protect against empty host namesMichal Zidek2013-01-021-0/+91
| | | | | | | | | | 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
* Add string_in_list() and add_string_to_list() with testsSumit Bose2012-11-141-0/+83
| | | | | | | | 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.
* Include talloc log in our debug facilityMichal Zidek2012-10-291-1/+1
| | | | https://fedorahosted.org/sssd/ticket/1495
* Move atomic io function to a separate moduleJakub Hrozek2012-04-201-9/+9
| | | | | | 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.
* sss_atomic_io: Do not fail reads with EPIPE if there is not enough data to readJakub Hrozek2012-04-201-0/+206
| | | | Also adds a unit test for sss_atomic_io()
* Add a random + identity test for murmurhash3Simo Sorce2012-01-091-0/+29
| | | | | | | | This test always generate a random string so each time the test is run we will test the hash function with a new value. It also hashes the same string twice and compares the result so that we have a chance of catching if uninitialized variables are getting mixed into the value calculation and end up generating different results for the same input.
* util: add murmurhash3 hash functionSimo Sorce2012-01-091-0/+24
|
* tests: fix test group of utf8 testsSimo Sorce2012-01-041-5/+5
|
* sss_utf8_tolower utility function+unit testsJakub Hrozek2011-12-161-0/+96
|
* New DEBUG facility - SSSDBG_UNRESOLVED changed from -1 to 0Pavel Březina2011-08-251-1/+4
| | | | | | | | | | | | | | | | | | | | | 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);
* New DEBUG facility - conversionPavel Březina2011-08-251-0/+2
| | | | | | | | | | 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)
* Unit test for parge_argsJakub Hrozek2011-06-151-0/+58
|
* Validate user supplied size of data itemsSumit Bose2011-01-111-0/+14
| | | | | | 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>.
* Add utility function to sanitize LDAP/LDB filtersStephen Gallagher2010-11-151-0/+68
| | | | Also adds a unit test.
* Use POPT_TABLEEND to close option tableSumit Bose2010-10-131-1/+1
|
* Add diff_string_lists utility functionStephen Gallagher2010-08-031-0/+227
Includes a unit test