summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPetr Cech <pcech@redhat.com>2016-04-19 07:35:26 -0400
committerLukas Slebodnik <lslebodn@redhat.com>2016-04-20 20:07:21 +0200
commit85a9d31cb955fa2d6c6ec45b4bf04b00118829fb (patch)
tree5d6a8a22cf1aabbd9c9f03656266f36d71934649 /src
parentee4be57409e157af0a57228605ef8e07f6d4fa1b (diff)
downloadsssd-85a9d31cb955fa2d6c6ec45b4bf04b00118829fb.tar.gz
sssd-85a9d31cb955fa2d6c6ec45b4bf04b00118829fb.tar.xz
sssd-85a9d31cb955fa2d6c6ec45b4bf04b00118829fb.zip
NEGCACHE: Removing of condition for ttl = -1
If ttl = -1 then function sss_ncache_check_str() returns EEXIST without checking negcache. This behaviour is out of logic. We use ttl = 0 for permanent caching. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/responder/common/negcache.c6
-rw-r--r--src/tests/cmocka/test_negcache.c46
2 files changed, 0 insertions, 52 deletions
diff --git a/src/responder/common/negcache.c b/src/responder/common/negcache.c
index 5b0517ceb..1617bf8c5 100644
--- a/src/responder/common/negcache.c
+++ b/src/responder/common/negcache.c
@@ -97,12 +97,6 @@ static int sss_ncache_check_str(struct sss_nc_ctx *ctx, char *str, int ttl)
goto done;
}
- if (ttl == -1) {
- /* a negative ttl means: never expires */
- ret = EEXIST;
- goto done;
- }
-
errno = 0;
timestamp = strtoull((const char *)data.dptr, &ep, 10);
if (errno != 0 || *ep != '\0') {
diff --git a/src/tests/cmocka/test_negcache.c b/src/tests/cmocka/test_negcache.c
index b3118abdc..45dcd43c8 100644
--- a/src/tests/cmocka/test_negcache.c
+++ b/src/tests/cmocka/test_negcache.c
@@ -230,11 +230,6 @@ static void test_sss_ncache_uid(void **state)
ret = sss_ncache_set_uid(ts->ctx, permanent, NULL, uid);
assert_int_equal(ret, EOK);
-
- /* test when ttl is -1 with uid present in database*/
- ttl = -1;
- ret = sss_ncache_check_uid(ts->ctx, ttl, NULL, uid);
- assert_int_equal(ret, EEXIST);
}
/* @test_sss_ncache_gid : test following functions
@@ -270,11 +265,6 @@ static void test_sss_ncache_gid(void **state)
ret = sss_ncache_check_gid(ts->ctx, ttl, NULL, gid);
assert_int_equal(ret, EEXIST);
-
- /* test when ttl is -1 with gid present in database*/
- ttl = -1;
- ret = sss_ncache_check_gid(ts->ctx, ttl, NULL, gid);
- assert_int_equal(ret, EEXIST);
}
@@ -311,11 +301,6 @@ static void test_sss_ncache_sid(void **state)
ret = sss_ncache_check_sid(ts->ctx, ttl, sid);
assert_int_equal(ret, EEXIST);
-
- /* test when ttl is -1 with sid present in database*/
- ttl = -1;
- ret = sss_ncache_check_sid(ts->ctx, ttl, sid);
- assert_int_equal(ret, EEXIST);
}
/* @test_sss_ncache_cert : test following functions
@@ -351,11 +336,6 @@ static void test_sss_ncache_cert(void **state)
ret = sss_ncache_check_cert(ts->ctx, ttl, cert);
assert_int_equal(ret, EEXIST);
-
- /* test when ttl is -1 with cert present in database*/
- ttl = -1;
- ret = sss_ncache_check_cert(ts->ctx, ttl, cert);
- assert_int_equal(ret, EEXIST);
}
/* @test_sss_ncache_user : test following functions
@@ -398,11 +378,6 @@ static void test_sss_ncache_user(void **state)
ret = sss_ncache_check_user(ts->ctx, ttl, dom, name);
assert_int_equal(ret, EEXIST);
-
- /* test when ttl is -1 with domain name present in database */
- ttl = -1;
- ret = sss_ncache_check_user(ts->ctx, ttl, dom, name);
- assert_int_equal(ret, EEXIST);
}
/* @test_sss_ncache_group : test following functions
@@ -445,11 +420,6 @@ static void test_sss_ncache_group(void **state)
ret = sss_ncache_check_group(ts->ctx, ttl, dom, name);
assert_int_equal(ret, EEXIST);
-
- /* test when ttl is -1 with domain name present in database */
- ttl = -1;
- ret = sss_ncache_check_group(ts->ctx, ttl, dom, name);
- assert_int_equal(ret, EEXIST);
}
/* @test_sss_ncache_netgr : test following functions
@@ -492,11 +462,6 @@ static void test_sss_ncache_netgr(void **state)
ret = sss_ncache_check_netgr(ts->ctx, ttl, dom, name);
assert_int_equal(ret, EEXIST);
-
- /* test when ttl is -1 with domain name present in database */
- ttl = -1;
- ret = sss_ncache_check_netgr(ts->ctx, ttl, dom, name);
- assert_int_equal(ret, EEXIST);
}
/* @test_sss_ncache_service_name : test following functions
@@ -539,11 +504,6 @@ static void test_sss_ncache_service_name(void **state)
ret = sss_ncache_check_service(ts->ctx, ttl, dom, name, PROTO);
assert_int_equal(ret, EEXIST);
-
- /* test when ttl is -1 with domain name present in database */
- ttl = -1;
- ret = sss_ncache_check_service(ts->ctx, ttl, dom, name, PROTO);
- assert_int_equal(ret, EEXIST);
}
/* @test_sss_ncache_service_port : test following functions
@@ -591,12 +551,6 @@ static void test_sss_ncache_service_port(void **state)
ret = sss_ncache_check_service_port(ts->ctx, ttl, dom, (uint16_t)PORT,
PROTO);
assert_int_equal(ret, EEXIST);
-
- /* test when ttl is -1 with domain name present in database */
- ttl = -1;
- ret = sss_ncache_check_service_port(ts->ctx, ttl, dom, (uint16_t)PORT,
- PROTO);
- assert_int_equal(ret, EEXIST);
}