summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2017-08-16 10:51:47 +0200
committerJakub Hrozek <jhrozek@redhat.com>2017-08-28 20:55:29 +0200
commitb4b3d0642120ca05f63959fe2f317a6b93031929 (patch)
tree0291057b48bcfe8f979ef569c520ad3c8651ab4c /src
parent3ad33ca77044f9a9d18f7def271b0beb180e567b (diff)
downloadsssd-b4b3d0642120ca05f63959fe2f317a6b93031929.tar.gz
sssd-b4b3d0642120ca05f63959fe2f317a6b93031929.tar.xz
sssd-b4b3d0642120ca05f63959fe2f317a6b93031929.zip
TEST_NEGCACHE: Ensure root's uid and gid are always added to ncache
In order to do so two new functions have been introduced and test_sss_ncache_prepopulate() has been modified in order to ensure that root's uid and gid are always added to the negative cache. Related: https://pagure.io/SSSD/sssd/issue/3460 Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/tests/cmocka/test_negcache.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tests/cmocka/test_negcache.c b/src/tests/cmocka/test_negcache.c
index 163e4653e..ba39f778d 100644
--- a/src/tests/cmocka/test_negcache.c
+++ b/src/tests/cmocka/test_negcache.c
@@ -564,6 +564,24 @@ static int check_group_in_ncache(struct sss_nc_ctx *ctx,
return ret;
}
+static int check_uid_in_ncache(struct sss_nc_ctx *ctx,
+ uid_t uid)
+{
+ int ret;
+
+ ret = sss_ncache_check_uid(ctx, NULL, uid);
+ return ret;
+}
+
+static int check_gid_in_ncache(struct sss_nc_ctx *ctx,
+ gid_t gid)
+{
+ int ret;
+
+ ret = sss_ncache_check_gid(ctx, NULL, gid);
+ return ret;
+}
+
static void test_sss_ncache_prepopulate(void **state)
{
int ret;
@@ -636,6 +654,12 @@ static void test_sss_ncache_prepopulate(void **state)
ret = check_group_in_ncache(ncache, dom, "root");
assert_int_equal(ret, EEXIST);
+
+ ret = check_uid_in_ncache(ncache, 0);
+ assert_int_equal(ret, EEXIST);
+
+ ret = check_gid_in_ncache(ncache, 0);
+ assert_int_equal(ret, EEXIST);
}
static void test_sss_ncache_default_domain_suffix(void **state)