summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2013-01-12 22:32:24 +0000
committerArthur de Jong <arthur@arthurdejong.org>2013-01-12 22:32:24 +0000
commit388821aaf7ed45acdc47f7b1514bd76509bee627 (patch)
tree417d5f66096b78c868213586e65cefacfef6241f
parentcdae94613211057f57dec49e2f7e0afb9733951f (diff)
check result of set_tolist() to ensure that memory allocation problems are logged
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1911 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r--nslcd/cfg.c5
-rw-r--r--nslcd/group.c7
-rw-r--r--nslcd/passwd.c7
-rw-r--r--nslcd/shadow.c7
4 files changed, 23 insertions, 3 deletions
diff --git a/nslcd/cfg.c b/nslcd/cfg.c
index 0004092..c3af9d3 100644
--- a/nslcd/cfg.c
+++ b/nslcd/cfg.c
@@ -851,6 +851,11 @@ static void parse_pam_authz_search_statement(
/* check the variables used in the expression */
set = expr_vars(cfg->pam_authz_searches[i], NULL);
list = set_tolist(set);
+ if (list == NULL)
+ {
+ log_log(LOG_CRIT, "malloc() failed to allocate memory");
+ exit(EXIT_FAILURE);
+ }
for (i = 0; list[i] != NULL; i++)
{
if ((strcmp(list[i], "username") != 0) &&
diff --git a/nslcd/group.c b/nslcd/group.c
index 491d051..868110c 100644
--- a/nslcd/group.c
+++ b/nslcd/group.c
@@ -5,7 +5,7 @@
Copyright (C) 1997-2006 Luke Howard
Copyright (C) 2006 West Consulting
- Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Arthur de Jong
+ Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -160,6 +160,11 @@ void group_init(void)
attmap_add_attributes(set, attmap_group_gidNumber);
attmap_add_attributes(set, attmap_group_member);
group_attrs = set_tolist(set);
+ if (group_attrs == NULL)
+ {
+ log_log(LOG_CRIT, "malloc() failed to allocate memory");
+ exit(EXIT_FAILURE);
+ }
set_free(set);
}
diff --git a/nslcd/passwd.c b/nslcd/passwd.c
index 85641ad..8883be8 100644
--- a/nslcd/passwd.c
+++ b/nslcd/passwd.c
@@ -5,7 +5,7 @@
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2006 West Consulting
- Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Arthur de Jong
+ Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -147,6 +147,11 @@ void passwd_init(void)
attmap_add_attributes(set, attmap_passwd_homeDirectory);
attmap_add_attributes(set, attmap_passwd_loginShell);
passwd_attrs = set_tolist(set);
+ if (passwd_attrs == NULL)
+ {
+ log_log(LOG_CRIT, "malloc() failed to allocate memory");
+ exit(EXIT_FAILURE);
+ }
set_free(set);
}
diff --git a/nslcd/shadow.c b/nslcd/shadow.c
index d940054..9a4f928 100644
--- a/nslcd/shadow.c
+++ b/nslcd/shadow.c
@@ -5,7 +5,7 @@
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2006 West Consulting
- Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Arthur de Jong
+ Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -104,6 +104,11 @@ void shadow_init(void)
attmap_add_attributes(set, attmap_shadow_shadowExpire);
attmap_add_attributes(set, attmap_shadow_shadowFlag);
shadow_attrs = set_tolist(set);
+ if (shadow_attrs == NULL)
+ {
+ log_log(LOG_CRIT, "malloc() failed to allocate memory");
+ exit(EXIT_FAILURE);
+ }
set_free(set);
}