summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-08-18 19:43:28 +0000
committerJeremy Allison <jra@samba.org>2001-08-18 19:43:28 +0000
commitec70b76395a099c1d3070e3df2f571ebd2d84e37 (patch)
tree151d61f0888debaba2314cfffda69a6d505a8152
parent556c8f3fbfd060ff865bb6854393018cc9e86828 (diff)
downloadsamba-ec70b76395a099c1d3070e3df2f571ebd2d84e37.tar.gz
samba-ec70b76395a099c1d3070e3df2f571ebd2d84e37.tar.bz2
samba-ec70b76395a099c1d3070e3df2f571ebd2d84e37.zip
More Realloc fixes.
Jeremy. (This used to be commit 381c02e6389dbb41fa66a854d7293594fd4bd0a6)
-rw-r--r--source3/nsswitch/winbindd_user.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/source3/nsswitch/winbindd_user.c b/source3/nsswitch/winbindd_user.c
index 804d3deebb..8bc9ef5a85 100644
--- a/source3/nsswitch/winbindd_user.c
+++ b/source3/nsswitch/winbindd_user.c
@@ -414,10 +414,20 @@ static BOOL get_sam_user_entries(struct getent_state *ent)
&num_entries, &ctr);
if (num_entries) {
- name_list = Realloc(name_list,
+ struct getpwent_user *tnl;
+
+ tnl = (struct getpwent_user *)Realloc(name_list,
sizeof(struct getpwent_user) *
(ent->num_sam_entries +
num_entries));
+
+ if (!tnl) {
+ DEBUG(0,("get_sam_user_entries: Realloc failed.\n"));
+ if (name_list)
+ free(name_list);
+ return WINBINDD_ERROR;
+ } else
+ name_list = tnl;
}
for (i = 0; i < num_entries; i++) {
@@ -590,20 +600,20 @@ enum winbindd_result winbindd_getpwent(struct winbindd_cli_state *state)
enum winbindd_result winbindd_list_users(struct winbindd_cli_state *state)
{
- struct winbindd_domain *domain;
- SAM_DISPINFO_CTR ctr;
+ struct winbindd_domain *domain;
+ SAM_DISPINFO_CTR ctr;
SAM_DISPINFO_1 info1;
- uint32 num_entries = 0, total_entries = 0;
+ uint32 num_entries = 0, total_entries = 0;
char *ted, *extra_data = NULL;
int extra_data_len = 0;
DEBUG(3, ("[%5d]: list users\n", state->pid));
- /* Enumerate over trusted domains */
+ /* Enumerate over trusted domains */
ctr.sam.info1 = &info1;
- for (domain = domain_list; domain; domain = domain->next) {
+ for (domain = domain_list; domain; domain = domain->next) {
uint32 status, start_ndx = 0;
/* Skip domains other than WINBINDD_DOMAIN environment
@@ -618,7 +628,7 @@ enum winbindd_result winbindd_list_users(struct winbindd_cli_state *state)
continue;
}
- /* Query display info */
+ /* Query display info */
do {
int i;