Bug 986379

Summary: sss_cache -N/-n should invalidate the hash table in sssd_nss
Product: Red Hat Enterprise Linux 6 Reporter: Najmuddin Chirammal <nc>
Component: sssdAssignee: Jakub Hrozek <jhrozek>
Status: CLOSED ERRATA QA Contact: Kaushik Banerjee <kbanerje>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: dpal, grajaiya, jgalipea, lslebodn, mkosek, nkarandi, pbrezina, yjog
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sssd-1.9.2-97.el6 Doc Type: Bug Fix
Doc Text:
Cause: sss_cache -N did not invalidate SSSD in-memory cache of netgroups. Consequence: Netgroups that were recently queried were not refreshed before their expiration time, even when sss_cache -N was executed. Fix: sss_cache -N invalidates also SSSD netgroups in-memory cache. Result: sss_cache -N invalidates all netgroups.
Story Points: ---
Clone Of: 896558 Environment:
Last Closed: 2013-11-21 22:21:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 896558    
Bug Blocks:    

Description Najmuddin Chirammal 2013-07-19 15:46:34 UTC
+++ This bug was initially created as a clone of Bug #896558 +++

This bug is created as a clone of upstream ticket:
https://fedorahosted.org/sssd/ticket/1759

sss_cache only invalidates the ldb records, but not the in-memory cache that holds the netgroup record. We need to fix that otherwise sssd returns non-logical results:

getent netgroup netgr
 -> shows netgroup, expected
(remove netgroup from LDAP)
sss_cache -N
getent netgroup netgr
 -> still shows the netgroup, should not

Comment 1 Jakub Hrozek 2013-07-26 09:58:14 UTC
A little explanation on why some special casing is needed:

For various reasons (speed, concurrent access, peculiarities of the netgroups GLIBC API), there is yet another caching layer in the NSS responder in a form of hash table. This hash table predates the fast memcache added in 6.4. Currently, all that sss_cache does is invalidate the cache on disk, but it doesn't invalidate entries in the hash table. That's the purpose of this fix.

Comment 2 Jakub Hrozek 2013-08-07 22:42:23 UTC
Fixed upstream.

Comment 4 Nirupama Karandikar 2013-09-26 07:32:39 UTC
with sssd-1.9.2-127.el6.x86_64

[root@dhcp207-156 ~]# getent netgroup netgrp 
netgrp                (machine2.example.com, ,  example.com) (machine1.example.com, ,  example.com)

Removed netgroup from DS.

[root@dhcp207-156 ~]# sss_cache -N
[root@dhcp207-156 ~]# getent netgroup netgrp 
netgrp               
          
[root@dhcp207-156 ~]# echo $?
0

For non-existing netgroup.

[root@dhcp207-156 ~]# getent netgroup ttt 
[root@dhcp207-156 ~]# echo $?
2

Comment 5 Jakub Hrozek 2013-10-03 09:59:40 UTC
Niru, according to Pavel's investigation, you actually hit another bug planned for 6.6 during your testing. Pavel amended the test and it should pass now. Is it the case?

Comment 6 Nirupama Karandikar 2013-10-03 10:17:13 UTC
Hi Jakub,

Yup, after fixing the testcase its passing now.

Thanks,
Niru

Comment 7 Nirupama Karandikar 2013-10-07 09:49:04 UTC
From beaker automation output :

--------------------------------------------------------------------
adding new entry "cn=netgrp,ou=Netgroups,dc=example,dc=com"
Stopping sssd: [  OK  ]
Starting sssd: [  OK  ]
[  OK  ]
netgrp               
:: [   PASS   ] :: Running 'getent netgroup netgrp | grep netgrp' (Expected 0, got 0)
ldap_initialize( ldap://kvm-guest-03.rhts.eng.bos.redhat.com )
deleting entry "cn=netgrp,ou=Netgroups,dc=example,dc=com"
:: [   PASS   ] :: Running 'getent netgroup netgrp' (Expected 2, got 2)
----------------------------------------------------------------------

Comment 8 errata-xmlrpc 2013-11-21 22:21:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1680.html