nsssrv_mmap_cache.h revision 0e6c9d03cacf24de4265ee0f902c216ba5a131c9
2454dfa32c93c20a8522c6ed42fe057baaac9f9aStephan Bosch/*
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen SSSD
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen NSS Responder - Mmap Cache
b87761f9bbef949f31dae297e619ac3f5e9c2b2eTimo Sirainen
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen Copyright (C) Simo Sorce <ssorce@redhat.com> 2011
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen
e8434aad92ea6ff1c915b708294dbd0c7ff5908dMichael M Slusarz This program is free software; you can redistribute it and/or modify
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen it under the terms of the GNU General Public License as published by
de5f478d9e7ae7b8e58082e0b30b6ce1f034236aTimo Sirainen the Free Software Foundation; either version 3 of the License, or
ba4626cd5be3d225a7a89aa338d92b8fb411fd1cTimo Sirainen (at your option) any later version.
f7d018e7e0980044e3d537958126e44ef4c45056Timo Sirainen
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen This program is distributed in the hope that it will be useful,
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen but WITHOUT ANY WARRANTY; without even the implied warranty of
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ba4626cd5be3d225a7a89aa338d92b8fb411fd1cTimo Sirainen GNU General Public License for more details.
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen You should have received a copy of the GNU General Public License
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen along with this program. If not, see <http://www.gnu.org/licenses/>.
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen*/
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen#ifndef _NSSSRV_MMAP_CACHE_H_
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen#define _NSSSRV_MMAP_CACHE_H_
1128c114416bdc4df0b41d3e15429a1522e5cfe4Timo Sirainen
1128c114416bdc4df0b41d3e15429a1522e5cfe4Timo Sirainen#define SSS_MC_CACHE_ELEMENTS 50000
1128c114416bdc4df0b41d3e15429a1522e5cfe4Timo Sirainen
1128c114416bdc4df0b41d3e15429a1522e5cfe4Timo Sirainenstruct sss_mc_ctx;
8952d797eca36f997ec36569e783871b597a9216Timo Sirainen
8952d797eca36f997ec36569e783871b597a9216Timo Sirainenenum sss_mc_type {
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen SSS_MC_NONE = 0,
b772ddf3cfb606dddaa465b317a0dc01bf06c6e4Timo Sirainen SSS_MC_PASSWD,
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen SSS_MC_GROUP,
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen};
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainenerrno_t sss_mmap_cache_init(TALLOC_CTX *mem_ctx, const char *name,
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen enum sss_mc_type type, size_t n_elem,
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen time_t valid_time, struct sss_mc_ctx **mcc);
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainenerrno_t sss_mmap_cache_pw_store(struct sss_mc_ctx **_mcc,
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen struct sized_string *name,
01aca4a521410be85e1f39e37c662435d052f48aAki Tuomi struct sized_string *pw,
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen uid_t uid, gid_t gid,
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen struct sized_string *gecos,
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen struct sized_string *homedir,
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen struct sized_string *shell);
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainenerrno_t sss_mmap_cache_gr_store(struct sss_mc_ctx **_mcc,
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen struct sized_string *name,
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen struct sized_string *pw,
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen gid_t gid, size_t memnum,
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen char *membuf, size_t memsize);
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainenerrno_t sss_mmap_cache_pw_invalidate(struct sss_mc_ctx *mcc,
01aca4a521410be85e1f39e37c662435d052f48aAki Tuomi struct sized_string *name);
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainen
f9cf9852b0338910f1a710297374943d66fea480Timo Sirainenerrno_t sss_mmap_cache_pw_invalidate_uid(struct sss_mc_ctx *mcc, uid_t uid);
4db61af2cfe2b206113bcc4b6153521679702bb4Timo Sirainen
4db61af2cfe2b206113bcc4b6153521679702bb4Timo Sirainenerrno_t sss_mmap_cache_gr_invalidate(struct sss_mc_ctx *mcc,
dd3d20d9b5821077164183a260af9bde0db3ff3fTimo Sirainen struct sized_string *name);
4db61af2cfe2b206113bcc4b6153521679702bb4Timo Sirainen
8a6afcd8a6d9ed69626add85a7b75105ee3cb6a1Timo Sirainenerrno_t sss_mmap_cache_gr_invalidate_gid(struct sss_mc_ctx *mcc, gid_t gid);
8a6afcd8a6d9ed69626add85a7b75105ee3cb6a1Timo Sirainen
8a6afcd8a6d9ed69626add85a7b75105ee3cb6a1Timo Sirainenerrno_t sss_mmap_cache_reinit(TALLOC_CTX *mem_ctx, size_t n_elem,
4db61af2cfe2b206113bcc4b6153521679702bb4Timo Sirainen time_t timeout, struct sss_mc_ctx **mc_ctx);
1128c114416bdc4df0b41d3e15429a1522e5cfe4Timo Sirainen
1128c114416bdc4df0b41d3e15429a1522e5cfe4Timo Sirainen#endif /* _NSSSRV_MMAP_CACHE_H_ */
8a6afcd8a6d9ed69626add85a7b75105ee3cb6a1Timo Sirainen