Bug 986379 - sss_cache -N/-n should invalidate the hash table in sssd_nss
sss_cache -N/-n should invalidate the hash table in sssd_nss
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: sssd (Show other bugs)
6.4
All Linux
medium Severity medium
: rc
: ---
Assigned To: Jakub Hrozek
Kaushik Banerjee
:
Depends On: 896558
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-19 11:46 EDT by Najmuddin Chirammal
Modified: 2014-06-18 03:09 EDT (History)
8 users (show)

See Also:
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 17:21:02 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Najmuddin Chirammal 2013-07-19 11:46:34 EDT
+++ 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 05:58:14 EDT
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 18:42:23 EDT
Fixed upstream.
Comment 4 Nirupama Karandikar 2013-09-26 03:32:39 EDT
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 05:59:40 EDT
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 06:17:13 EDT
Hi Jakub,

Yup, after fixing the testcase its passing now.

Thanks,
Niru
Comment 7 Nirupama Karandikar 2013-10-07 05:49:04 EDT
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 17:21:02 EST
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

Note You need to log in before you can comment on or make changes to this bug.