shadow/lib
Jakub Hrozek 4aaf05d72e Flush sssd caches in addition to nscd caches
Some distributions, notably Fedora, have the following order of nsswitch
modules by default:
    passwd: sss files
    group:  sss files

The advantage of serving local users through SSSD is that the nss_sss
module has a fast mmapped-cache that speeds up NSS lookups compared to
accessing the disk an opening the files on each NSS request.

Traditionally, this has been done with the help of nscd, but using nscd
in parallel with sssd is cumbersome, as both SSSD and nscd use their own
independent caching, so using nscd in setups where sssd is also serving
users from some remote domain (LDAP, AD, ...) can result in a bit of
unpredictability.

More details about why Fedora chose to use sss before files can be found
on e.g.:
    https://fedoraproject.org//wiki/Changes/SSSDCacheForLocalUsers
or:
    https://docs.pagure.org/SSSD.sssd/design_pages/files_provider.html

Now, even though sssd watches the passwd and group files with the help
of inotify, there can still be a small window where someone requests a
user or a group, finds that it doesn't exist, adds the entry and checks
again. Without some support in shadow-utils that would explicitly drop
the sssd caches, the inotify watch can fire a little late, so a
combination of commands like this:
    getent passwd user || useradd user; getent passwd user
can result in the second getent passwd not finding the newly added user
as the racy behaviour might still return the cached negative hit from
the first getent passwd.

