test_nss_srv.c revision ea224c3813a537639778f91ac762732b3c289603
/*
Authors:
Jakub Hrozek <jhrozek@redhat.com>
Copyright (C) 2013 Red Hat
SSSD tests: NSS responder tests
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/negcache.h"
#include "responder/nss/nsssrv_private.h"
#include "sss_client/idmap/sss_nss_idmap.h"
#include "util/util_sss_idmap.h"
#define TESTS_PATH "tests_nss"
#define TEST_CONF_DB "test_nss_conf.ldb"
#define TEST_DOM_NAME "nss_test"
#define TEST_SUBDOM_NAME "test.subdomain"
#define TEST_ID_PROVIDER "ldap"
#define TEST_DOM_SID "S-1-5-21-444379608-1639770488-2995963434"
#define N_ELEMENTS(arr) \
struct nss_test_ctx {
struct sss_test_ctx *tctx;
struct sss_domain_info *subdom;
struct sss_cmd_table *nss_cmds;
int ncache_hits;
};
struct nss_test_ctx *nss_test_ctx;
/* Mock NSS structure */
struct nss_ctx *
{
enum idmap_error_code err;
if (!nctx) {
return NULL;
}
return NULL;
}
if (err != IDMAP_SUCCESS) {
return NULL;
}
return nctx;
}
/* Mock reading requests from a client. Use values passed from mock
* instead
*/
{
if (wtype == WRAP_CALL_REAL) {
}
if (len == 0) {
}
return;
}
/* Mock returning result to client. Terminate the unit test instead. */
{
}
{
}
{
return sss_mock_type(enum sss_cli_command);
}
{
return EOK;
}
/* Intercept negative cache lookups */
{
int ret;
}
return ret;
}
{
int ret;
}
return ret;
}
{
int ret;
}
return ret;
}
/* Mock input from the client library */
static void mock_input_user_or_group(const char *username)
{
}
{
}
static void mock_fill_user(void)
{
/* One packet for the entry and one for num entries */
}
static void mock_fill_bysid(void)
{
/* One packet for the entry and one for num entries */
}
static void mock_fill_initgr_user(void)
{
}
static void mock_fill_group_with_members(unsigned members)
{
unsigned i;
if (members == 0) return;
/* Member header , one per member */
for (i=0; i<members; i++) {
}
}
{
/* Sequence of null terminated strings (name, passwd, gecos, dir, shell) */
return EOK;
}
{
unsigned i;
if (*nmem > 0) {
for (i = 0; i < *nmem; i++) {
}
}
/* Make sure we exactly matched the end of the packet */
return EOK;
}
{
unsigned i;
rp = 0;
for (i = 0; i < num_gids; i++) {
}
}
/* ====================== The tests =============================== */
/* Check getting cached and valid user from cache. Account callback will
* not be called and test_nss_getpwnam_check will make sure the user is
* the same as the test entered before starting
*/
{
return EOK;
}
void test_nss_getpwnam(void **state)
{
/* Prime the cache with a valid user */
"testuser", 123, 456, "test user",
NULL, 300, 0);
mock_input_user_or_group("testuser");
/* Query for that user, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
/* Test that searching for a nonexistant user yields ENOENT.
* Account callback will be called
*/
void test_nss_getpwnam_neg(void **state)
{
mock_input_user_or_group("testuser_neg");
/* Wait until the test finishes with ENOENT */
/* Test that subsequent search for a nonexistent user yields
* ENOENT and Account callback is not called, on the other hand
* the ncache functions will be called
*/
mock_input_user_or_group("testuser_neg");
/* Wait until the test finishes with ENOENT */
/* Negative cache was hit this time */
}
static int test_nss_getpwnam_search_acct_cb(void *pvt)
{
"testuser_search", 567, 890, "test search",
NULL, 300, 0);
return EOK;
}
{
return EOK;
}
void test_nss_getpwnam_search(void **state)
{
struct ldb_result *res;
mock_input_user_or_group("testuser_search");
"testuser_search", &res);
/* Wait until the test finishes with EOK */
/* test_nss_getpwnam_search_check will check the user attributes */
"testuser_search", &res);
}
/* Test that searching for a user that is expired in the cache goes to the DP
* which updates the record and the NSS responder returns the updated record
*
* The user's shell attribute is updated.
*/
static int test_nss_getpwnam_update_acct_cb(void *pvt)
{
return EOK;
}
{
return EOK;
}
void test_nss_getpwnam_update(void **state)
{
struct ldb_result *res;
const char *shell;
/* Prime the cache with a valid but expired user */
"testuser_update", 10, 11, "test user",
/* Mock client input */
mock_input_user_or_group("testuser_update");
/* Mock client command */
/* Call this function when user is updated by the mock DP request */
/* Call this function to check what the responder returned to the client */
/* Mock output buffer */
/* Fire the command */
/* Wait until the test finishes with EOK */
/* Check the user was updated in the cache */
"testuser_update", &res);
}
/* Check that a FQDN is returned if the domain is FQDN-only and a
* FQDN is requested
*/
{
return EOK;
}
void test_nss_getpwnam_fqdn(void **state)
{
/* Prime the cache with a valid user */
"testuser_fqdn", 124, 457, "test user",
NULL, 300, 0);
/* Query for that user, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
/* Check that a user with a space in his username is returned fine.
*/
{
return EOK;
}
void test_nss_getpwnam_space(void **state)
{
/* Prime the cache with a valid user */
"space user", 225, 558, "space user",
NULL, 300, 0);
mock_input_user_or_group("space user");
/* Query for that user, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
{
return EOK;
}
void test_nss_getpwnam_space_sub(void **state)
{
/* Set whitespace substitution */
mock_input_user_or_group("space user");
/* Query for that user, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
void test_nss_getpwnam_space_sub_query(void **state)
{
/* Set whitespace substitution */
mock_input_user_or_group("space_user");
/* Query for that user, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
/*
* Check that FQDN processing is able to handle arbitrarily sized
* delimeter
*/
{
return EOK;
}
void test_nss_getpwnam_fqdn_fancy(void **state)
{
/* Prime the cache with a valid user */
"testuser_fqdn_fancy", 125, 458, "test user",
NULL, 300, 0);
/* Query for that user, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
/* Check getting cached and valid id from cache. Account callback will
* not be called and test_nss_getpwuid_check will make sure the id is
* the same as the test entered before starting
*/
{
return EOK;
}
void test_nss_getpwuid(void **state)
{
/* Prime the cache with a valid user */
"testuser1", 101, 401, "test user1",
NULL, 300, 0);
/* Query for that id, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
/* Test that searching for a nonexistent id yields ENOENT.
* Account callback will be called
*/
void test_nss_getpwuid_neg(void **state)
{
/* Wait until the test finishes with ENOENT */
/* Test that subsequent search for a nonexistent id yields
* ENOENT and Account callback is not called, on the other hand
* the ncache functions will be called
*/
/* Wait until the test finishes with ENOENT */
/* Negative cache was hit this time */
}
static int test_nss_getpwuid_search_acct_cb(void *pvt)
{
"exampleuser_search", 107, 987, "example search",
NULL, 300, 0);
return EOK;
}
{
return EOK;
}
void test_nss_getpwuid_search(void **state)
{
struct ldb_result *res;
107, &res);
/* Wait until the test finishes with EOK */
/* test_nss_getpwuid_search_check will check the id attributes */
107, &res);
}
/* Test that searching for an id that is expired in the cache goes to the DP
* which updates the record and the NSS responder returns the updated record
*
* The user's shell attribute is updated.
*/
static int test_nss_getpwuid_update_acct_cb(void *pvt)
{
return EOK;
}
{
return EOK;
}
void test_nss_getpwuid_update(void **state)
{
struct ldb_result *res;
const char *shell;
/* Prime the cache with a valid but expired user */
"exampleuser_update", 109, 11000, "example user",
/* Mock client input */
/* Mock client command */
/* Call this function when id is updated by the mock DP request */
/* Call this function to check what the responder returned to the client */
/* Mock output buffer */
/* Fire the command */
/* Wait until the test finishes with EOK */
/* Check the user was updated in the cache */
109, &res);
}
/* Testsuite setup and teardown */
void **state)
{
/* FIXME - perhaps this should be folded into sssd_domain_init or stricty
* used together
*/
/* Initialize the NSS responder */
/* Create client context */
}
{
int i;
for (i = 0; i < nmem; i++) {
}
return EOK;
}
{
int ret;
.gr_gid = 1123,
};
assert_int_equal(nmem, 0);
return EOK;
}
/* Test that requesting a valid, cached group with no members returns a valid
* group structure
*/
void test_nss_getgrnam_no_members(void **state)
{
/* Prime the cache with a valid group */
"testgroup", 1123,
NULL, 300, 0);
mock_input_user_or_group("testgroup");
/* Query for that group, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
{
int ret;
.gr_gid = 1124,
};
return EOK;
}
/* Test that requesting a valid, cached group with some members returns a valid
* group structure with those members present
*/
void test_nss_getgrnam_members(void **state)
{
/* Prime the cache with a valid group and some members */
"testgroup_members", 1124,
NULL, 300, 0);
"testmember1", 2001, 456, "test member1",
NULL, 300, 0);
"testmember2", 2002, 456, "test member2",
NULL, 300, 0);
"testgroup_members", "testmember1",
SYSDB_MEMBER_USER, false);
"testgroup_members", "testmember2",
SYSDB_MEMBER_USER, false);
mock_input_user_or_group("testgroup_members");
/* Query for that group, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
{
int ret;
"testmember2@"TEST_DOM_NAME };
.gr_gid = 1124,
};
return EOK;
}
/* Test that requesting a valid, cached group with some members returns a valid
* group structure with those members present as fully qualified names
*/
void test_nss_getgrnam_members_fqdn(void **state)
{
/* Query for that group, call a callback when command finishes */
/* Wait until the test finishes with EOK */
/* Restore FQDN settings */
}
{
int ret;
"submember2@"TEST_SUBDOM_NAME };
.gr_gid = 2124,
};
return EOK;
}
/* Test that requesting a valid, cached group with some members returns a valid
* group structure with those members present as fully qualified names
*/
void test_nss_getgrnam_members_subdom(void **state)
{
/* Add a group from a subdomain and two members from the same subdomain
*/
"testsubdomgroup@"TEST_SUBDOM_NAME,
"submember1@"TEST_SUBDOM_NAME,
4001, 456, "test subdomain member1",
NULL, 300, 0);
"submember2@"TEST_SUBDOM_NAME,
2002, 456, "test subdomain member2",
NULL, 300, 0);
"testsubdomgroup@"TEST_SUBDOM_NAME,
"submember1@"TEST_SUBDOM_NAME,
SYSDB_MEMBER_USER, false);
"testsubdomgroup@"TEST_SUBDOM_NAME,
"submember2@"TEST_SUBDOM_NAME,
SYSDB_MEMBER_USER, false);
/* Query for that group, call a callback when command finishes */
/* Wait until the test finishes with EOK */
/* Restore FQDN settings */
}
{
int ret;
const char *exp_members[] = { "testmember1",
"testmember2",
"submember1@"TEST_SUBDOM_NAME };
.gr_gid = 1124,
};
return EOK;
}
void test_nss_getgrnam_mix_dom(void **state)
{
const char *group_strdn = NULL;
/* Add a subdomain user to a parent domain group */
"testgroup_members");
add_groups[0] = group_strdn;
"submember1@"TEST_SUBDOM_NAME,
add_groups, NULL);
mock_input_user_or_group("testgroup_members");
/* Query for that group, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
{
int ret;
"testmember2@"TEST_DOM_NAME,
"submember1@"TEST_SUBDOM_NAME };
.gr_gid = 1124,
};
return EOK;
}
void test_nss_getgrnam_mix_dom_fqdn(void **state)
{
/* Query for that group, call a callback when command finishes */
/* Wait until the test finishes with EOK */
/* Restore FQDN settings */
}
{
int ret;
"submember2@"TEST_SUBDOM_NAME,
"testmember1@"TEST_DOM_NAME };
.gr_gid = 2124,
};
return EOK;
}
void test_nss_getgrnam_mix_subdom(void **state)
{
const char *group_strdn = NULL;
/* Add a subdomain user to a parent domain group */
"testsubdomgroup@"TEST_SUBDOM_NAME);
add_groups[0] = group_strdn;
"testmember1",
add_groups, NULL);
/* Query for that group, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
{
int ret;
.gr_gid = 2123,
};
assert_int_equal(nmem, 0);
return EOK;
}
/* Test that requesting a valid, cached group with space in its name returns a valid
* group structure
*/
void test_nss_getgrnam_space(void **state)
{
/* Prime the cache with a valid group */
"space group", 2123,
NULL, 300, 0);
mock_input_user_or_group("space group");
/* Query for that group, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
{
int ret;
.gr_gid = 2123,
};
assert_int_equal(nmem, 0);
return EOK;
}
/* Test that requesting a valid, cached group with space in its name returns a valid
* group structure
*/
void test_nss_getgrnam_space_sub(void **state)
{
/* Set whitespace substitution */
mock_input_user_or_group("space group");
/* Query for that group, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
{
const char *name;
enum sss_id_type type;
char *expected_result = sss_mock_ptr_type(char *);
if (expected_result == NULL) {
assert_int_equal(blen, 0);
} else {
}
return EOK;
}
void test_nss_well_known_getnamebysid(void **state)
{
/* Wait until the test finishes with EOK */
}
void test_nss_well_known_getnamebysid_special(void **state)
{
/* Wait until the test finishes with EOK */
}
void test_nss_well_known_getnamebysid_non_existing(void **state)
{
/* Wait until the test finishes with EOK */
}
void test_nss_well_known_getidbysid_failure(void **state)
{
/* Wait until the test finishes with EOK */
}
void test_nss_well_known_getsidbyname(void **state)
{
/* Wait until the test finishes with EOK */
}
void test_nss_well_known_getsidbyname_nonexisting(void **state)
{
/* Wait until the test finishes with EOK */
}
void test_nss_well_known_getsidbyname_special(void **state)
{
/* Wait until the test finishes with EOK */
}
{
const char *s;
enum sss_id_type id_type;
/* Sequence of null terminated strings */
assert_string_equal(s, "S-1-2-3-4");
assert_string_equal(s, "orig_name");
assert_string_equal(s, "1234");
return EOK;
}
void test_nss_getorigbyname(void **state)
{
struct sysdb_attrs *attrs;
"orig_name");
/* Prime the cache with a valid user */
"testuserorig", 1234, 5689, "test user orig",
attrs, 300, 0);
mock_input_user_or_group("testuserorig");
/* Query for that user, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
{
const char *s;
enum sss_id_type id_type;
/* Sequence of null terminated strings */
assert_string_equal(s, "S-1-2-3-4");
assert_string_equal(s, "orig_name");
assert_string_equal(s, "1234");
assert_string_equal(s, "phone");
assert_string_equal(s, "+12-34 56 78");
assert_string_equal(s, "mobile");
assert_string_equal(s, "+98-76 54 32");
return EOK;
}
void test_nss_getorigbyname_extra_attrs(void **state)
{
struct sysdb_attrs *attrs;
"orig_name");
/* Prime the cache with a valid user */
"testuserorigextra", 2345, 6789,
"test user orig extra",
attrs, 300, 0);
mock_input_user_or_group("testuserorigextra");
/* Query for that user, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
{
const char *s;
enum sss_id_type id_type;
/* Sequence of null terminated strings */
assert_string_equal(s, "S-1-2-3-4");
assert_string_equal(s, "orig_name");
assert_string_equal(s, "1234");
assert_string_equal(s, "cn=abc");
assert_string_equal(s, "cn=def");
assert_string_equal(s, "cn=123");
return EOK;
}
void test_nss_getorigbyname_multi_value_attrs(void **state)
{
struct sysdb_attrs *attrs;
"orig_name");
/* Prime the cache with a valid user */
"testuserorigmulti", 3456, 7890,
"test user orig multi value",
attrs, 300, 0);
mock_input_user_or_group("testuserorigmulti");
/* Query for that user, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
{
return EOK;
}
void test_nss_getpwnam_upn(void **state)
{
struct sysdb_attrs *attrs;
/* Prime the cache with a valid user */
"upnuser", 34567, 45678, "up user",
attrs, 300, 0);
mock_input_user_or_group("upnuser@upndomain.test");
/* Query for that user, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
/* Test that searching for a nonexistant user yields ENOENT.
* Account callback will be called
*/
void test_nss_getpwnam_upn_neg(void **state)
{
mock_input_user_or_group("nosuchupnuser@upndomain.test");
/* Wait until the test finishes with ENOENT */
/* Test that subsequent search for a nonexistent user yields
* ENOENT and Account callback is not called, on the other hand
* the ncache functions will be called
*/
nss_test_ctx->ncache_hits = 0;
mock_input_user_or_group("nosuchupnuser@upndomain.test");
/* Wait until the test finishes with ENOENT */
/* Negative cache was hit this time */
}
{
return EOK;
}
void test_nss_initgroups(void **state)
{
struct sysdb_attrs *attrs;
"testinitgr", 321, 654, "test initgroups",
attrs, 300, 0);
"testinitgr_gr1", 3211,
NULL, 300, 0);
"testinitgr_gr2", 3212,
NULL, 300, 0);
"testinitgr_gr1", "testinitgr",
SYSDB_MEMBER_USER, false);
"testinitgr_gr2", "testinitgr",
SYSDB_MEMBER_USER, false);
mock_input_user_or_group("testinitgr");
/* Query for that user, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
/* Test that searching for a nonexistant user yields ENOENT.
* Account callback will be called
*/
{
/* Wait until the test finishes with ENOENT */
/* UPN lookup will first hit negcache with the username */
/* Test that subsequent search for a nonexistent user yields
* ENOENT and Account callback is not called, on the other hand
* the ncache functions will be called
*/
nss_test_ctx->ncache_hits = 0;
/* Wait until the test finishes with ENOENT */
/* Negative cache was hit this time */
}
void test_nss_initgr_neg(void **state)
{
test_initgr_neg_by_name("testinitgr_neg", false);
}
static int test_nss_initgr_search_acct_cb(void *pvt)
{
struct sysdb_attrs *attrs;
"testinitgr_srch", 421, 654, "test initgroups",
attrs, 300, 0);
"testinitgr_srch_gr1", 4211,
NULL, 300, 0);
"testinitgr_srch_gr2", 4212,
NULL, 300, 0);
"testinitgr_srch_gr1", "testinitgr_srch",
SYSDB_MEMBER_USER, false);
"testinitgr_srch_gr2", "testinitgr_srch",
SYSDB_MEMBER_USER, false);
return EOK;
}
{
return EOK;
}
void test_nss_initgr_search(void **state)
{
struct ldb_result *res;
mock_input_user_or_group("testinitgr_srch");
"testinitgr_srch", &res);
/* Wait until the test finishes with EOK */
/* test_nss_getpwnam_search_check will check the user attributes */
"testinitgr_srch", &res);
}
static int test_nss_initgr_update_acct_cb(void *pvt)
{
struct sysdb_attrs *attrs;
"testinitgr_update",
"testinitgr_check_gr2", 5212,
NULL, 300, 0);
"testinitgr_check_gr2",
"testinitgr_update",
SYSDB_MEMBER_USER, false);
return EOK;
}
{
return EOK;
}
void test_nss_initgr_update(void **state)
{
struct sysdb_attrs *attrs;
"testinitgr_update", 521, 654, "test initgroups",
attrs, 300, 0);
"testinitgr_update_gr1", 5211,
NULL, 300, 0);
"testinitgr_update_gr1", "testinitgr_update",
SYSDB_MEMBER_USER, false);
mock_input_user_or_group("testinitgr_update");
/* Query for that user, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
static int test_nss_initgr_update_acct_2expire_attributes_cb(void *pvt)
{
struct sysdb_attrs *attrs;
"testinitgr_2attr",
"testinitgr_2attr_gr12", 5222,
NULL, 300, 0);
"testinitgr_2attr_gr12",
"testinitgr_2attr",
SYSDB_MEMBER_USER, false);
return EOK;
}
{
return EOK;
}
/*
* SYSDB_INITGR_EXPIRE has default value 0 => initgroups was not finished.
* SYSDB_CACHE_EXPIRE has value from future => getpwnam finished successfully
*
* Test result: DP should be contacted for update.
*/
void test_nss_initgr_update_two_expire_attributes(void **state)
{
struct sysdb_attrs *attrs;
0);
"testinitgr_2attr", 522, 655, "test initgroups2",
attrs, 300, 0);
"testinitgr_2attr_gr11", 5221,
NULL, 300, 0);
"testinitgr_2attr_gr11", "testinitgr_2attr",
SYSDB_MEMBER_USER, false);
mock_input_user_or_group("testinitgr_2attr");
mock_account_recv(0, 0, NULL,
/* Query for that user, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
void test_nss_initgroups_upn(void **state)
{
mock_input_user_or_group("upninitgr@upndomain.test");
/* Query for that user, call a callback when command finishes */
/* Wait until the test finishes with EOK */
}
/* Test that searching for a nonexistant user yields ENOENT.
* Account callback will be called
*/
void test_nss_initgr_neg_upn(void **state)
{
test_initgr_neg_by_name("upninitgr_neg@upndomain.test", true);
}
static int nss_test_setup(void **state)
{
struct sss_test_conf_param params[] = {
{ "enumerate", "false" },
};
return 0;
}
static int nss_fqdn_test_setup(void **state)
{
struct sss_test_conf_param params[] = {
{ "enumerate", "false" },
{ "full_name_format", "%1$s@%2$s" },
};
return 0;
}
static int nss_test_setup_extra_attr(void **state)
{
struct sss_test_conf_param params[] = {
{ "enumerate", "false" },
};
return 0;
}
static int nss_subdom_test_setup(void **state)
{
struct sss_domain_info *subdomain;
false, false, NULL, 0);
false, false, NULL, 0);
return 0;
}
static int nss_fqdn_fancy_test_setup(void **state)
{
struct sss_test_conf_param params[] = {
{ "enumerate", "false" },
{ "full_name_format", "%1$s@@@@@%2$s" },
};
return 0;
}
static int nss_test_teardown(void **state)
{
return 0;
}
{
const char *name;
return EOK;
}
static void test_nss_getnamebysid(void **state)
{
struct sysdb_attrs *attrs;
char *user_sid;
/* Prime the cache with a valid user */
"testsiduser", 12345, 6890, "test sid user",
attrs, 300, 0);
/* Query for that user, call a callback when command finishes */
/* Should go straight to back end, without contacting DP */
/* Wait until the test finishes with EOK */
}
/* Test that searching for a nonexistant user yields ENOENT.
* Account callback will be called
*/
void test_nss_getnamebysid_neg(void **state)
{
char *user_sid;
/* Wait until the test finishes with ENOENT */
/* Test that subsequent search for a nonexistent user yields
* ENOENT and Account callback is not called, on the other hand
* the ncache functions will be called
*/
/* Wait until the test finishes with ENOENT */
/* Negative cache was hit this time */
}
{
const char *name;
return EOK;
}
static int test_nss_getnamebysid_update_acct_cb(void *pvt)
{
123456, 789, "test user",
return EOK;
}
void test_nss_getnamebysid_update(void **state)
{
struct ldb_result *res;
struct sysdb_attrs *attrs;
const char *shell;
char *user_sid;
/* Prime the cache with a valid but expired user */
"testsidbyname_update", 123456, 789, "test user",
/* Mock client input */
/* Mock client command */
/* Call this function when user is updated by the mock DP request */
/* Call this function to check what the responder returned to the client */
/* Mock output buffer */
/* Fire the command */
/* Wait until the test finishes with EOK */
/* Check the user was updated in the cache */
"testsidbyname_update", &res);
}
{
int rv;
int no_cleanup = 0;
int opt;
struct poptOption long_options[] = {
_("Do not delete the test database after a test run"), NULL },
};
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 */
if (rv == 0 && !no_cleanup) {
}
return rv;
}