summaryrefslogtreecommitdiffstats
path: root/src/tests
Commit message (Collapse)AuthorAgeFilesLines
* sbus: Check string arguments for valid UTF-8 stringsJakub Hrozek2015-11-111-0/+49
| | | | | | libdbus abort()s when a string argument is not valid UTF-8. Since the arguments sometimes come from untrusted sources, it's better to check the string validity explicitly.
* TESTS: Add warning for unused result of leak check functionsLukas Slebodnik2015-11-111-3/+13
| | | | Reviewed-by: Petr Cech <pcech@redhat.com>
* TESTS: Make check_leaks static functionLukas Slebodnik2015-11-112-9/+4
| | | | Reviewed-by: Petr Cech <pcech@redhat.com>
* TESTS: Check return value of check_leaks_popLukas Slebodnik2015-11-115-10/+16
| | | | Reviewed-by: Petr Cech <pcech@redhat.com>
* TESTS: Initialize leak checkLukas Slebodnik2015-11-112-0/+6
| | | | | | | If leak_check_setup is not called then global_talloc_context was not initialized and check_leaks_pop(global_talloc_context) will fail. Reviewed-by: Petr Cech <pcech@redhat.com>
* AD: Remove unused memory context from ad_user_conn_listLukas Slebodnik2015-11-111-4/+2
| | | | Reviewed-by: Petr Cech <pcech@redhat.com>
* TESTS: Fix warnings -WshadowLukas Slebodnik2015-11-103-14/+14
| | | | | | | | | | | | | | | | | | | | | | src/tests/cmocka/test_sss_sifp.c: In function 'test_sss_sifp_strdup_valid': src/tests/cmocka/test_sss_sifp.c:153: warning: declaration of 'dup' shadows a global declaration /usr/include/unistd.h:528: warning: shadowed declaration is here src/tests/cmocka/test_sss_sifp.c: In function 'test_sss_sifp_strdup_null': src/tests/cmocka/test_sss_sifp.c:163: warning: declaration of 'dup' shadows a global declaration /usr/include/unistd.h:528: warning: shadowed declaration is here src/tests/cmocka/test_sdap.c: In function '__wrap_ldap_next_attribute': src/tests/cmocka/test_sdap.c:203: warning: declaration of 'index' shadows a global declaration /usr/include/string.h:489: warning: shadowed declaration is here src/tests/cmocka/test_responder_cache_req.c: In function 'prepare_user': src/tests/cmocka/test_responder_cache_req.c:163: warning: declaration of 'time' shadows a global declaration /usr/include/time.h:186: warning: shadowed declaration is here src/tests/cmocka/test_responder_cache_req.c: In function 'prepare_group': src/tests/cmocka/test_responder_cache_req.c:244: warning: declaration of 'time' shadows a global declaration /usr/include/time.h:186: warning: shadowed declaration is here Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* pam-srv-tests: Change service nameSumit Bose2015-11-051-1/+1
| | | | | | | | | | | | It would be better to not use 'ssh' or 'sshd' here at all but something like 'pam_test_service' to indicate that it is a generic name. Because a default value should not lead to a code path which handles a special case. The general PAM responder test should not run through the 'sshd' case in pam_reply() only if the service is set explicitly to 'sshd' this features should be tests. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* NSS: fix a use-after-free issueSumit Bose2015-11-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While handling well-known SIDs a debug statement tries to access memory that is already freed. This can be seen with the following output from valgrind. ==17600== Invalid read of size 4 ==17600== at 0x805ACC6: nss_cmd_getbysid (nsssrv_cmd.c:5458) ==17600== by 0x805AF41: nss_cmd_getnamebysid (nsssrv_cmd.c:5509) ==17600== by 0x80662F4: sss_cmd_execute (responder_cmd.c:161) ==17600== by 0x8067015: client_cmd_execute (responder_common.c:249) ==17600== by 0x80671F5: client_recv (responder_common.c:283) ==17600== by 0x806741C: client_fd_handler (responder_common.c:335) ==17600== by 0x45F5112: epoll_event_loop (tevent_epoll.c:728) ==17600== by 0x45F5112: epoll_event_loop_once (tevent_epoll.c:926) ==17600== by 0x45F32EE: std_event_loop_once (tevent_standard.c:114) ==17600== by 0x45EF3BF: _tevent_loop_once (tevent.c:530) ==17600== by 0x45EF5AB: tevent_common_loop_wait (tevent.c:634) ==17600== by 0x45F326E: std_event_loop_wait (tevent_standard.c:140) ==17600== by 0x45EF647: _tevent_loop_wait (tevent.c:653) ==17600== Address 0x4b248a0 is 72 bytes inside a block of size 88 free'd ==17600== at 0x402C26D: free (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==17600== by 0x45FEC9E: _talloc_free_internal (talloc.c:1057) ==17600== by 0x45FEC9E: _talloc_free (talloc.c:1581) ==17600== by 0x8066085: sss_cmd_done (responder_cmd.c:93) ==17600== by 0x805A9B0: nss_check_well_known_sid (nsssrv_cmd.c:5382) ==17600== by 0x805AC86: nss_cmd_getbysid (nsssrv_cmd.c:5455) ==17600== by 0x805AF41: nss_cmd_getnamebysid (nsssrv_cmd.c:5509) ==17600== by 0x80662F4: sss_cmd_execute (responder_cmd.c:161) ==17600== by 0x8067015: client_cmd_execute (responder_common.c:249) ==17600== by 0x80671F5: client_recv (responder_common.c:283) ==17600== by 0x806741C: client_fd_handler (responder_common.c:335) ==17600== by 0x45F5112: epoll_event_loop (tevent_epoll.c:728) ==17600== by 0x45F5112: epoll_event_loop_once (tevent_epoll.c:926) ==17600== by 0x45F32EE: std_event_loop_once (tevent_standard.c:114) ==17600== The patch contains a change to the unit tests which frees the memory in the wrapper for sss_cmd_done() too. This allows to detect this kind of issue in the unit tests as well. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* tests: Regression test with wrong LC_ALLMichal Židek2015-11-042-0/+113
| | | | | | | | | | | | | | | | | | | Ticket: https://fedorahosted.org/sssd/ticket/2785 Test local domain tool with wrong LC_ALL environment variable value. NOTE: The memory cache files are not deleted properly in the test teardown to work around the problem described in ticket https://fedorahosted.org/sssd/ticket/2726 Once the ticket above is solved, the teardown will be updated to remove the memory cache files. Reviewed-by: Michal Židek <mzidek@redhat.com>
* sbus_codegen_tests: Suppress warning Wmaybe-uninitializedLukas Slebodnik2015-10-261-1/+1
| | | | | | | | | | There is a warning with gcc 4.8 src/tests/sbus_codegen_tests.c:1131:18: warning: 'exp_values' may be used uninitialized in this function [-Wmaybe-uninitialized] const char **exp_values; ^ Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* BUILD: Remove SSS_CRYPTO_LIBS from common librariesLukas Slebodnik2015-10-261-1/+0
| | | | | | | The similarcahnge was done in main makefile by change 69b46c32357ccf1aab9c0bd6d1afa33a8724ad77 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* BUILD: Remove unused variablesLukas Slebodnik2015-10-261-2/+0
| | | | | | | LIBCAPNG_{CFLAGS,LIBS} are not defined anywhere in sssd. It could be introduced as copy&paste error from different project. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* responder_common_tests: Removed unused librariesLukas Slebodnik2015-10-261-2/+0
| | | | | | | responder_common_tests does not use any function which requires to link with UNICODE linraries or with libsss_crypt Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* intg_tests: Fix PEP8 warningsLukas Slebodnik2015-10-263-23/+25
| | | | Reviewed-by: Michal Židek <mzidek@redhat.com>
* tests: Add get_next_domain_flags testMichal Židek2015-10-231-0/+135
| | | | | | | Ticket: https://fedorahosted.org/sssd/ticket/2673 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* util: Update get_next_domain's interfaceMichal Židek2015-10-231-9/+10
| | | | | | | | | | | | Update get next domain to be able to include disbled domains and change the interface to accept flags instead of multiple booleans. Ticket: https://fedorahosted.org/sssd/ticket/2673 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* FO: Use refcount to keep track of servers returned to callersJakub Hrozek2015-10-232-11/+17
| | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/2829 Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* tests: Reduce failover code duplicationJakub Hrozek2015-10-231-53/+35
| | | | Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* intg: Fix all PEP8 issuesNikolai Kondrashov2015-10-226-105/+121
| | | | Reviewed-by: Michal Židek <mzidek@redhat.com>
* TESTS: Restrictive permissions in check_and_openPetr Cech2015-10-141-1/+1
| | | | | | | | | | | Check and open tests try to write into and read from created files. There is no reason to have executable permission, so this patch replaces SSS_DFL_X_UMASK with DFL_UMASK permissions. Resolves: https://fedorahosted.org/sssd/ticket/2424 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TESTS: More restrictive permissions in debug_testsPetr Cech2015-10-141-2/+2
| | | | | | | | | | | Debug tests try to write into and read from crreated files. There is no reason to have executable permission, so this patch replaces SSS_DFl_X_UMASK with SSS_DFL_UMASK permissions. Resolves: https://fedorahosted.org/sssd/ticket/2424 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* 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-143-4/+4
| | | | | | | | | | | 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>
* intg: Do not use non-existent pre-incrementNikolai Kondrashov2015-10-111-2/+4
| | | | | | | | | | Do not try to use the pre-increment operator which doesn't exist in Python (and is in fact two "identity" operators - opposites of "negation" operators). Use addition and assignment instead. This fixes infinite loops on failed slapd starting and stopping. Reviewed-by: Michal Židek <mzidek@redhat.com>
* intg: Fix RFC2307bis group member creationNikolai Kondrashov2015-10-091-14/+7
| | | | | | | Fix creation of mixed user/group "member" attribute for RFC2307bis group entries in ldap_ent.py. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* intg: Reduce sssd.conf duplication in test_ldap.pyNikolai Kondrashov2015-10-091-95/+45
| | | | | | | Use a function to generate basic sssd.conf in test_ldap.py to reduce code duplication. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* intg: Split LDAP test fixtures for flexibilityNikolai Kondrashov2015-10-091-30/+83
| | | | | | | Split ldap_test.py fixtures into several functions to allow for partial fixtures and direct use within tests. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* intg: Add support for specifying all user attrsNikolai Kondrashov2015-10-091-12/+39
| | | | | | | Support passing all user attributes to ldap_ent.py's user-creation functions, in integration tests. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* intg: Get base DN from LDAP connection objectNikolai Kondrashov2015-10-092-5/+5
| | | | | | | | Don't use the global LDAP_BASE_DN in integration tests and fixtures, but instead take it from the LDAP connection object (ldap_conn) passed to them explicitly. This makes the tests and fixtures a bit more modular. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* tests: Fix compilation warningJakub Hrozek2015-10-091-8/+8
| | | | Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* intg: fix typosPavel Březina2015-10-081-8/+8
| | | | Reviewed-by: Pavel Reichl <preichl@redhat.com>
* intg: fix assert messages in test_memory_cachePavel Reichl2015-10-081-10/+10
| | | | Reviewed-by: Michal Židek <mzidek@redhat.com>
* cache_req tests: reduce code duplicationPavel Březina2015-10-081-1230/+394
| | | | Reviewed-by: Sumit Bose <sbose@redhat.com>
* cache_req: add support for UPNPavel Březina2015-10-083-10/+385
| | | | Reviewed-by: Sumit Bose <sbose@redhat.com>
* AD: Consolidate connection list construction on ad_common.cJakub Hrozek2015-10-071-0/+34
| | | | Reviewed-by: Sumit Bose <sbose@redhat.com>
* AD: Provide common connection list construction functionsJakub Hrozek2015-10-071-5/+40
| | | | | | | | | | https://fedorahosted.org/sssd/ticket/2810 Provides a new AD common function ad_ldap_conn_list() that creates a list of AD connection to use along with properties to avoid mistakes when manually constructing these lists. Reviewed-by: Sumit Bose <sbose@redhat.com>
* TESTS: Make whitespace_test pass without whitespaceNikolai Kondrashov2015-10-071-1/+6
| | | | | | | | | | Make whitespace_test pass if no trailing whitespace was detected at all. Add two comments explaining how searching and failure handling works. Fixes: https://fedorahosted.org/sssd/ticket/2816 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* DYNDNS: improve nsupdate_msg_add_fwd()Pavel Reichl2015-10-051-3/+277
| | | | | | | | | | | | | | | | | | | | | Update nsupdate_msg_add_fwd() to group commands by address family processed IP address belongs to. It's better to group removing old A addresses and adding new A addresses in a single transaction. Same goes for AAAA addresses. Separate transaction for A and AAAA addresses updates are important because server might block updates for one of these families and thus the update even for the non-blocked address family would unnecessarily fail. For more details please see: https://fedorahosted.org/sssd/wiki/DesignDocs/DDNSMessagesUpdate Resolves: https://fedorahosted.org/sssd/ticket/2495 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* PAM: only allow missing user name for certificate authenticationSumit Bose2015-10-021-0/+38
| | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/2811 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* sbus codegen tests: free ctxPavel Březina2015-10-021-0/+2
| | | | | | | | | | Memory context was not freed therefore we got stuck in tevent loop that mocks D-Bus. Resolves: https://fedorahosted.org/sssd/ticket/2759 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* TESTS: Fixing of uninitialized pointer.Petr Cech2015-10-011-1/+1
| | | | | | | | | | | | | | | There was a bug with uninitialized pointer during solving ticket 2703. More details: rules[0]->services->names[1] is initialized on line 361, but initializing of rules[0]->srchosts->names[1] was missing. Resolves: https://fedorahosted.org/sssd/ticket/2703 Reviewed-by: Pavel Reichl <preichl@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Michal Židek <mzidek@redhat.com>
* test_pam_srv: Run cert test only with NSSLukas Slebodnik2015-09-301-0/+3
| | | | Reviewed-by: Michal Židek <mzidek@redhat.com>
* sysdb-tests: Use valid base64 encoded certificate for searchLukas Slebodnik2015-09-301-1/+1
| | | | | | | sh$ printf "ABC" | base64 -d base64: invalid input Reviewed-by: Michal Židek <mzidek@redhat.com>
* FO: Also reset the server common data in addition to SRVJakub Hrozek2015-09-231-49/+139
| | | | | | | | | | | In a server that is expanded from a SRV query was reset, only it's 'meta-server' status was set to neutral, but the server->common structure still retained its not_working status. This patch also resets the status of the common structure so that both the SRV query and resolving the server are retried next time. Reviewed-by: Sumit Bose <sbose@redhat.com>
* tests: Set p11_child_timeout to 30 in testsMichal Židek2015-09-231-4/+31
| | | | | | | | | | | | Ticket: https://fedorahosted.org/sssd/ticket/2773 Add way to set pam specific options in pam_test_setup adn use it to set the p11_child_timeout value to 30. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Pavel Reichl <preichl@redhat.com>
* DDNS: execute nsupdate for single update of PTR recPavel Reichl2015-09-221-0/+29
| | | | | | | | | | | nsupdate fails definitely if any of update request fails when GSSAPI is used. As tmp solution nsupdate is executed for each update. Resolves: https://fedorahosted.org/sssd/ticket/2783 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* LDAP: Filter out multiple entries when searching overlapping domainsJakub Hrozek2015-09-221-0/+186
| | | | | | | | | | In case domain overlap, we might download multiple objects. To avoid saving them all, we attempt to filter out the objects from foreign domains. We can only do this optimization for non-wildcard lookups. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* tests: Move named_domain from test_utils to common test codeJakub Hrozek2015-09-224-34/+26
| | | | | | This handy function should be reused by other parts of the code. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* DP: Provide a way to mark subdomain as disabled and auto-enable it later ↵Jakub Hrozek2015-09-211-0/+275
| | | | | | | | | | | | | | | | with offline_timeout https://fedorahosted.org/sssd/ticket/2637 Adds a new Data Provider function be_mark_dom_offline() that is a replacement for be_mark_offline(). When called, the function would either set the whole back end offline, just like be_mark_offline or just set the subdomain status to inactive. When a subdomain is inactive, there is a singleton timed task that would re-set the subdomin after offline_timeout seconds. Reviewed-by: Pavel Březina <pbrezina@redhat.com>