#include "librpc/rpc/dcerpc.h"
#include "lib/param/param.h"
-NTSTATUS auth_generic_prepare(const struct tsocket_address *remote_address,
+NTSTATUS auth_generic_prepare(TALLOC_CTX *mem_ctx,
+ const struct tsocket_address *remote_address,
struct auth_generic_state **auth_ntlmssp_state)
{
struct auth_context *auth_context;
struct auth_generic_state *ans;
NTSTATUS nt_status;
- ans = talloc_zero(NULL, struct auth_generic_state);
+ ans = talloc_zero(mem_ctx, struct auth_generic_state);
if (!ans) {
DEBUG(0,("auth_ntlmssp_start: talloc failed!\n"));
return NT_STATUS_NO_MEMORY;
/* The following definitions come from auth/auth_ntlmssp.c */
-NTSTATUS auth_generic_prepare(const struct tsocket_address *remote_address,
+NTSTATUS auth_generic_prepare(TALLOC_CTX *mem_ctx, const struct tsocket_address *remote_address,
struct auth_generic_state **auth_ntlmssp_state);
NTSTATUS auth_generic_start(struct auth_generic_state *auth_ntlmssp_state, const char *oid);
NTSTATUS auth_generic_authtype_start(struct auth_generic_state *auth_ntlmssp_state,
struct auth_generic_state *a = NULL;
NTSTATUS status;
- status = auth_generic_prepare(remote_address, &a);
+ status = auth_generic_prepare(talloc_tos(), remote_address, &a);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, (__location__ ": auth_generic_prepare failed: %s\n",
nt_errstr(status)));
struct auth_generic_state *a = NULL;
NTSTATUS status;
- status = auth_generic_prepare(remote_address, &a);
+ status = auth_generic_prepare(talloc_tos(), remote_address, &a);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, (__location__ ": auth_generic_prepare failed: %s\n",
nt_errstr(status)));
sconn->use_gensec_hook = false;
/* See if we can get an SPNEGO blob out of the gensec hook (if auth_samba4 is loaded) */
- status = auth_generic_prepare(sconn->remote_address,
+ status = auth_generic_prepare(talloc_tos(),
+ sconn->remote_address,
&auth_ntlmssp_state);
if (NT_STATUS_IS_OK(status)) {
status = auth_generic_start(auth_ntlmssp_state, GENSEC_OID_SPNEGO);
struct smb_trans_enc_state *es)
{
struct auth_generic_state *auth_ntlmssp_state;
- NTSTATUS status = auth_generic_prepare(remote_address,
+ NTSTATUS status = auth_generic_prepare(NULL, remote_address,
&auth_ntlmssp_state);
if (!NT_STATUS_IS_OK(status)) {
return nt_status_squash(status);
return;
}
- status = auth_generic_prepare(sconn->remote_address,
+ status = auth_generic_prepare(NULL, sconn->remote_address,
auth_ntlmssp_state);
if (!NT_STATUS_IS_OK(status)) {
/* Kill the intermediate vuid */
data_blob_free(&secblob);
if (!*auth_ntlmssp_state) {
- status = auth_generic_prepare(sconn->remote_address,
+ status = auth_generic_prepare(NULL, sconn->remote_address,
auth_ntlmssp_state);
if (!NT_STATUS_IS_OK(status)) {
/* Kill the intermediate vuid */
DATA_BLOB chal;
if (!vuser->auth_ntlmssp_state) {
- status = auth_generic_prepare(sconn->remote_address,
+ status = auth_generic_prepare(vuser, sconn->remote_address,
&vuser->auth_ntlmssp_state);
if (!NT_STATUS_IS_OK(status)) {
/* Kill the intermediate vuid */
status = NT_STATUS_MORE_PROCESSING_REQUIRED;
} else {
/* Fall back to NTLMSSP. */
- status = auth_generic_prepare(session->sconn->remote_address,
+ status = auth_generic_prepare(session, session->sconn->remote_address,
&session->auth_ntlmssp_state);
if (!NT_STATUS_IS_OK(status)) {
goto out;
if (!NT_STATUS_IS_OK(status) &&
!NT_STATUS_EQUAL(status,
NT_STATUS_MORE_PROCESSING_REQUIRED)) {
- TALLOC_FREE(session->auth_ntlmssp_state);
TALLOC_FREE(session);
}
return status;
session->compat_vuser = talloc_zero(session, user_struct);
if (session->compat_vuser == NULL) {
- TALLOC_FREE(session->auth_ntlmssp_state);
TALLOC_FREE(session);
return NT_STATUS_NO_MEMORY;
}
DEBUG(1, ("smb2: Failed to claim session "
"for vuid=%d\n",
session->compat_vuser->vuid));
- TALLOC_FREE(session->auth_ntlmssp_state);
TALLOC_FREE(session);
return NT_STATUS_LOGON_FAILURE;
}
}
if (session->auth_ntlmssp_state == NULL) {
- status = auth_generic_prepare(session->sconn->remote_address,
+ status = auth_generic_prepare(session, session->sconn->remote_address,
&session->auth_ntlmssp_state);
if (!NT_STATUS_IS_OK(status)) {
data_blob_free(&auth);
if (!NT_STATUS_IS_OK(status) &&
!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
- TALLOC_FREE(session->auth_ntlmssp_state);
data_blob_free(&auth);
TALLOC_FREE(session);
return status;
&auth_out, status, NULL);
if (out_security_buffer->data == NULL) {
- TALLOC_FREE(session->auth_ntlmssp_state);
TALLOC_FREE(session);
return NT_STATUS_NO_MEMORY;
}
*out_security_buffer = data_blob_null;
if (session->auth_ntlmssp_state == NULL) {
- status = auth_generic_prepare(session->sconn->remote_address,
+ status = auth_generic_prepare(session, session->sconn->remote_address,
&session->auth_ntlmssp_state);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(session);
&session->session_info);
if (!NT_STATUS_IS_OK(status)) {
- TALLOC_FREE(session->auth_ntlmssp_state);
TALLOC_FREE(session);
return status;
}
/* Unknown packet type. */
DEBUG(1,("Unknown packet type %u in smb2 sessionsetup\n",
(unsigned int)in_security_buffer.data[0] ));
- TALLOC_FREE(session->auth_ntlmssp_state);
TALLOC_FREE(session);
return NT_STATUS_LOGON_FAILURE;
}