svn commit: samba r20097 - in branches: SAMBA_3_0/source/smbd
SAMBA_3_0_24/source/smbd
jra at samba.org
jra at samba.org
Sat Dec 9 23:55:23 GMT 2006
Author: jra
Date: 2006-12-09 23:55:20 +0000 (Sat, 09 Dec 2006)
New Revision: 20097
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20097
Log:
Ensure found_username is freed correctly when
talloced on the null context.
Jeremy.
Modified:
branches/SAMBA_3_0/source/smbd/service.c
branches/SAMBA_3_0_24/source/smbd/service.c
Changeset:
Modified: branches/SAMBA_3_0/source/smbd/service.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/service.c 2006-12-09 15:30:15 UTC (rev 20096)
+++ branches/SAMBA_3_0/source/smbd/service.c 2006-12-09 23:55:20 UTC (rev 20097)
@@ -643,7 +643,8 @@
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 @@
&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 @@
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 @@
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 @@
&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"));
Modified: branches/SAMBA_3_0_24/source/smbd/service.c
===================================================================
--- branches/SAMBA_3_0_24/source/smbd/service.c 2006-12-09 15:30:15 UTC (rev 20096)
+++ branches/SAMBA_3_0_24/source/smbd/service.c 2006-12-09 23:55:20 UTC (rev 20097)
@@ -549,7 +549,8 @@
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) {
@@ -564,6 +565,7 @@
&found_username,
&conn->nt_user_token);
if (!NT_STATUS_IS_OK(status2)) {
+ TALLOC_FREE(found_username);
conn_free(conn);
*status = status2;
return NULL;
@@ -571,6 +573,7 @@
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) {
@@ -603,7 +606,7 @@
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));
@@ -621,12 +624,14 @@
&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"));
More information about the samba-cvs
mailing list