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) {
&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);
conn->force_user = True;
+ TALLOC_FREE(found_username);
TALLOC_FREE(pass);
DEBUG(3,("Guest only user %s\n",user));
} else if (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));
&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"));