summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authortodd stecher <todd.stecher@gmail.com>2009-01-19 15:09:51 -0800
committerSteven Danneman <steven.danneman@isilon.com>2009-01-21 17:13:03 -0800
commit989ad44d32c2e77972a966d91f1813b0b929f83b (patch)
treebb7a41c961fe974f464f7ce2a27ca3bf055187bf /source3/winbindd
parente9615b43b4dc7037da7bc274d720b8e54c7f85bc (diff)
downloadsamba-989ad44d32c2e77972a966d91f1813b0b929f83b.tar.gz
samba-989ad44d32c2e77972a966d91f1813b0b929f83b.tar.bz2
samba-989ad44d32c2e77972a966d91f1813b0b929f83b.zip
Memory leaks and other fixes found by Coverity
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/winbindd_group.c8
-rw-r--r--source3/winbindd/winbindd_user.c8
-rw-r--r--source3/winbindd/winbindd_util.c12
-rw-r--r--source3/winbindd/winbindd_wins.c10
4 files changed, 32 insertions, 6 deletions
diff --git a/source3/winbindd/winbindd_group.c b/source3/winbindd/winbindd_group.c
index 7432bda451..bc532bbce7 100644
--- a/source3/winbindd/winbindd_group.c
+++ b/source3/winbindd/winbindd_group.c
@@ -991,7 +991,13 @@ static void getgrgid_recv(void *private_data, bool success, const char *sid)
DEBUG(10,("getgrgid_recv: gid %lu has sid %s\n",
(unsigned long)(state->request.data.gid), sid));
- string_to_sid(&group_sid, sid);
+ if (!string_to_sid(&group_sid, sid)) {
+ DEBUG(1,("getgrgid_recv: Could not convert sid %s "
+ "from string\n", sid));
+ request_error(state);
+ return;
+ }
+
winbindd_getgrsid(state, group_sid);
return;
}
diff --git a/source3/winbindd/winbindd_user.c b/source3/winbindd/winbindd_user.c
index fd1fdd3699..5356e16a74 100644
--- a/source3/winbindd/winbindd_user.c
+++ b/source3/winbindd/winbindd_user.c
@@ -527,7 +527,13 @@ static void getpwuid_recv(void *private_data, bool success, const char *sid)
DEBUG(10,("uid2sid_recv: uid %lu has sid %s\n",
(unsigned long)(state->request.data.uid), sid));
- string_to_sid(&user_sid, sid);
+ if (!string_to_sid(&user_sid, sid)) {
+ DEBUG(1,("uid2sid_recv: Could not convert sid %s "
+ "from string\n,", sid));
+ request_error(state);
+ return;
+ }
+
winbindd_getpwsid(state, &user_sid);
}
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c
index 748099a32e..2d87015fec 100644
--- a/source3/winbindd/winbindd_util.c
+++ b/source3/winbindd/winbindd_util.c
@@ -682,8 +682,16 @@ static void init_child_recv(void *private_data, bool success)
state->response->data.domain_info.name);
fstrcpy(state->domain->alt_name,
state->response->data.domain_info.alt_name);
- string_to_sid(&state->domain->sid,
- state->response->data.domain_info.sid);
+ if (!string_to_sid(&state->domain->sid,
+ state->response->data.domain_info.sid)) {
+ DEBUG(1,("init_child_recv: Could not convert sid %s "
+ "from string\n",
+ state->response->data.domain_info.sid));
+ state->continuation(state->private_data, False);
+ talloc_destroy(state->mem_ctx);
+ return;
+ }
+
state->domain->native_mode =
state->response->data.domain_info.native_mode;
state->domain->active_directory =
diff --git a/source3/winbindd/winbindd_wins.c b/source3/winbindd/winbindd_wins.c
index 4a3d2682b6..f9ba13ffda 100644
--- a/source3/winbindd/winbindd_wins.c
+++ b/source3/winbindd/winbindd_wins.c
@@ -46,9 +46,15 @@ static int wins_lookup_open_socket_in(void)
if (res == -1)
return -1;
- setsockopt(res,SOL_SOCKET,SO_REUSEADDR,(char *)&val,sizeof(val));
+ if (setsockopt(res,SOL_SOCKET,SO_REUSEADDR,(char *)&val,sizeof(val))) {
+ close(res);
+ return -1;
+ }
#ifdef SO_REUSEPORT
- setsockopt(res,SOL_SOCKET,SO_REUSEPORT,(char *)&val,sizeof(val));
+ if (setsockopt(res,SOL_SOCKET,SO_REUSEPORT,(char *)&val,sizeof(val))) {
+ close(res);
+ return -1;
+ }
#endif /* SO_REUSEPORT */
/* now we've got a socket - we need to bind it */