summaryrefslogtreecommitdiffstats
path: root/src/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* Only replace space with the specified substitutionJakub Hrozek2014-08-132-69/+51
| | | | | | | | | | | | | | | | | | | | https://fedorahosted.org/sssd/ticket/2397 - make sss_replace_whitespaces only replace space (' ') not any whitespace - make sss_replace_whitespaces only replace a single char, not the whole string - rename CONFDB_NSS_OVERRIDE_DEFAULT_WHITESPACE to CONFDB_NSS_OVERRIDE_DEFAULT_SPACE - rename the override_default_whitespace option to override_space - rename sss_replace_whitespaces() to sss_replace_space() - rename sss_reverse_replace_whitespaces() to sss_reverse_replace_space() - rename nctx->override_default_wsp_str to nctx->override_space - make the return value of sss_replace_space non-const to avoid freeing the result without compilation warnings Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TESTS: Check if option maps have the right number of membersJakub Hrozek2014-08-121-0/+84
| | | | Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* UTIL: Add functions for replacing whitespaces.Lukas Slebodnik2014-07-283-0/+156
| | | | | Reviewed-by: Pavel Reichl <preichl@redhat.com> Reviewed-by: Michal Židek <mzidek@redhat.com>
* test_utils: Use common header file for libsss_util tests.Lukas Slebodnik2014-07-283-1/+31
| | | | | Reviewed-by: Pavel Reichl <preichl@redhat.com> Reviewed-by: Michal Židek <mzidek@redhat.com>
* Only check GID if ID-mappingJakub Hrozek2014-07-231-0/+20
| | | | Reviewed-by: Sumit Bose <sbose@redhat.com>
* UTIL: rename find_subdomain_by_namePavel Reichl2014-07-221-23/+23
| | | | | | | | | The function was named "find_subdomain" yet it could find both main domain and subdomain. sed 's/find_subdomain_by_name/find_domain_by_name/' -i `find . -name "*.[ch]"` Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* UTIL: rename find_subdomain_by_sidPavel Reichl2014-07-221-14/+14
| | | | | | | | | The function was named "find_subdomain" yet it could find both main domain and subdomain. sed 's/find_subdomain_by_sid/find_domain_by_sid/' -i `find . -name "*.[ch]"` Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sss_sifp: set output parameters if attribute is NULLPavel Březina2014-07-161-0/+338
| | | | | | | | | | | | | | | | | | | | | | | | | | There are two cases that may happen when a user calls Get or GetAll: 1) the attribute is missing 2) the attribute is empty sss_sifp has two error code to distinguish between those two cases: 1) SSS_SIFP_ATTR_MISSING 2) SSS_SIFP_ATTR_NULL Usually the caller is not interested on situations when the attribute is empty and it can be considered as error. Having it as a separate error code instead of setting the output value to NULL is necesarry since attribute does not have to be a pointer. This patch however sets pointer type attributes to NULL since it may simplify the code path when the caller is actually interested in this information (e. g. empty server list on domain objects). It is not possible to send a NULL string over a D-Bus nor it is possible to have hash table NULL with current code so these two scenarios are not tested. However, it is handled in sss_sifp_attr code for completeness. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* sss_sifp test: fix object path array testPavel Březina2014-07-161-1/+1
| | | | Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* resolv tests: add test for multiple servers with zero weightsPavel Březina2014-07-141-0/+64
| | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/2357 Reviewed-by: Pavel Reichl <preichl@redhat.com>
* resolv tests: remove ununused variable from for cyclusPavel Březina2014-07-141-1/+1
| | | | Reviewed-by: Pavel Reichl <preichl@redhat.com>
* TOOLS: Always debug to stderrJakub Hrozek2014-07-0930-30/+30
| | | | | | | | | 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>
* sdap-tests: Fix off by one.Lukas Slebodnik2014-07-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | Function sss_base64_decode does not return NUL terminated string and it causes valgrind warning in test "Invalid read of size 1" ==30954== Invalid read of size 1 ==30954== at 0x4A09FB8: strcmp (mc_replace_strmem.c:730) ==30954== by 0x4C2AAFA: _assert_string_equal (in /usr/lib64/libcmocka.so.0.2.1) ==30954== by 0x407DBA: test_parse_with_map (test_sdap.c:285) ==30954== by 0x4C2C817: _run_test (in /usr/lib64/libcmocka.so.0.2.1) ==30954== by 0x4C2CCF8: _run_tests (in /usr/lib64/libcmocka.so.0.2.1) ==30954== by 0x408A6F: main (test_sdap.c:583) ==30954== Address 0x6a8db34 is 0 bytes after a block of size 100 alloc'd ==30954== at 0x4A0645D: malloc (vg_replace_malloc.c:291) ==30954== by 0x35C8204980: _talloc_memdup (talloc.c:613) ==30954== by 0x5080A4B: sss_base64_decode (nss_base64.c:86) ==30954== by 0x407DA0: test_parse_with_map (test_sdap.c:282) ==30954== by 0x4C2C817: _run_test (in /usr/lib64/libcmocka.so.0.2.1) ==30954== by 0x4C2CCF8: _run_tests (in /usr/lib64/libcmocka.so.0.2.1) ==30954== by 0x408A6F: main (test_sdap.c:583) Reviewed-by: Pavel Reichl <preichl@redhat.com>
* LDAP: Remove unused output parameter _dn from sdap_parse_entryJakub Hrozek2014-07-081-8/+7
| | | | | | | No caller directly accessed this parameter. Moreover, it seemed useless since the same data is available as SYSDB_ORIGINAL_DN in the attributes. Reviewed-by: Michal Židek <mzidek@redhat.com>
* LDAP: Try all attributes when saving an entryJakub Hrozek2014-07-081-0/+55
| | | | | | | | | | | | | The same LDAP attribute might be used several times for the same user or group attribute. For instance, some servers have a global "ID" number that should be used for both UID and GID. However, our sdap_parse_entry() function only copied the LDAP attribute to the first matching sysdb attribute. This patch adds a second nested loop that checks if any of the other LDAP attributes are eligible. Reviewed-by: Michal Židek <mzidek@redhat.com>
* TESTS: Add a unit test for the sdap.c moduleJakub Hrozek2014-07-081-0/+530
| | | | | | | | Covers the sdap_parse_entry function with unit tests so that we know that modifying the function in a later patch will not result in a regression. 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: Do not rely on order of hash itemsJakub Hrozek2014-07-071-32/+50
| | | | | | | | | The nested group test was checking returned elements in a particular order. That's not reliable because the returned values are fetched from a hash iterator that doesn't guarantee the same order on different systems. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TESTS: Add more tests for nested groups processingJakub Hrozek2014-07-011-1/+265
| | | | | | | | | | Adds unit test for basic group retrieval functionality as well as for testing duplicate members in the LDAP group entry. These unit tests exercise code added in patch a47cb2e08e4004179d2a6b5f9a9340200270fbd0 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TESTS: Change how mock_sysdb_user() is implementedJakub Hrozek2014-07-012-3/+16
| | | | | | | For the purpose of unit tests, it's better to create a user object with a UID and a name. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TESTS: Do not require replies from mocked sdap_get_generic_recv to be talloc ↵Jakub Hrozek2014-07-011-2/+1
| | | | | | | | | | contexts While it's beneficial for the real implementation of sdap_get_generic_recv() to move memory around, the mocked implementation can just pass around pointer. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TESTS: Fix group search baseJakub Hrozek2014-07-011-1/+1
| | | | | | | After fixing the confdb initialization I realized the group DN couldn't be parsed. This patch fixes that. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TESTS: Use the right confdb pathJakub Hrozek2014-07-011-1/+1
| | | | | | | The nested group test only worked by accident. Its confdb settings were not applied because a wrong confdb path was used. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TESTS: Add confdb domain base DN to sss_test_ctxJakub Hrozek2014-07-014-9/+11
| | | | | | | | Creation of the path to the domain's confdb entry was duplicated in the tests. Rather than adding yet another duplication, I added the path as another field of the sss_test_ctx structure. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TESTS: sysdb_getnetgr - return ENOENTPavel Reichl2014-06-251-0/+6
| | | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/1991 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TESTS: add tests for sss_ldb_searchPavel Reichl2014-06-251-0/+97
| | | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/1991 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TESTS: Fix format string in check macrosLukas Slebodnik2014-06-233-3/+3
| | | | Reviewed-by: Pavel Reichl <preichl@redhat.com>
* sysdb: add sysdb_search_user_by_upn() with testsSumit Bose2014-06-201-0/+231
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TESTS: sysdb_search_return_ENOENT - check mem leaksPavel Reichl2014-06-201-0/+2
| | | | Reviewed-by: Stephen Gallagher <sgallagh@redhat.com>
* sbus_codegen_tests: free memory contextPavel Březina2014-06-181-0/+4
| | | | | | | | | | The memory context was not freed and therefore a destructor that closes connection to D-Bus and performs cleanup task was not executed. Resolves: https://fedorahosted.org/sssd/ticket/2347 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* Use python2 in shebang for python scripts.Lukas Slebodnik2014-06-183-3/+3
| | | | | | | | | https://fedorahosted.org/sssd/ticket/2356 The python scripts are not tested with python3 and /usr/bin/python can be symbolic link to python3 on some distributions. Reviewed-by: Sumit Bose <sbose@redhat.com>
* TESTS: sss_ssh - textual public key formatPavel Reichl2014-06-182-0/+102
| | | | Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TEST: Add test for expand homedirLukas Slebodnik2014-06-021-0/+190
|
* UTIL: Add function sss_parse_name_constLukas Slebodnik2014-06-021-0/+86
| | | | | | | | | Variable with type 'const char *' can be used as output argument in function sss_parse_name, but there will be warning. warning: passing 'const char **' to parameter of type 'char **' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
* TESTS: fgetc returns int, not charJakub Hrozek2014-06-021-1/+1
| | | | | | | We used "char c = fgetc()" where we should have used "int c = fgetc()" This bug caused errors on big-endian architectures. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TEST: Add ad_gpo unit testsYassir Elley2014-05-301-0/+388
| | | | Reviewed-by: Sumit Bose <sbose@redhat.com>
* TEST: Add libsss_simpleifp.so to dlopen testLukas Slebodnik2014-05-291-0/+3
| | | | Reviewed-by: Sumit Bose <sbose@redhat.com>
* sss_sifp: add shortcuts for common use casesPavel Březina2014-05-291-0/+168
| | | | | | https://fedorahosted.org/sssd/ticket/2254 Reviewed-by: Sumit Bose <sbose@redhat.com>
* sss_sifp: add support for string dictionaryPavel Březina2014-05-291-0/+211
| | | | | | https://fedorahosted.org/sssd/ticket/2254 Reviewed-by: Sumit Bose <sbose@redhat.com>
* sss_sifp: unit testsPavel Březina2014-05-291-0/+1552
| | | | | | https://fedorahosted.org/sssd/ticket/2254 Reviewed-by: Sumit Bose <sbose@redhat.com>
* TEST: simple_access & sysdb tests - cleanupPavel Reichl2014-05-282-7/+2
| | | | | | Before running tests do cleanup. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TEST: unused variablePavel Reichl2014-05-281-3/+0
| | | | | | Remove unused variable causing warning. 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>
* tests: Add test for confdb_list_all_domain_namesJakub Hrozek2014-05-281-0/+149
| | | | Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* TEST: Test empty results from functions sysdb_search_*Lukas Slebodnik2014-05-271-0/+136
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TESTS: check dbus mock resultJakub Hrozek2014-05-271-0/+4
| | | | Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TESTS: check allocation resultJakub Hrozek2014-05-271-0/+8
| | | | Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* SBUS: Add org.freedesktop.DBus.Properties.GetAll to IntrospectionJakub Hrozek2014-05-271-0/+4
| | | | | Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* SBUS: Implement org.freedesktop.DBus.Properties.GetAll for primitive typesJakub Hrozek2014-05-273-2/+715
| | | | | | | | | | | | This patch implements the GetAll method of the org.freedesktop.DBus.Properties interface by iterating over the available getters and putting all the results into a single getter. The patch includes a unit test that exercies all currently supported array types. Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TEST: fix warning in sbus_codegen_testsPavel Reichl2014-05-261-0/+1
| | | | Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>