summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-12-09 23:55:20 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:24 -0500
commitaf0f14e3a72756dfaff36e0106ae0f7eaac06633 (patch)
treeeb4d62d1fd769a1d9afb910dbde0fb26957d03dd /source3/smbd
parent63609fbb04d2ce620338b4b79e7c1abf39f08ef8 (diff)
downloadsamba-af0f14e3a72756dfaff36e0106ae0f7eaac06633.tar.gz
samba-af0f14e3a72756dfaff36e0106ae0f7eaac06633.tar.bz2
samba-af0f14e3a72756dfaff36e0106ae0f7eaac06633.zip
r20097: Ensure found_username is freed correctly when
talloced on the null context. Jeremy. (This used to be commit 2c59c4dddceb9cb12848d7ee48257c5e93ea2667)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/service.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 62d85cfdd9..08370b1c80 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -643,7 +643,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
if (lp_guest_only(snum)) {
const char *guestname = lp_guestaccount();
NTSTATUS status2;
- char *found_username;
+ char *found_username = NULL;
+
guest = True;
pass = getpwnam_alloc(NULL, guestname);
if (!pass) {
@@ -658,6 +659,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
&found_username,
&conn->nt_user_token);
if (!NT_STATUS_IS_OK(status2)) {
+ TALLOC_FREE(found_username);
conn_free(conn);
*status = status2;
return NULL;
@@ -665,6 +667,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
fstrcpy(user, found_username);
string_set(&conn->user,user);
conn->force_user = True;
+ TALLOC_FREE(found_username);
TALLOC_FREE(pass);
DEBUG(3,("Guest only user %s\n",user));
} else if (vuser) {
@@ -697,7 +700,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
guest = vuser->guest;
} else if (lp_security() == SEC_SHARE) {
NTSTATUS status2;
- char *found_username;
+ char *found_username = NULL;
/* add it as a possible user name if we
are in share mode security */
add_session_user(lp_servicename(snum));
@@ -715,12 +718,14 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
&found_username,
&conn->nt_user_token);
if (!NT_STATUS_IS_OK(status2)) {
+ TALLOC_FREE(found_username);
conn_free(conn);
*status = status2;
return NULL;
}
fstrcpy(user, found_username);
string_set(&conn->user,user);
+ TALLOC_FREE(found_username);
conn->force_user = True;
} else {
DEBUG(0, ("invalid VUID (vuser) but not in security=share\n"));