summaryrefslogtreecommitdiffstats
path: root/src/tests/cmocka
Commit message (Collapse)AuthorAgeFilesLines
...
* TEST: Refactor test_ioLukas Slebodnik2014-05-161-48/+115
| | | | | | | Tests should not create resources. It is purpose of setup functions. Patch fixes also fd leaks from mkstemp. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TEST: Remove unused variablePavel Reichl2014-05-141-3/+0
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* IFP: Per-attribute ACL for usersJakub Hrozek2014-05-131-0/+101
| | | | | | | | | | | Introduces a new option called user_attributes that allows to specify which user attributes are allowed to be queried from the IFP responder. By default only the default POSIX set is allowed, this option allows to either add other attributes (+attrname) or remove them from the default set (-attrname). Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* IFP: use a list of allowed_uids for authenticationJakub Hrozek2014-05-131-3/+41
| | | | | | | | Similar to the PAC responder, the InfoPipe uses a list of UIDs that are allowed to communicate with the IFP responder. Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Stef Walter <stefw@redhat.com>
* IFP: Add utility functionsJakub Hrozek2014-05-131-0/+210
| | | | | | | | | | | | | Adds a number of utility functions, most importanly ifp_req_create(). The ifp_req is a structure that will be passed along with the ifp request and would provide easy access to both the sbus_request data and per-responder data, like the ifp_ctx. Also includes a utility function to split a path prefix from a full path and add a ldb_element into a dictionary. These will be reused later. Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Stef Walter <stefw@redhat.com>
* SBUS: Add an async request to retrieve the caller IDJakub Hrozek2014-05-131-0/+268
| | | | | | | | | | | | | | | | | Adds an async request sbus_get_sender_id_{send,recv} that allows retrieval of UID based on "sender" as returned by dbus_message_get_sender(). The UID is an int64_t to be able to use "-1" to as a fallback value for uknown or error cases. The unit test is added as a standalone one, not part of the sbus_tests because the request, and by extension the unit test relies on being connected to the system bus, which is very unlikely to work in a build system. Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Stef Walter <stefw@redhat.com>
* RESPONDERS: Add a new request sss_parse_inp_sendJakub Hrozek2014-04-223-1/+336
| | | | | | | | | The responders were copying code to parse input and on encountering an uknown domain, send the discover subdomain request. This patch adds a reusable request that can always be called in responders and in case the name can be parsed, just shortcut. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* TESTS: Split a separate common_mock_resp_dp moduleJakub Hrozek2014-04-222-71/+101
| | | | | | | | Splitting the module would allow responders that test the Data Provider requests to use the mock_rctx/mock_cctx functions without duplicate definitions. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* Add a unit test for sss_parse_name_for_domainsJakub Hrozek2014-04-171-4/+199
| | | | | | | | The code of sss_parse_name_for_domains is really complex and hard to read. This patch adds a unit test to be able to see the function being used. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* cmocka-unit-test-for-functions-getpwuid*-addedPallavi Jha2014-04-031-1/+282
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TESTS: Remove unused macrosLukas Slebodnik2014-03-122-3/+0
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TEST: Do not clean up if test fail.Lukas Slebodnik2014-03-121-1/+3
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TEST: Use right domain name in negcache testLukas Slebodnik2014-03-121-7/+7
| | | | | | | | | | | Directory tests_ncache was not removed after negcache test, because sysdb cache had different name and was not removed in the function test_dom_suite_cleanup. [sssd] [test_dom_suite_cleanup] (0x0020): Could not delete the test dir (39) (Directory not empty) Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TEST: Remove unused argument sysdb_pathLukas Slebodnik2014-03-125-15/+12
| | | | | | | | | Name of sysdb file is automatically generated from domain name and db_path in function sysdb_domain_init. talloc_asprintf is called with arguments "%s/cache_%s.ldb", db_path, dom->name Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TEST: Use unique directory for negcache testLukas Slebodnik2014-03-061-1/+1
| | | | | | | | | | | | | | | nss-srv-tests and test-negcache wrote temporary files to the same subdirectory 'tests_nss'. There could be a race condition when tests ran in parallel. The first test could remove directory which the second one wanted to use. [ldb] (0x0020): Unable to open tdb 'tests_nss/test_nss_conf.ldb' [ldb] (0x0020): Failed to connect to 'tests_nss/test_nss_conf.ldb' with backend 'tdb': Unable to open tdb 'tests_nss/test_nss_conf.ldb' [confdb_init] (0x0010): Unable to open config database [tests_nss/test_nss_conf.ldb] [create_dom_test_ctx] (0x0020): confdb_init failed: 5 Reviewed-by: Michal Žídek <mzidek@redhat.com>
* Unit-test-for-negcache-module-addedPallavi Jha2014-03-051-0/+651
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* DP: Provide separate dp_copy_defaults functionJakub Hrozek2014-02-261-0/+421
| | | | | | https://fedorahosted.org/sssd/ticket/2257 Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* IPA: refactor idmap code and add testSumit Bose2014-02-261-0/+249
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* IDMAP: add sss_idmap_check_collision(_ex)Sumit Bose2014-02-261-0/+93
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* tests: nested groups unit testPavel Březina2014-02-181-0/+198
| | | | | | Resolves: https://fedorahosted.org/sssd/ticket/2024 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* tests: new macro sss_will_return_alwaysPavel Březina2014-02-181-0/+2
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* tests: mock sysdb users and groupsPavel Březina2014-02-182-0/+241
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* tests: mock SDAPPavel Březina2014-02-182-0/+176
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* test_dyndns: Test right variable after allocation.Lukas Slebodnik2014-02-171-1/+1
| | | | Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* Make DEBUG macro invocations variadicNikolai Kondrashov2014-02-124-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | Use a script to update DEBUG macro invocations to use it as a variadic macro, supplying format string and its arguments directly, instead of wrapping them in parens. This script was used to update the code: grep -rwl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e \ 'use strict; use File::Slurp; my $text=read_file(\*STDIN); $text=~s#(\bDEBUG\s*\([^(]+)\((.*?)\)\s*\)\s*;#$1$2);#gs; print $text;' < "$f.orig" > "$f" rm "$f.orig" done Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* TESTS: Fix authtok test for zero length string.Lukas Slebodnik2014-01-241-1/+1
| | | | | | | There is a test for sss_authtok_set where '\0' is used as argument data. '\0' is evaluated as zero and zero is treated as a null pointer. And there is another test for NULL pointer few lines before. Patch changes 3rd argument '\0' into properly cast zero length sting ""
* NSS: Don't use printf(3) on user provided strings.Stef Walter2014-01-123-36/+12
| | | | | | | | | | | | | | | | | | | | This also fixes several corner cases and crashers. It's not prudent to pass user input to (even admin) input as a format string to printf, and various distros now check for this. This can cause accessing memory incorrectly, and various also various libc abort()'s. In addition various assumptions were made about full_name_format that aren't necessarily the case if the user uses a more complex format. Use safe-printf.c implementation for formatting full_name_format. Adapt the NSS resolver so it doesn't barf on formatted strings that are shorter than expected given a full_name_format. Tests added and updated appropriately.
* util: Fix const cast failures when building with -WerrorStef Walter2014-01-101-6/+6
| | | | | | | | | | When building with -Werror 'make check' fails with many errors like: ../src/tests/cmocka/test_authtok.c: In function ‘test_sss_authtok_password’: ../src/tests/cmocka/test_authtok.c:98:48: error: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Werror=cast-qual] Make sss_authtok_set() @data argument const, and fix its documentation
* cmocka unit test for authtok module addedPallavi Jha2014-01-091-0/+303
|
* AD: Enable fallback to LDAP of trusted domainJakub Hrozek2013-12-191-3/+4
| | | | | Since we have the LDAP port of a trusted AD GC always available now, we can always perform a fallback.
* AD: Add a new option to turn off GC lookupsJakub Hrozek2013-12-191-0/+20
| | | | | | | | | | SSSD now defaults to using GC by default. For some environments, for instance those that don't or can't replicate the POSIX attributes to Global Catalog, this might not be desirable. This patch introduces a new option ad_enable_gc, that is enabled by default. Setting this option to false makes the SSSD contact only the LDAP port of AD DCs.
* AD: Add a utility function to create list of connectionsJakub Hrozek2013-12-191-0/+221
| | | | | | | | | | ad_id.c and ad_access.c used the same block of code. With the upcoming option to disable GC lookups, we should unify the code in a function to avoid breaking one of the code paths. The same applies for the LDAP connection to the trusted AD DC. Includes a unit test.
* Use lower-case name for case-insensitive searchesSumit Bose2013-12-191-0/+38
| | | | | | | | | | | | The patch makes sure that a completely lower-cased version of a fully qualified name is used for case insensitive searches. Currently there are code paths where the domain name was used as configured and was not lower-cased. To make sure this patch does not break with old entries in the cache or case sensitive domains a third template was added to the related filters templates which is either filled with a completely lower-cased version or with the old version. The other two template values are unchanged.
* SSSD: Unit test - sss_ldap_dn_in_search_basesPavel Reichl2013-11-291-0/+191
| | | | | | | Unit test testing detection of the right domain when processing group with members from several domains Resolves: https://fedorahosted.org/sssd/ticket/2132
* TESTS: Remove test dir after successful testsLukas Slebodnik2013-11-181-1/+6
| | | | | test_utils removed files from test_dir before test execution, but files wasn't clean up after successful test execution.
* nss: check for Well-Known SIDs in SID based requestsSumit Bose2013-11-151-0/+192
|
* nss-srv-tests: check packet statusSumit Bose2013-11-151-14/+50
| | | | | | Besides checking the content of output packets it might also be useful to check the status. This is e.g. important if no results are expected and the status should be set to ENOENT and not to any other error code.
* Add utility to handle Well-Known SIDsSumit Bose2013-11-151-0/+110
|
* sss_names_init: allow empty domain nameSumit Bose2013-11-151-0/+122
| | | | | If no domain name is specified the global name pattern and regular expression will be returned.
* SYSDB: Drop the sysdb_ctx parameter - module sysdb_ops (part 2)Michal Zidek2013-11-151-38/+19
|
* SYSDB: Drop the sysdb_ctx parameter from the sysdb_search moduleMichal Zidek2013-11-151-9/+6
|
* free idmapped SIDs correctlyPavel Březina2013-11-071-0/+2
| | | | | Resolves: https://fedorahosted.org/sssd/ticket/2133
* Enhance/add unit tests for find_subdomain_by_sid/nameSumit Bose2013-11-041-0/+263
|
* Include ext headers with #include <foo.h> - contPavel Reichl2013-11-041-1/+1
| | | | Changing style of including header files from outside of sssd tree - from "header.h" to <header.h>
* AD: Fix ad_access_filter parsing with empty filterJakub Hrozek2013-10-301-0/+16
|
* NSS: Print FQDN for groups with mixed domain membershipJakub Hrozek2013-10-291-0/+175
| | | | | | | | | | | | | | | | | This patch is a workaround until https://fedorahosted.org/sssd/ticket/2129 is fixed properly. Consider a group entry such as: cn: subgroup@subdom ghost: someuser ghost: anotheruser@subdom Currently in order to print all group members as FQDN (which is the default for AD provider), the code needs to iterate over the ghost attributes and parse them into (name,domain) and optionally re-add the domain. The proper fix would be to store always just the FQDN in the hardcoded form of user@domain
* TEST: Test getgrnam with emphasis on membersJakub Hrozek2013-10-291-8/+386
|
* AD: Add extended access filterJakub Hrozek2013-10-251-0/+341
| | | | | | | https://fedorahosted.org/sssd/ticket/2082 Adds a new option that allows the admin to specify a LDAP access filter that can be applied globally, per-domain or per-forest.
* tests: Use right format string for type size_tLukas Slebodnik2013-10-251-3/+3
| | | | | | | | This patch fixes few format string warnings in the file test_utils.c src/tests/cmocka/test_utils.c:54:56: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
* idmap: add sss_idmap_domain_by_name_has_algorithmic_mapping()Sumit Bose2013-10-251-0/+41
|