This patch more or less copies the already existing support that
shadow-utils had for dropping nscd caches, except using the "sss_cache"
tool that sssd ships.
2018-09-13 14:20:02 +02:00
..
.indent.pro [svn-upgrade] Integrating new upstream version, shadow (4.0.8) 2007-10-07 11:46:07 +00:00
commonio.c Flush sssd caches in addition to nscd caches 2018-09-13 14:20:02 +02:00
commonio.h Update _COMMONIO_H and _SHADOWIO_H to drop leading underscore 2016-12-21 12:45:50 -06:00
defines.h spelling: categories 2017-10-22 08:08:07 +00:00
encrypt.c Review 52a38d5509 2013-08-04 00:27:53 +02:00
exitcodes.h * lib/exitcodes.h: Define E_SUCCESS as EXIT_SUCCESS. Added FIXMEs. 2009-04-30 21:08:49 +00:00
faillog.h Make sure every source files are distributed with a copyright and license. 2008-04-27 00:40:09 +00:00
fields.c * lib/fields.c: Fixed typo from 2010-02-15. field insteadof cp 2011-07-08 19:56:18 +00:00
fputsx.c * lib/fputsx.c: Compare the result of fgets() with the provided 2009-06-12 20:20:45 +00:00
get_gid.c * libmisc/getgr_nam_gid.c, lib/get_gid.c, lib/get_pid.c, 2009-04-30 21:12:33 +00:00
get_pid.c * libmisc/getgr_nam_gid.c, lib/get_gid.c, lib/get_pid.c, 2009-04-30 21:12:33 +00:00
get_uid.c * libmisc/getgr_nam_gid.c, lib/get_gid.c, lib/get_pid.c, 2009-04-30 21:12:33 +00:00
getdef.c add --prefix option 2017-03-01 22:51:09 +01:00
getdef.h add --prefix option 2017-03-01 22:51:09 +01:00
getlong.c * lib/getlong.c: Do not check for NULL string but empty string. 2009-04-24 23:27:12 +00:00
getulong.c Simplify getulong 2016-08-03 11:51:07 -05:00
groupio.c snprintf() always terminates output with \0 2016-11-15 16:05:44 +01:00
groupio.h * lib/commonio.c, lib/commonio.h, lib/groupio.c, lib/groupio.h, 2009-04-23 21:19:02 +00:00
groupmem.c Clear passwords on __gr_dup/__pw_dup errors. 2015-07-11 13:00:13 +02:00
gshadow_.h * lib/gshadow_.h: Fix typo in comment. 2011-08-14 13:16:54 +00:00
gshadow.c 2010-02-14 Michael Bunk <mb@computer-leipzig.com> 2010-03-10 22:30:03 +00:00
lockpw.c Make sure every source files are distributed with a copyright and license. 2008-04-27 00:40:09 +00:00
Makefile.am Flush sssd caches in addition to nscd caches 2018-09-13 14:20:02 +02:00
nscd.c 2012-02-13 Mike Frysinger <vapier@gentoo.org> 2012-02-13 20:09:59 +00:00
nscd.h * configure.in, lib/nscd.h, lib/nscd.c: Added --with-nscd flag to 2008-08-30 18:30:36 +00:00
pam_defs.h * README, NEWS, configure.in, lib/pam_defs.h, src/login.c: Add 2008-07-21 21:14:06 +00:00
port.c * libmisc/console.c, libmisc/hushed.c, libmisc/yesno.c, 2008-06-13 18:11:09 +00:00
port.h Make sure every source files are distributed with a copyright and license. 2008-04-27 00:40:09 +00:00
prototypes.h Merge remote-tracking branch 'upstream/master' 2018-03-28 21:11:36 +02:00
pwauth.c Review 52a38d5509 2013-08-04 00:27:53 +02:00
pwauth.h * libmisc/find_new_gid.c, libmisc/find_new_uid.c, 2009-04-23 17:43:27 +00:00
pwio.c Create dbs with correct permissions. 2015-02-27 17:01:31 +00:00
pwio.h * lib/commonio.c, lib/commonio.h, lib/groupio.c, lib/groupio.h, 2009-04-23 21:19:02 +00:00
pwmem.c Clear passwords on __gr_dup/__pw_dup errors. 2015-07-11 13:00:13 +02:00
selinux.c * lib/selinux.c, lib/semanage.c: prototypes.h was not included. 2012-01-08 16:06:57 +00:00
semanage.c * lib/selinux.c, lib/semanage.c: prototypes.h was not included. 2012-01-08 16:06:57 +00:00
sgetgrent.c * lib/sgetpwent.c, lib/sgetgrent.c: Use get_uid and get_gid to 2009-03-21 20:29:58 +00:00
sgetpwent.c Remove unused variable. 2009-03-21 20:45:35 +00:00
sgetspent.c * lib/sgetspent.c: Only compile ifndef HAVE_SGETSPENT 2009-04-10 22:35:07 +00:00
sgroupio.c include getdef.h for getdef_bool prototype 2016-12-05 17:15:29 -05:00
sgroupio.h * lib/sgroupio.h: Harmonize splint annotations of sgr_locate() 2009-09-07 18:59:03 +00:00
shadow.c * lib/utent.c (getutline): Remove getutline(). This function is 2010-03-23 08:56:52 +00:00
shadowio.c include getdef.h for getdef_bool prototype 2016-12-05 17:15:29 -05:00
shadowio.h Update _COMMONIO_H and _SHADOWIO_H to drop leading underscore 2016-12-21 12:45:50 -06:00
shadowmem.c Add splint annotations. 2013-08-13 19:13:45 +02:00
spawn.c * lib/prototypes.h, libmisc/cleanup.c, lib/spawn.c, src/chage.c: 2011-10-18 20:23:33 +00:00
sssd.c Flush sssd caches in addition to nscd caches 2018-09-13 14:20:02 +02:00
sssd.h Flush sssd caches in addition to nscd caches 2018-09-13 14:20:02 +02:00
subordinateio.c spelling: success 2017-10-22 21:23:13 +00:00
subordinateio.h Remove dead code. 2013-08-15 17:30:19 +02:00
tcbfuncs.c Reverse comparison for consistency. 2010-03-18 18:58:52 +00:00
tcbfuncs.h * lib/tcbfuncs.h: Re-indent. 2010-03-18 19:23:00 +00:00
utent.c * lib/utent.c (getutline): Remove getutline(). This function is 2010-03-23 08:56:52 +00:00