test_responder_cache_req.c revision f2a5e29f063f9d623c1336d76f4b2bc500c1a5e2
/*
Authors:
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2014 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <talloc.h>
#include <tevent.h>
#include <errno.h>
#include <popt.h>
#include "tests/cmocka/common_mock.h"
#include "tests/cmocka/common_mock_resp.h"
#include "responder/common/cache_req/cache_req.h"
#include "db/sysdb_private.h" /* new_subdomain() */
#define TEST_CONF_DB "test_responder_cache_req_conf.ldb"
#define TEST_DOM_NAME "responder_cache_req_test"
#define TEST_ID_PROVIDER "ldap"
#define TEST_USER_PREFIX "test*"
struct test_user {
const char *short_name;
const char *upn;
const char *sid;
"S-1-5-21-3623811015-3361044348-30300820-1001", 1001, 1001},
{"test-user2", "upn2@upndomain.com",
"S-1-5-21-3623811015-3361044348-30300820-1002", 1002, 1002}};
struct test_group {
const char *short_name;
const char *sid;
{"test-group2", "S-1-5-21-3623811015-3361044348-30300820-2002", 2002}};
#define new_single_domain_test(test) \
#define new_multi_domain_test(test) \
#define new_subdomain_test(test) \
struct tevent_req *req; \
\
\
assert_non_null(req); \
\
\
} while (0)
struct tevent_req *req; \
\
\
domtype, \
assert_non_null(req); \
\
\
} while (0)
struct cache_req_test_ctx {
struct sss_test_ctx *tctx;
struct sss_nc_ctx *ncache;
struct sss_domain_info *subdomain;
struct cache_req_result *result;
bool dp_called;
/* NOTE: Please, instead of adding new create_[user|group] bool,
* use bitshift. */
bool create_user1;
bool create_user2;
bool create_group1;
bool create_group2;
bool create_subgroup1;
bool create_subuser1;
};
const char *domains[] = {"responder_cache_req_test_a",
"responder_cache_req_test_b",
"responder_cache_req_test_c",
"responder_cache_req_test_d",
NULL};
const char *subdomain_name = "responder_cache_req_test_a_sub";
struct cli_protocol_version *register_cli_protocol_version(void)
{
static struct cli_protocol_version version[] = {
};
return version;
}
{
}
{
}
{
}
{
}
{
}
{
}
{
struct sysdb_attrs *attrs;
char *fqname;
}
struct sss_domain_info *domain,
{
}
struct sss_domain_info *domain,
{
}
struct sss_domain_info *domain,
{
}
struct ldb_message *msg,
const char *check_name)
{
const char *ldbname;
char *shortname;
}
struct sss_domain_info *exp_dom)
{
const char *ldbupn;
const char *ldbsid;
user->short_name);
SYSDB_UIDNUM, 0);
}
struct test_group *group,
{
struct sysdb_attrs *attrs;
char *fqname;
}
struct sss_domain_info *domain,
{
}
struct sss_domain_info *domain,
{
}
struct test_group *group,
struct sss_domain_info *exp_dom)
{
const char *ldbsid;
group->short_name);
SYSDB_GIDNUM, 0);
}
struct sss_domain_info *domain,
const char *sid,
const char **attrs,
{
struct tevent_req *req;
}
struct sss_domain_info *domain,
const char **attrs,
{
struct tevent_req *req;
}
struct tevent_req *
struct sss_domain_info *dom,
bool fast_reply,
enum sss_dp_acct_type type,
const char *opt_name,
const char *extra)
{
if (ctx->create_user1) {
}
if (ctx->create_user2) {
}
if (ctx->create_group1) {
}
if (ctx->create_group2) {
}
if (ctx->create_subgroup1) {
true);
}
if (ctx->create_subuser1) {
true);
}
}
static int test_single_domain_setup(void **state)
{
return 0;
}
static int test_single_domain_teardown(void **state)
{
struct cache_req_test_ctx *test_ctx;
return 0;
}
static int test_multi_domain_setup(void **state)
{
return 0;
}
static int test_multi_domain_teardown(void **state)
{
struct cache_req_test_ctx *test_ctx;
return 0;
}
static int test_subdomain_setup(void **state)
{
int ret;
return 0;
}
static int test_subdomain_teardown(void **state)
{
struct cache_req_test_ctx *test_ctx;
return 0;
}
void test_user_by_name_multiple_domains_found(void **state)
{
/* Setup user. */
"responder_cache_req_test_d", true);
/* Mock values. */
/* Test. */
}
void test_user_by_name_multiple_domains_notfound(void **state)
{
/* Mock values. */
/* Test. */
}
void test_user_by_name_multiple_domains_parse(void **state)
{
char *input_fqn;
char *fqname;
/* Add user to the first domain with different uid then test user. */
"responder_cache_req_test_a", true);
/* Add test user to the last domain. */
"responder_cache_req_test_d", true);
/* Append domain name to the username to form the qualified input.
* We don't use the internal fqname here on purpose, because this is
* the user's input.
*/
"responder_cache_req_test_d");
/* Mock values. */
/* Test. */
0,
}
void test_user_by_name_cache_valid(void **state)
{
/* Setup user. */
/* Test. */
}
void test_user_by_name_cache_expired(void **state)
{
/* Setup user. */
/* Mock values. */
/* DP should be contacted */
/* Test. */
}
void test_user_by_name_cache_midpoint(void **state)
{
/* Setup user. */
/* Mock values. */
/* DP should be contacted without callback */
/* Test. */
}
void test_user_by_name_ncache(void **state)
{
char *fqname;
/* Setup user. */
/* Test. */
}
void test_user_by_name_missing_found(void **state)
{
/* Mock values. */
test_ctx->create_user1 = true;
test_ctx->create_user2 = false;
/* Test. */
}
void test_user_by_name_missing_notfound(void **state)
{
/* Mock values. */
/* Test. */
}
void test_user_by_upn_multiple_domains_found(void **state)
{
/* Setup user. */
"responder_cache_req_test_d", true);
/* Mock values. */
/* Test. */
}
void test_user_by_upn_multiple_domains_notfound(void **state)
{
/* Mock values. */
/* Test. */
}
void test_user_by_upn_cache_valid(void **state)
{
/* Setup user. */
/* Mock values. */
/* Test. */
}
void test_user_by_upn_cache_expired(void **state)
{
/* Setup user. */
/* Mock values. */
/* DP should be contacted */
/* Test. */
}
void test_user_by_upn_cache_midpoint(void **state)
{
/* Setup user. */
/* Mock values. */
/* DP should be contacted without callback */
/* Test. */
}
void test_user_by_upn_ncache(void **state)
{
/* Setup user's UPN. */
/* Mock values. */
/* Test. */
}
void test_user_by_upn_missing_found(void **state)
{
/* Mock values. */
test_ctx->create_user1 = true;
test_ctx->create_user2 = false;
/* Test. */
}
void test_user_by_upn_missing_notfound(void **state)
{
/* Mock values. */
/* Test. */
}
void test_user_by_id_multiple_domains_found(void **state)
{
/* Setup user. */
"responder_cache_req_test_d", true);
/* Mock values. */
/* Test. */
}
void test_user_by_id_multiple_domains_notfound(void **state)
{
/* Mock values. */
/* Test. */
}
{
const char *locator_domain;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup user. */
"responder_cache_req_test_d", true);
/* Test. */
/* Even though the locator tells us to skip all domains except d, the domains
* are standalone and the result of the locator request is only valid within
* the subdomains
*/
}
{
const char *locator_domain;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup user. */
"responder_cache_req_test_d", true);
/* Test. */
}
void test_user_by_id_sub_domains_locator_cache_valid(void **state)
{
const char *locator_domain;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup user. */
true);
/* Test. */
/* Even though the ID is present in the last domain,
* we're not calling sss_dp_get_account_send,
* because the locator will cause cache_req to skip
* all domains except _d
*/
}
void test_user_by_id_sub_domains_locator_cache_expired(void **state)
{
const char *locator_domain;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup user. */
true);
/* Note - DP will only be called once (so, we're not using will_return_always)
* because the locator will tell us which domain to look into. For the recv
* function, we use always b/c internally it mocks several values.
*/
/* Test. */
}
void test_user_by_id_sub_domains_locator_cache_midpoint(void **state)
{
const char *locator_domain;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup user. */
true);
/* Note - DP will only be called once and we're not waiting
* for the results (so, we're not mocking _recv)
*/
/* Test. */
}
void test_user_by_id_sub_domains_locator_missing_found(void **state)
{
const char *locator_domain;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Note - DP will only be called once (so, we're not using will_return_always)
* because the locator will tell us which domain to look into. For the recv
* function, we use always b/c internally it mocks several values.
*/
/* Test. */
test_ctx->create_subuser1 = true;
true);
}
{
/* Test. */
}
{
const char *locator_domain;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup user. */
true);
test_ctx->create_subuser1 = true;
/* Note - DP will only be called once (so, we're not using will_return_always)
* because the locator will tell us which domain to look into. For the recv
* function, we use always b/c internally it mocks several values.
*/
/* Test. */
/* Request the same user again */
}
void test_user_by_id_cache_valid(void **state)
{
/* Setup user. */
/* Test. */
}
void test_user_by_id_cache_expired(void **state)
{
/* Setup user. */
/* Mock values. */
/* DP should be contacted. */
/* Test. */
}
void test_user_by_id_cache_midpoint(void **state)
{
/* Setup user. */
/* Mock values. */
/* DP should be contacted without callback */
/* Test. */
}
void test_user_by_id_ncache(void **state)
{
/* Setup user. */
/* Test. */
}
void test_user_by_id_missing_found(void **state)
{
/* Mock values. */
test_ctx->create_user1 = true;
test_ctx->create_user2 = false;
/* Test. */
}
void test_user_by_id_missing_notfound(void **state)
{
/* Mock values. */
/* Test. */
}
void test_group_by_name_multiple_domains_found(void **state)
{
/* Setup group. */
"responder_cache_req_test_d", true);
/* Mock values. */
/* Test. */
}
void test_group_by_name_multiple_domains_notfound(void **state)
{
/* Mock values. */
/* Test. */
}
void test_group_by_name_multiple_domains_parse(void **state)
{
char *input_fqn;
char *fqname;
/* Add group to the first domain. */
"responder_cache_req_test_a", true);
/* Add group to the last domain, with different gid. */
"responder_cache_req_test_d", true);
/* Append domain name to the groupname.
* We don't use the internal fqname here on purpose, because this is
* the user's input.
*/
"responder_cache_req_test_d");
/* Test. */
}
void test_group_by_name_cache_valid(void **state)
{
/* Setup group. */
/* Test. */
}
void test_group_by_name_cache_expired(void **state)
{
/* Setup group. */
/* Mock values. */
/* DP should be contacted */
/* Test. */
}
void test_group_by_name_cache_midpoint(void **state)
{
/* Setup group. */
/* Mock values. */
/* DP should be contacted without callback */
/* Test. */
}
void test_group_by_name_ncache(void **state)
{
char *fqname;
/* Setup group. */
/* Test. */
}
void test_group_by_name_missing_found(void **state)
{
/* Mock values. */
test_ctx->create_group1 = true;
test_ctx->create_group2 = false;
/* Test. */
}
void test_group_by_name_missing_notfound(void **state)
{
/* Mock values. */
/* Test. */
}
void test_group_by_id_multiple_domains_found(void **state)
{
/* Setup group. */
"responder_cache_req_test_d", true);
/* Mock values. */
/* Test. */
}
void test_group_by_id_multiple_domains_notfound(void **state)
{
/* Mock values. */
/* Test. */
}
{
const char *locator_domain;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup group. */
"responder_cache_req_test_d", true);
/* Test. */
/* Even though the locator tells us to skip all domains except d, the domains
* are standalone and the result of the locator request is only valid within
* the subdomains
*/
}
{
const char *locator_domain;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup group. */
"responder_cache_req_test_d", true);
/* Test. */
}
void test_group_by_id_sub_domains_locator_cache_valid(void **state)
{
const char *locator_domain;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup group. */
true);
/* Test. */
/* Even though the ID is present in the last domain,
* we're not calling sss_dp_get_account_send,
* because the locator will cause cache_req to skip
* all domains except _d
*/
}
void test_group_by_id_sub_domains_locator_cache_expired(void **state)
{
const char *locator_domain;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup group. */
true);
/* Note - DP will only be called once (so, we're not using will_return_always)
* because the locator will tell us which domain to look into. For the recv
* function, we use always b/c internally it mocks several values.
*/
/* Test. */
}
void test_group_by_id_sub_domains_locator_cache_midpoint(void **state)
{
const char *locator_domain;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup group. */
true);
/* Note - DP will only be called once and we're not waiting
* for the results (so, we're not mocking _recv)
*/
/* Test. */
}
void test_group_by_id_sub_domains_locator_missing_found(void **state)
{
const char *locator_domain;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Note - DP will only be called once (so, we're not using will_return_always)
* because the locator will tell us which domain to look into. For the recv
* function, we use always b/c internally it mocks several values.
*/
/* Test. */
test_ctx->create_subgroup1 = true;
true);
}
{
/* Test. */
}
{
const char *locator_domain;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup group. */
true);
test_ctx->create_subgroup1 = true;
/* Note - DP will only be called once (so, we're not using will_return_always)
* because the locator will tell us which domain to look into. For the recv
* function, we use always b/c internally it mocks several values.
*/
/* Test. */
/* Request the same group again */
}
void test_group_by_id_cache_valid(void **state)
{
/* Setup group. */
/* Test. */
}
void test_group_by_id_cache_expired(void **state)
{
/* Setup group. */
/* Mock values. */
/* DP should be contacted */
/* Test. */
}
void test_group_by_id_cache_midpoint(void **state)
{
/* Setup group. */
/* Mock values. */
/* DP should be contacted without callback */
/* Test. */
}
void test_group_by_id_ncache(void **state)
{
/* Setup group. */
/* Test. */
}
void test_group_by_id_missing_found(void **state)
{
/* Mock values. */
test_ctx->create_group1 = true;
test_ctx->create_group2 = false;
/* Test. */
}
void test_group_by_id_missing_notfound(void **state)
{
/* Mock values. */
/* Test. */
}
{
}
void test_user_by_recent_filter_valid(void **state)
{
test_ctx->create_user1 = true;
test_ctx->create_user2 = false;
/* Filters always go to DP */
/* User TEST_USER is created with a DP callback. */
users[0].short_name);
}
void test_users_by_recent_filter_valid(void **state)
{
const char **user_names;
const char *ldb_results[num_users];
test_ctx->create_user1 = true;
test_ctx->create_user2 = true;
/* Filters always go to DP */
/* User TEST_USER1 and TEST_USER2 are created with a DP callback. */
for (int i = 0; i < num_users; ++i) {
SYSDB_NAME, NULL);
}
ldb_results, num_users));
}
void test_users_by_filter_filter_old(void **state)
{
test_ctx->create_user1 = true;
test_ctx->create_user2 = false;
/* This user was updated in distant past, so it wont't be reported by
* the filter search */
/* Filters always go to DP */
users[0].short_name);
}
void test_users_by_filter_notfound(void **state)
{
/* Filters always go to DP */
"nosuchuser*");
}
static void test_users_by_filter_multiple_domains_notfound(void **state)
{
"responder_cache_req_test_d", true);
/* Filters always go to DP */
"nosuchuser*");
}
{
}
void test_group_by_recent_filter_valid(void **state)
{
test_ctx->create_group1 = true;
test_ctx->create_group2 = false;
/* Filters always go to DP */
/* Group TEST_GROUP is created with a DP callback. */
groups[0].short_name);
}
void test_groups_by_recent_filter_valid(void **state)
{
const char **group_names = NULL;
const char **ldb_results = NULL;
test_ctx->create_group1 = true;
test_ctx->create_group2 = true;
/* Filters always go to DP */
/* Group TEST_GROUP1 and TEST_GROUP2 are created with a DP callback. */
for (int i = 0; i < 2; ++i) {
SYSDB_NAME, NULL);
ldb_results[i] = ldbname;
}
}
void test_groups_by_filter_notfound(void **state)
{
/* Filters always go to DP */
"nosuchgroup*");
}
void test_groups_by_filter_multiple_domains_notfound(void **state)
{
"responder_cache_req_test_d", true);
/* Filters always go to DP */
"nosuchgroup*");
}
void test_object_by_sid_user_cache_valid(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Setup user. */
/* Test. */
}
void test_object_by_sid_user_cache_expired(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Setup user. */
/* Mock values. */
/* DP should be contacted */
/* Test. */
}
void test_object_by_sid_user_cache_midpoint(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Setup user. */
/* Mock values. */
/* DP should be contacted without callback */
/* Test. */
}
void test_object_by_sid_user_ncache(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Setup user. */
/* Test. */
}
void test_object_by_sid_user_missing_found(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Mock values. */
test_ctx->create_user1 = true;
test_ctx->create_user2 = false;
/* Test. */
}
void test_object_by_sid_user_missing_notfound(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Mock values. */
/* Test. */
}
void test_object_by_sid_user_multiple_domains_found(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Setup user. */
"responder_cache_req_test_d", true);
/* Mock values. */
/* Test. */
}
void test_object_by_sid_user_multiple_domains_notfound(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Mock values. */
/* Test. */
}
void test_object_by_sid_group_cache_valid(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Setup user. */
/* Test. */
}
void test_object_by_sid_group_cache_expired(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Setup user. */
/* Mock values. */
/* DP should be contacted */
/* Test. */
}
void test_object_by_sid_group_cache_midpoint(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Setup user. */
/* Mock values. */
/* DP should be contacted without callback */
/* Test. */
}
void test_object_by_sid_group_ncache(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Setup user. */
/* Test. */
}
void test_object_by_sid_group_missing_found(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Mock values. */
test_ctx->create_group1 = true;
test_ctx->create_group2 = false;
/* Test. */
}
void test_object_by_sid_group_missing_notfound(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Mock values. */
/* Test. */
}
void test_object_by_sid_group_multiple_domains_found(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Setup user. */
"responder_cache_req_test_d", true);
/* Mock values. */
/* Test. */
}
void test_object_by_sid_group_multiple_domains_notfound(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Mock values. */
/* Test. */
}
void test_object_by_id_user_cache_valid(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Setup user. */
/* Test. */
}
void test_object_by_id_user_cache_expired(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Setup user. */
/* Mock values. */
/* DP should be contacted */
/* Test. */
}
void test_object_by_id_user_cache_midpoint(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Setup user. */
/* Mock values. */
/* DP should be contacted without callback */
/* Test. */
}
void test_object_by_id_user_ncache(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Setup user. We explicitly add the UID into BOTH UID and GID
* namespaces, because otherwise the cache_req plugin would
* search the Data Provider anyway, becase it can't be sure
* the object can be of the other type or not
*/
false,
false,
/* Test. */
}
void test_object_by_id_user_missing_found(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Mock values. */
test_ctx->create_user1 = true;
test_ctx->create_user2 = false;
/* Test. */
}
void test_object_by_id_user_missing_notfound(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Mock values. */
/* Test. */
}
void test_object_by_id_user_multiple_domains_found(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Setup user. */
"responder_cache_req_test_d", true);
/* Mock values. */
/* Test. */
}
void test_object_by_id_user_multiple_domains_notfound(void **state)
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* Mock values. */
/* Test. */
}
void test_object_by_id_group_cache_valid(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Setup user. */
/* Test. */
}
void test_object_by_id_group_cache_expired(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Setup user. */
/* Mock values. */
/* DP should be contacted */
/* Test. */
}
void test_object_by_id_group_cache_midpoint(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Setup user. */
/* Mock values. */
/* DP should be contacted without callback */
/* Test. */
}
void test_object_by_id_group_ncache(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Setup group. We explicitly add the UID into BOTH UID and GID
* namespaces, because otherwise the cache_req plugin would
* search the Data Provider anyway, becase it can't be sure
* the object can be of the other type or not
*/
false,
false,
/* Test. */
}
void test_object_by_id_group_missing_found(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Mock values. */
test_ctx->create_group1 = true;
test_ctx->create_group2 = false;
/* Test. */
}
void test_object_by_id_group_missing_notfound(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Mock values. */
/* Test. */
}
void test_object_by_id_group_multiple_domains_found(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Setup user. */
"responder_cache_req_test_d", true);
/* Mock values. */
/* Test. */
}
void test_object_by_id_group_multiple_domains_notfound(void **state)
{
const char *attrs[] = SYSDB_GRSRC_ATTRS;
/* Mock values. */
/* Test. */
}
{
const char *locator_domain;
const char *attrs[] = SYSDB_PW_ATTRS;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup user. */
"responder_cache_req_test_d", true);
/* Test. */
/* Even though the locator tells us to skip all domains except d, the domains
* are standalone and the result of the locator request is only valid within
* the subdomains
*/
}
{
const char *locator_domain;
const char *attrs[] = SYSDB_PW_ATTRS;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup user. */
"responder_cache_req_test_d", true);
/* Test. */
}
{
const char *locator_domain;
const char *attrs[] = SYSDB_PW_ATTRS;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup user. */
true);
/* Test. */
/* Even though the ID is present in the last domain,
* we're not calling sss_dp_get_account_send,
* because the locator will cause cache_req to skip
* all domains except _d
*/
}
{
const char *locator_domain;
const char *attrs[] = SYSDB_PW_ATTRS;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup user. */
true);
/* Note - DP will only be called once (so, we're not using will_return_always)
* because the locator will tell us which domain to look into. For the recv
* function, we use always b/c internally it mocks several values.
*/
/* Test. */
}
{
const char *locator_domain;
const char *attrs[] = SYSDB_PW_ATTRS;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup user. */
true);
/* Note - DP will only be called once and we're not waiting
* for the results (so, we're not mocking _recv)
*/
/* Test. */
}
{
const char *locator_domain;
const char *attrs[] = SYSDB_PW_ATTRS;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Note - DP will only be called once (so, we're not using will_return_always)
* because the locator will tell us which domain to look into. For the recv
* function, we use always b/c internally it mocks several values.
*/
/* Test. */
test_ctx->create_subuser1 = true;
true);
}
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* The test won't even ask the DP for the object, just iterate
* over the domains using the negative cache and quit
*/
}
{
const char *locator_domain;
const char *attrs[] = SYSDB_PW_ATTRS;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup user. */
true);
test_ctx->create_subuser1 = true;
/* Note - DP will only be called once (so, we're not using will_return_always)
* because the locator will tell us which domain to look into. For the recv
* function, we use always b/c internally it mocks several values.
*/
/* Test. */
/* Request the same user again */
}
{
const char *locator_domain;
const char *attrs[] = SYSDB_PW_ATTRS;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup group. */
"responder_cache_req_test_d", true);
/* Test. */
/* Even though the locator tells us to skip all domains except d, the domains
* are standalone and the result of the locator request is only valid within
* the subdomains
*/
}
{
const char *locator_domain;
const char *attrs[] = SYSDB_PW_ATTRS;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup group. */
"responder_cache_req_test_d", true);
/* Test. */
}
{
const char *locator_domain;
const char *attrs[] = SYSDB_PW_ATTRS;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup group. */
true);
/* Test. */
/* Even though the ID is present in the last domain,
* we're not calling sss_dp_get_account_send,
* because the locator will cause cache_req to skip
* all domains except _d
*/
}
{
const char *locator_domain;
const char *attrs[] = SYSDB_PW_ATTRS;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup group. */
true);
/* Note - DP will only be called once (so, we're not using will_return_always)
* because the locator will tell us which domain to look into. For the recv
* function, we use always b/c internally it mocks several values.
*/
/* Test. */
}
{
const char *locator_domain;
const char *attrs[] = SYSDB_PW_ATTRS;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup group. */
true);
/* Note - DP will only be called once and we're not waiting
* for the results (so, we're not mocking _recv)
*/
/* Test. */
}
{
const char *locator_domain;
const char *attrs[] = SYSDB_PW_ATTRS;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Note - DP will only be called once (so, we're not using will_return_always)
* because the locator will tell us which domain to look into. For the recv
* function, we use always b/c internally it mocks several values.
*/
/* Test. */
test_ctx->create_subgroup1 = true;
true);
}
{
const char *attrs[] = SYSDB_PW_ATTRS;
/* The test won't even ask the DP for the object, just iterate
* over the domains using the negative cache and quit
*/
}
{
const char *locator_domain;
const char *attrs[] = SYSDB_PW_ATTRS;
/* Has to be a talloc ptr, not just const, so it's stealable inside cache_req */
/* Setup group. */
true);
test_ctx->create_subgroup1 = true;
/* Note - DP will only be called once (so, we're not using will_return_always)
* because the locator will tell us which domain to look into. For the recv
* function, we use always b/c internally it mocks several values.
*/
/* Test. */
/* Request the same group again */
}
{
int opt;
struct poptOption long_options[] = {
};
const struct CMUnitTest tests[] = {
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
/* Even though normally the tests should clean up after themselves
* they might not after a failed run. Remove the old db to be sure */
}