1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s3:auth Free sampass as soon as we have server_info

We don't keep sampass in server_info anymore
So it makes no sense to keep it around.

Signed-off-by: Günther Deschner <gd@samba.org>
This commit is contained in:
Simo Sorce 2010-05-27 05:31:45 -04:00 committed by Günther Deschner
parent d9cffc01be
commit 606be25ecf
5 changed files with 8 additions and 8 deletions

View File

@ -733,6 +733,8 @@ static NTSTATUS make_new_server_info_guest(struct auth_serversupplied_info **ser
return status;
}
TALLOC_FREE(sampass);
(*server_info)->guest = True;
status = create_local_token(*server_info);
@ -747,7 +749,8 @@ static NTSTATUS make_new_server_info_guest(struct auth_serversupplied_info **ser
(*server_info)->user_session_key = data_blob(zeros, sizeof(zeros));
(*server_info)->lm_session_key = data_blob(zeros, sizeof(zeros));
alpha_strcpy(tmp, pdb_get_username(sampass), ". _-$", sizeof(tmp));
alpha_strcpy(tmp, (*server_info)->info3->base.account_name.string,
". _-$", sizeof(tmp));
(*server_info)->sanitized_username = talloc_strdup(*server_info, tmp);
return NT_STATUS_OK;

View File

@ -484,11 +484,8 @@ NTSTATUS check_sam_security(const DATA_BLOB *challenge,
become_root();
nt_status = make_server_info_sam(server_info, sampass);
unbecome_root();
/*
* sampass has been stolen to server_info.
* So NULL it out to prevent segfaults.
*/
sampass = NULL;
TALLOC_FREE(sampass);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0,("check_sam_security: make_server_info_sam() failed with '%s'\n", nt_errstr(nt_status)));

View File

@ -149,8 +149,6 @@ NTSTATUS make_server_info_sam(struct auth_serversupplied_info **server_info,
pdb_get_username(sampass), result->unix_name));
*server_info = result;
/* Ensure that the sampass will be freed with the result */
talloc_steal(result, sampass);
return NT_STATUS_OK;
}

View File

@ -504,6 +504,7 @@ static void reply_spnego_kerberos(struct smb_request *req,
DEBUG(10, ("found user %s in passdb, calling "
"make_server_info_sam\n", real_username));
ret = make_server_info_sam(&server_info, sampass);
TALLOC_FREE(sampass);
} else {
/*
* User not in passdb, make it up artificially

View File

@ -345,6 +345,7 @@ static NTSTATUS smbd_smb2_session_setup_krb5(struct smbd_smb2_session *session,
DEBUG(10, ("smb2: found user %s in passdb, calling "
"make_server_info_sam\n", real_username));
status = make_server_info_sam(&tmp_server_info, sampass);
TALLOC_FREE(sampass);
} else {
/*
* User not in passdb, make it up artificially