On (20/04/16 08:41), Petr Cech wrote: >On 04/19/2016 01:55 PM, Petr Cech wrote: >> Hi, >> >> I found a strange condition in the function sss_ncache_check_str(). >> >> This condition causes the cache is NOT checked and the result of >> checking is automatically EEXIST. >> >> I dind't find call of sss_ncache_check_str() with ttl = -1, except in >> tests. >> It looks like I didn't remember it correctly an you were right. and it does not make a sense to have two values (0,-1) for special purpose.
>> Note: We use value 0 for permanent cache, no -1. >> > >Hello, > >I added one another little patch to this, so there is patch set. > >Regards > >-- >Petr^4 Čech >From 9b8a7a4ca917134db82fb0f8992ab933a72ebd1e Mon Sep 17 00:00:00 2001 >From: Petr Cech <[email protected]> >Date: Tue, 19 Apr 2016 13:20:25 -0400 >Subject: [PATCH 1/2] NEGCACHE: Fixing typo in test_sss_ncache_gid() > >There were sss_ncache_*_uid() functions instead of >sss_ncache_*_gid() functions. > >Resolves: >https://fedorahosted.org/sssd/ticket/2928 >--- > src/tests/cmocka/test_negcache.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/src/tests/cmocka/test_negcache.c >b/src/tests/cmocka/test_negcache.c >index >274e1543cc842bbb6b125423a76cf665354cc059..b3118abdc76c38539d725e7924b3905638438005 > 100644 >--- a/src/tests/cmocka/test_negcache.c >+++ b/src/tests/cmocka/test_negcache.c >@@ -265,10 +265,10 @@ static void test_sss_ncache_gid(void **state) > assert_int_equal(ret, EEXIST); > > permanent = false; >- ret = sss_ncache_set_uid(ts->ctx, permanent, NULL, gid); >+ ret = sss_ncache_set_gid(ts->ctx, permanent, NULL, gid); > assert_int_equal(ret, EOK); > >- ret = sss_ncache_check_uid(ts->ctx, ttl, NULL, gid); >+ ret = sss_ncache_check_gid(ts->ctx, ttl, NULL, gid); > assert_int_equal(ret, EEXIST); ACK >From cd5b2217d22f1da7d64cf81e67ac31f823d40e06 Mon Sep 17 00:00:00 2001 >From: Petr Cech <[email protected]> >Date: Tue, 19 Apr 2016 07:35:26 -0400 >Subject: [PATCH 2/2] 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. > >Resolves: >https://fedorahosted.org/sssd/ticket/2928 >--- > src/responder/common/negcache.c | 6 ------ > src/tests/cmocka/test_negcache.c | 46 ---------------------------------------- > 2 files changed, 52 deletions(-) > >diff --git a/src/responder/common/negcache.c b/src/responder/common/negcache.c >index >5b0517ceba85d6e35515a935423412314c218143..1617bf8c5cf7d36e7091a000f6473d1bcfe44f3f > 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; >- } >- ACK http://sssd-ci.duckdns.org/logs/job/42/50/summary.html LS _______________________________________________ sssd-devel mailing list [email protected] https://lists.fedorahosted.org/admin/lists/[email protected]
