summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/responder/nss/nsssrv_mmap_cache.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/responder/nss/nsssrv_mmap_cache.c b/src/responder/nss/nsssrv_mmap_cache.c
index a352abf3d..a9ce8aa5d 100644
--- a/src/responder/nss/nsssrv_mmap_cache.c
+++ b/src/responder/nss/nsssrv_mmap_cache.c
@@ -356,6 +356,11 @@ static errno_t sss_mmap_cache_invalidate(struct sss_mc_ctx *mcc,
{
struct sss_mc_rec *rec;
+ if (mcc == NULL) {
+ /* cache not initialized ? */
+ return EINVAL;
+ }
+
rec = sss_mc_find_record(mcc, key);
if (rec == NULL) {
/* nothing to invalidate */
@@ -388,6 +393,11 @@ errno_t sss_mmap_cache_pw_store(struct sss_mc_ctx *mcc,
size_t pos;
int ret;
+ if (mcc == NULL) {
+ /* cache not initialized ? */
+ return EINVAL;
+ }
+
ret = snprintf(uidstr, 11, "%ld", (long)uid);
if (ret > 10) {
return EINVAL;
@@ -457,6 +467,11 @@ errno_t sss_mmap_cache_pw_invalidate_uid(struct sss_mc_ctx *mcc, uid_t uid)
char *uidstr;
errno_t ret;
+ if (mcc == NULL) {
+ /* cache not initialized ? */
+ return EINVAL;
+ }
+
uidstr = talloc_asprintf(NULL, "%ld", (long)uid);
if (!uidstr) {
return ENOMEM;
@@ -514,6 +529,11 @@ int sss_mmap_cache_gr_store(struct sss_mc_ctx *mcc,
size_t pos;
int ret;
+ if (mcc == NULL) {
+ /* cache not initialized ? */
+ return EINVAL;
+ }
+
ret = snprintf(gidstr, 11, "%ld", (long)gid);
if (ret > 10) {
return EINVAL;
@@ -579,6 +599,11 @@ errno_t sss_mmap_cache_gr_invalidate_gid(struct sss_mc_ctx *mcc, gid_t gid)
char *gidstr;
errno_t ret;
+ if (mcc == NULL) {
+ /* cache not initialized ? */
+ return EINVAL;
+ }
+
gidstr = talloc_asprintf(NULL, "%ld", (long)gid);
if (!gidstr) {
return ENOMEM;