summaryrefslogtreecommitdiff
path: root/src/responder/nss/nsssrv_mmap_cache.c
AgeCommit message (Collapse)AuthorFilesLines
2013-04-17Inform about function duplication.Michal Zidek1-0/+3
sss_mc_set_recycled is a static function, that should not be used outside nsssrv_mmap_cache.c. The sss_cache tool is an exception, because in the case when sssd is not running, sss_cache must invalidate the memory cache file. That is why sss_mc_set_recycled was copied to the tools_mc_util.c (as helper function for sss_memcache_invalidate function). It was duplicated to allow this function to remain static (and invisible to any .h files), so that it is not used anywhere else. Wrong usage of this function might cause race conditions and corrupt the cache. I'll add comments about the duplication to the code.
2013-03-07Debug message in sss_mc_create_file.Michal Zidek1-0/+5
This patch adds debug message for the case if sssd fails to open old mc file for some other reason than the file does not exist.
2013-03-07File descriptor leak in nss responder.Michal Zidek1-18/+43
File descriptors leaked every time sss_mmap_cache_reinit was called and also the old memory cache was still maped in memory (munmap was not called). This patch adds destructor for memory cache context to call close() and munmap() automaticly. https://fedorahosted.org/sssd/ticket/1826
2013-01-07memcache: add macro that validates record lengthPavel Březina1-2/+1
2012-12-20mmap cache: invalidate cache on fatal errorSimo Sorce1-6/+26
If a fatal EFAULT error is returned by the internal function that frees used memory invalidate the whole cache and reinit it. This way we avoid further corruption and insure clients see consistent data. Also insure we use the right context in init() and we use talloc_zfree() in reinit so that if the init() later fails we do not leave around a pointer to free memory in the callers.
2012-12-20Carefully check records when forcibly invalidatingSimo Sorce1-18/+101
We should never try to invalidate an already invalid record as internal pointers will not be consistent. Carefully test that the record really is valid when we are fishing for free space, and properly invalidate records or return a fatal error if something goes wrong. In order to make the code more robust always invalidate the whole data space on initialization by setting all bits to 1, and make sure to invalidate the whole last allocated slot by converting rec->len to the number of slots instead of just the space used.
2012-12-20Update free table when records are invalidated.Simo Sorce1-14/+23
We were holding up slots when entries were invalidated directly an not through our primitive garbage collection scheme.
2012-12-20nss_mc: Add extra checks when dereferencing recordsSimo Sorce1-0/+12
Although it should enver happen that we pass in an invalid hash it is always better to just not do anything than access memory ouf of the hash table. It can lead to segfaults, or worse referencing memory that should not be touched.
2012-12-14Allow mmap calls to gracefully return absent ctxSimo Sorce1-0/+25
This is to allow to freely call mc functions even if initialization failed. They will now gracefully fail instead of segfaulting.
2012-12-11NSS: Fix the error handler in sss_mc_create_fileJakub Hrozek1-10/+16
https://fedorahosted.org/sssd/ticket/1704 The function is short enough so that we can simply stick with return and release resources before returning as appropriate.
2012-12-05mmap cache: public functions to invalidate recordsSimo Sorce1-0/+125
These functions can be called from the nss responder to invalidate records that have ceased to exist or that need to be refreshed the first time an application needs them.
2012-11-10Add helpers to set common mc record fieldsSimo Sorce1-16/+26
Les copy/paste and chance of errors when setting basic record fields that are shared among all object types.
2012-11-06sss_cache: Remove fastcache even if sssd is not running.Michal Zidek1-3/+23
https://fedorahosted.org/sssd/ticket/1584
2012-09-24sss_cache tool invalidates records in memory cache.Michal Zidek1-0/+46
2012-06-10Allow fast memcache timeout to be configurableJan Zeleny1-2/+2
https://fedorahosted.org/sssd/ticket/1318
2012-04-20Convert read and write operations to sss_atomic_readJakub Hrozek1-10/+10
https://fedorahosted.org/sssd/ticket/1209
2012-03-20NSS: Fix debug messageStephen Gallagher1-0/+2
2012-03-19nsssrv: add handling of memory cache group mapSimo Sorce1-0/+70
2012-03-19nsssrv: add handling of memory cache passwd mapSimo Sorce1-0/+76
2012-03-19nsssrv: Add memory cache record handling utilsSimo Sorce1-0/+279
2012-03-19nsssrv: shared memory cache server initializationSimo Sorce1-0/+300