summaryrefslogtreecommitdiffstats
path: root/src/tests/cmocka
Commit message (Collapse)AuthorAgeFilesLines
...
* cache_req: switch to new codePavel Březina2016-10-201-1/+1
| | | | | | | This patch switch the old switch-based cache req code to the new plugin-based. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* tests: Add tests for getorig by UPN NSS opJakub Hrozek2016-10-111-0/+34
| | | | | Reviewed-by: Sumit Bose <sbose@redhat.com> Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
* tests: Add tests for sidbyname NSS operationJakub Hrozek2016-10-111-0/+129
| | | | | Reviewed-by: Sumit Bose <sbose@redhat.com> Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
* tests: Add a regression test for upstream ticket #3131Jakub Hrozek2016-09-221-0/+66
| | | | | | | Tests that running two duplicate SRV resolution queries succeeds and returns a valid host name. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* p11: return a fully-qualified nameSumit Bose2016-09-161-8/+8
| | | | | | Related to https://fedorahosted.org/sssd/ticket/3165 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* p11: only set PKCS11_LOGIN_TOKEN_NAME if gdm-smartcard is usedSumit Bose2016-09-161-12/+77
| | | | | | Resolves https://fedorahosted.org/sssd/ticket/3165 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TESTS: Adding tests for ad_enabled_domains optionPetr Cech2016-08-171-0/+328
| | | | | | | | | | | | There is special logic around ad_enabled_domains option: * option is disabled by default * master domain is always added to enabled domains Resolves: https://fedorahosted.org/sssd/ticket/2828 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* Make resolv_is_address() function public and create some basic testsJustin Stephenson2016-08-161-0/+25
| | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/2789 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TESTS: Use the DP handlers in simple provider tests, add more testsJakub Hrozek2016-08-101-21/+165
| | | | | | | Use the full simple access control handlers, just like SSSD does in the tests. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* dyndns-tests: Fix false positive failuresLukas Slebodnik2016-08-101-0/+1
| | | | | | | | | | | | | | The child process finished faster then it has handled by parent and therefore it timed out. It's the similar solution as in b3074dca3acebd91437ef13d3329d6d65d655215 [ RUN ] dyndns_test_error (Fri Jul 29 16:12:00:621444 2016) [sssd] [nsupdate_child_timeout] (0x0020): Timeout reached for dynamic DNS update Could not run the test - check test fixtures [ ERROR ] dyndns_test_error Reviewed-by: Petr Čech <pcech@redhat.com>
* SYSDB: Avoid optimisation with modifyTimestamp for usersLukas Slebodnik2016-08-101-14/+0
| | | | | | | | | | | | | | | The usage of modifyTimestamp needn't be a reliable way for detecting of changes in user entry in LDAP. The authorisation need to rely current data from LDAP and therefore we will temporary disable optimisation with modifyTimestamp and we will rather rely on deep comparison of attributes. In he future, it might be changed and responders might control the optimization level. Resolves: https://fedorahosted.org/sssd/ticket/3110 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* SYSDB: Fix setting dataExpireTimestamp if sysdb is supposed to set the ↵Jakub Hrozek2016-08-051-0/+83
| | | | | | | | | | | | | current time sysdb is already able to retrieve the current timestamp if the caller doesn't specify it. However, for the timestamp cache this came too late and the timestamp cache used zero as the 'now' time. Resolves: https://fedorahosted.org/sssd/ticket/3064 Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* SDAP: add enterprise principal strings for user searchesSumit Bose2016-07-291-0/+34
| | | | | | | | | | Unfortunately principal aliases with an alternative realm are stored in IPA as the string representation of an enterprise principal, i.e. name\@alt.realm@IPA.REALM. To be able to lookup the alternative principal in LDAP properly the UPN search filter is extended to search for this type of name as well. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* utils: add is_email_from_domain()Sumit Bose2016-07-291-0/+21
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* views: properly override group member namesSumit Bose2016-07-291-9/+9
| | | | | | Resolves https://fedorahosted.org/sssd/ticket/2948 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* test_utils: Fixing assignment discards 'const' qualifierPetr Cech2016-07-261-2/+2
| | | | Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* tests: add tests for netlogon_get_domain_infoSumit Bose2016-07-251-0/+81
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* tests: add tests for sss_get_domain_mappings_content()Sumit Bose2016-07-251-0/+163
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sysdb: make subdomain calls aware of upn_suffixesSumit Bose2016-07-183-17/+17
| | | | | | | sysdb_subdomain_store() and sysdb_update_subdomains() can now update upn_suffixes as well. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sysdb: add UPN suffix support for the master domainSumit Bose2016-07-181-6/+12
| | | | | | | sysdb_master_domain_update() and sysdb_master_domain_add_info() are now aware of the UPN suffix attribute. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* test_utils: Clean files after sss_write_krb5_conf_snippetLukas Slebodnik2016-07-181-0/+9
| | | | | | | The test directory was not removed (tp_test_utils-test_utils) because it contain the snippet for krb5_libdefaults. Reviewed-by: Fabiano Fidêncio <fabiano@fidencio.org>
* DP: rename be_acct_req to dp_id_dataPavel Březina2016-07-151-2/+2
| | | | Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* nss-srv-tests: Fix prototype of wrapped ncache functionsLukas Slebodnik2016-07-121-16/+12
| | | | | | | | | | The argument ttl was recently removed from negative cache functions (sss_ncache_check_user, sss_ncache_check_uid, sss_ncache_check_sid, sss_ncache_check_cert) but it was not removed from wrapped versions in nss-srv-tests. It caused a crash on machine with big endian and when configure wih --coverage. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* sudo: solve problems with fully qualified namesPavel Březina2016-07-071-60/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | sudo expects the same name in sudo rule as login name. Therefore if fully qualified name is used or even enforced by setting use_fully_qualified_names to true or by forcing default domain with default_domain_suffix sssd is able to correctly return the rules but sudo can't match the user with contect of sudoUser attribute since it is not qualified. This patch changes the rules on the fly to avoid using names at all. We do this in two steps: 1. We fetch all rules that match current user name, id or groups and replace sudoUser attribute with sudoUser: #uid. 2. We fetch complementry rules that contain netgroups since it is expected we don't have infromation about existing netgroups in cache, sudo still needs to evaluate it for us if needed. This patch also remove test for sysdb_get_sudo_filter since it wasn't sufficient anyway and I did not rewrite it since I don't thing it is a good thing to have filter tests that depends on exact filter order. Resolves: https://fedorahosted.org/sssd/ticket/2919 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* UTIL: Remove unused functionsJakub Hrozek2016-07-072-95/+0
| | | | | | The conversion to sysdb made several functions obsolete. Remove them. Reviewed-by: Sumit Bose <sbose@redhat.com>
* RESPONDERS: Return the sysdb name from cache_reqJakub Hrozek2016-07-071-2/+2
| | | | | | | name.name is the input name. Since cache_req is an internal interface, we need to return the sysdb name instead. Reviewed-by: Sumit Bose <sbose@redhat.com>
* PAM: Use qualified names internally in the PAM responderJakub Hrozek2016-07-071-28/+73
| | | | | | | The name is converted from whatever we receive on input to the internal format before processing the data further. Reviewed-by: Sumit Bose <sbose@redhat.com>
* TESTS: Start fixing the PAM responder tests for fully qualified names in sysdbMichal Zidek2016-07-071-11/+21
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TESTS; orig_name does not need to be expanded to sysdb formatSumit Bose2016-07-071-21/+3
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* NSS: Fix NSS responder to cope with fully-qualified usernamesJakub Hrozek2016-07-071-470/+825
| | | | | | | | | | | | | | | | | | | | | | | | Adds a utility function sized_output_name() which wraps the output_name() function and returns the sized_struct structure. This function is used when formatting the output name for the client, but also when saving/deleting the memory cache entries. Its sister function sized_member_name() is very similar, but infers the domain name from memberuid or ghost attribute. Because all names internally are used in the same format, the logic to append domain or format the usename for output in the fill_XXX() family of functions is much simpler. In general, adding a domain suffix no longer relies in the domain being a subdomain, but only the dom->fqnames The parse_member() function was removed because it is no longer required. The nss test was amended to store names in the internal fqdn format on input and checks for either shortnames or qualified names with the right format created using sss_tc_fqname() on output. Reviewed-by: Sumit Bose <sbose@redhat.com>
* NCACHE: Store FQDNs internaly, check for shortnames in filesJakub Hrozek2016-07-071-24/+60
| | | | | | | | When storing users and groups by their name in the negative cache, store them fully qualfied so that the responder only has to track the name in the internal format once the input is converted. Reviewed-by: Sumit Bose <sbose@redhat.com>
* TESTS: Start fixing the NSS test for fully qualified names in sysdbMichal Zidek2016-07-071-61/+130
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TESTS: Fix the nested group tests to cope with FQDNsJakub Hrozek2016-07-071-43/+132
| | | | Reviewed-by: Sumit Bose <sbose@redhat.com>
* UTIL: expand_homedir_template manages usernames internallyJakub Hrozek2016-07-071-4/+10
| | | | | | | | | expand_homedir_template() can be considered an outward-facing interface, therefore the function and its input structure will accept the internal name format and parse it internally into a username and domain component. Reviewed-by: Sumit Bose <sbose@redhat.com>
* RESPONDER: Use fqnames for cache_req lookups of users and groupsJakub Hrozek2016-07-071-65/+119
| | | | | | | When looking up users or groups by name, qualify the name into the internal format before the lookup. Reviewed-by: Sumit Bose <sbose@redhat.com>
* TESTS: Convert the simple access provider to cmockaJakub Hrozek2016-07-071-0/+692
| | | | | | | | Using a cmocka-based test allows us to initialize the domain using the common helper functions which in turn allows us to set different properties with confdb, same as sssd itself does. Reviewed-by: Sumit Bose <sbose@redhat.com>
* TESTS: Amend sysdb_view tests for the FQDN schemaJakub Hrozek2016-07-071-49/+77
| | | | Reviewed-by: Sumit Bose <sbose@redhat.com>
* TESTS: Start converting the sysdb views tests to the fqname formatMichal Zidek2016-07-071-14/+35
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TESTS: Fix the ldap_id_cleanup test for using qualified names in sysdbMichal Zidek2016-07-071-6/+32
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* UTIL: Add a utility function sss_output_nameJakub Hrozek2016-07-071-0/+33
| | | | | | | | | | Adds a convenience function that will help reduce the amount of code duplication in the responders. All responders need to parse the username from the internal format, lower-case the name, if the domain is case-insensitive and then replace spaces if the responder is configured to do so. Reviewed-by: Sumit Bose <sbose@redhat.com>
* UTIL: Add a utility function to create a list of qualified namesJakub Hrozek2016-07-071-0/+32
| | | | | | | Adds a convenience wrapper around sss_create_fqname that qualifies a list of names into the format used internally in sssd. Reviewed-by: Sumit Bose <sbose@redhat.com>
* TESTS: Add a test for sss_create_internal_fqnameJakub Hrozek2016-07-071-0/+29
| | | | Reviewed-by: Sumit Bose <sbose@redhat.com>
* TESTS: Add a test for sss_parse_internal_fqnameJakub Hrozek2016-07-071-6/+69
| | | | Reviewed-by: Sumit Bose <sbose@redhat.com>
* IPA/AD: globally set krb5 canonicalization flagSumit Bose2016-07-061-6/+6
| | | | | | | | | | | If Kerberos principal canonicalization is configured in SSSD, currently it is the default for the IPA provider, a configuration snippet is generated for the system-wide libkrb5 configuration so that all kerberized applications will use canonicalization by default. Resolves https://fedorahosted.org/sssd/ticket/3041 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sysdb: Use ldb_result as output in sysdb_search_ts_{users,groups}Lukas Slebodnik2016-07-061-22/+11
| | | | | | | | | | | | | Passing address of unsigned to the output argument size_t causes access out of boundaries for type unsigned and and wrong data on big endian. It looks like functions sysdb_search_ts_{users,groups} need to store results in structure ldb_result anyway for further processing. Therefore it will be better to convert output arguments size_t* + ldb_message*** into structure ldb_result and avoid using additional helper variable with type size_t before each invocation of these functions. Reviewed-by: Sumit Bose <sbose@redhat.com>
* test_sysdb_ts_cache: Do not use wrong pointer for output argumentLukas Slebodnik2016-07-061-2/+5
| | | | | | | | | | | | | | | | | | The function sysdb_search_groups expects pointer to size_t as an output argument msgs_count. However, struct ldb_result has type unsigned for element count. The size of unsigned is lower then size of size_t on some platforms. Therefore we should not cast to pointer to size_t if we want to write count of messages into struct ldb_result -> count. The valgrind did not detect write out of boundary for the element count because it is the 1st element in structure ldb_result. It didn't cause any problem on little endian because the most significant part of size_t was properly stored to type unsigned. We firstly store to output argument _msgs_count and then to output argument _msgs in the function sysdb_cache_search_entry therefore element msgs was not damaged and contained correct data. Reviewed-by: Sumit Bose <sbose@redhat.com>
* Responders: Make the client context more genericSimo Sorce2016-06-294-9/+43
| | | | | | | | | | | | | | | This is useufl to allow reusing the responder code with other protocols. Store protocol data and responder state data behind opaque pointers and use tallog_get_type to check they are of the right type. This also allows to store per responder state_ctx so that, for example, the autofs responder does not have to carry useless variables used only by the nss responder. Resolves: https://fedorahosted.org/sssd/ticket/2918 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sss_sifp: make it compatible with latest version of the infopipePavel Březina2016-06-271-39/+17
| | | | | | | | | | Current version of infopipe leverage different interfaces and object paths which were not accessible through the simple ifp library. This patch changes the API, which is ok since it was never declared as a public library and beside deprecated openlmi there are no known users. We will use this in sssctl tool. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* TESTS: Add a unit test for timestamps cachesJakub Hrozek2016-06-231-0/+1435
| | | | Reviewed-by: Sumit Bose <sbose@redhat.com>
* SYSDB: If modifyTimestamp is the same, only update the TS cacheJakub Hrozek2016-06-232-0/+3
| | | | | | | | | | | | | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/2602 If the entry being saved contains the original modifyTimestamp attribute and the modifyTimestamp attribute is the same as the one we already saved to the timestamp cache, only the expire timestamps in the asynchronous timestamp cache will be bumped and the sysdb code will avoid writes to the main cache completely. If the modifyTimestamp is either missing or differs, we assume the entry had changed and do a full write to the main cache. Also amends the generic sysdb_set_attrs* and similar functions that their results is also reflected in the timestamps cache. Reviewed-by: Sumit Bose <sbose@redhat.com>