summaryrefslogtreecommitdiff
path: root/source3/auth
diff options
context:
space:
mode:
Diffstat (limited to 'source3/auth')
-rw-r--r--source3/auth/auth_util.c5
-rw-r--r--source3/auth/check_samsec.c7
-rw-r--r--source3/auth/server_info_sam.c2
3 files changed, 6 insertions, 8 deletions
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index d64cb537c7..854ab89f28 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -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;
diff --git a/source3/auth/check_samsec.c b/source3/auth/check_samsec.c
index db2bde7bbc..ef29df4d56 100644
--- a/source3/auth/check_samsec.c
+++ b/source3/auth/check_samsec.c
@@ -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)));
diff --git a/source3/auth/server_info_sam.c b/source3/auth/server_info_sam.c
index 4dd3156fe5..76f32159af 100644
--- a/source3/auth/server_info_sam.c
+++ b/source3/auth/server_info_sam.c
@@ -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;
}