summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2010-07-16 17:30:14 -0400
committerAndrew Bartlett <abartlet@samba.org>2010-07-19 14:19:47 +1000
commitcdcdaaa6dd61475b8c0f37ce140a77271175cc9d (patch)
tree29980a85b199666e2ab72507bd7822e02790fde9
parent27aece72004a84a6e0b2e00987d8a362e307d1d8 (diff)
downloadsamba-cdcdaaa6dd61475b8c0f37ce140a77271175cc9d.tar.gz
samba-cdcdaaa6dd61475b8c0f37ce140a77271175cc9d.tar.bz2
samba-cdcdaaa6dd61475b8c0f37ce140a77271175cc9d.zip
s3-ntlmssp: Remove ntlmssp_end and let the talloc hierarchy handle it.
All the members are children of ntlmssp_state anyway. Signed-off-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--source3/auth/auth_ntlmssp.c2
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/libads/sasl.c14
-rw-r--r--source3/libsmb/cliconnect.c6
-rw-r--r--source3/libsmb/ntlmssp.c17
-rw-r--r--source3/libsmb/smb_seal.c2
-rw-r--r--source3/rpc_client/cli_pipe.c2
-rw-r--r--source3/utils/ntlm_auth.c34
-rw-r--r--source3/winbindd/winbindd_ccache_access.c2
9 files changed, 31 insertions, 49 deletions
diff --git a/source3/auth/auth_ntlmssp.c b/source3/auth/auth_ntlmssp.c
index ba7efbf48e..d343eef5ff 100644
--- a/source3/auth/auth_ntlmssp.c
+++ b/source3/auth/auth_ntlmssp.c
@@ -327,7 +327,7 @@ void auth_ntlmssp_end(struct auth_ntlmssp_state **auth_ntlmssp_state)
mem_ctx = (*auth_ntlmssp_state)->mem_ctx;
if ((*auth_ntlmssp_state)->ntlmssp_state) {
- ntlmssp_end(&(*auth_ntlmssp_state)->ntlmssp_state);
+ TALLOC_FREE((*auth_ntlmssp_state)->ntlmssp_state);
}
if ((*auth_ntlmssp_state)->auth_context) {
((*auth_ntlmssp_state)->auth_context->free)(&(*auth_ntlmssp_state)->auth_context);
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 9471f63195..1cf9621182 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -3102,7 +3102,6 @@ void ntlmssp_want_feature_list(struct ntlmssp_state *ntlmssp_state, char *featur
void ntlmssp_want_feature(struct ntlmssp_state *ntlmssp_state, uint32_t feature);
NTSTATUS ntlmssp_update(struct ntlmssp_state *ntlmssp_state,
const DATA_BLOB in, DATA_BLOB *out) ;
-void ntlmssp_end(struct ntlmssp_state **ntlmssp_state);
DATA_BLOB ntlmssp_weaken_keys(struct ntlmssp_state *ntlmssp_state, TALLOC_CTX *mem_ctx);
NTSTATUS ntlmssp_server_start(TALLOC_CTX *mem_ctx,
bool is_standalone,
diff --git a/source3/libads/sasl.c b/source3/libads/sasl.c
index 04b9a71d76..a37d1e8474 100644
--- a/source3/libads/sasl.c
+++ b/source3/libads/sasl.c
@@ -106,7 +106,7 @@ static void ads_sasl_ntlmssp_disconnect(ADS_STRUCT *ads)
struct ntlmssp_state *ntlmssp_state =
(struct ntlmssp_state *)ads->ldap.wrap_private_data;
- ntlmssp_end(&ntlmssp_state);
+ TALLOC_FREE(ntlmssp_state);
ads->ldap.wrap_ops = NULL;
ads->ldap.wrap_private_data = NULL;
@@ -209,7 +209,7 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads)
ber_bvfree(scred);
}
- ntlmssp_end(&ntlmssp_state);
+ TALLOC_FREE(ntlmssp_state);
return ADS_ERROR(rc);
}
if (scred) {
@@ -221,7 +221,7 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads)
} else {
- ntlmssp_end(&ntlmssp_state);
+ TALLOC_FREE(ntlmssp_state);
data_blob_free(&blob_out);
return ADS_ERROR_NT(nt_status);
}
@@ -233,7 +233,7 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads)
if (!spnego_parse_challenge(blob, &blob_in,
&tmp_blob)) {
- ntlmssp_end(&ntlmssp_state);
+ TALLOC_FREE(ntlmssp_state);
data_blob_free(&blob);
DEBUG(3,("Failed to parse challenges\n"));
return ADS_ERROR_NT(NT_STATUS_INVALID_PARAMETER);
@@ -243,7 +243,7 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads)
if (!spnego_parse_auth_response(blob, nt_status, OID_NTLMSSP,
&blob_in)) {
- ntlmssp_end(&ntlmssp_state);
+ TALLOC_FREE(ntlmssp_state);
data_blob_free(&blob);
DEBUG(3,("Failed to parse auth response\n"));
return ADS_ERROR_NT(NT_STATUS_INVALID_PARAMETER);
@@ -266,11 +266,11 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads)
if (!ADS_ERR_OK(status)) {
DEBUG(0, ("ads_setup_sasl_wrapping() failed: %s\n",
ads_errstr(status)));
- ntlmssp_end(&ntlmssp_state);
+ TALLOC_FREE(ntlmssp_state);
return status;
}
} else {
- ntlmssp_end(&ntlmssp_state);
+ TALLOC_FREE(ntlmssp_state);
}
return ADS_ERROR(rc);
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 06a6f7e683..8d4c1901c1 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -969,7 +969,7 @@ static int cli_session_setup_ntlmssp_state_destructor(
struct cli_session_setup_ntlmssp_state *state)
{
if (state->ntlmssp_state != NULL) {
- ntlmssp_end(&state->ntlmssp_state);
+ TALLOC_FREE(state->ntlmssp_state);
}
return 0;
}
@@ -1079,7 +1079,7 @@ static void cli_session_setup_ntlmssp_done(struct tevent_req *subreq)
return;
}
TALLOC_FREE(subreq);
- ntlmssp_end(&state->ntlmssp_state);
+ TALLOC_FREE(state->ntlmssp_state);
tevent_req_done(req);
return;
}
@@ -1122,7 +1122,7 @@ static void cli_session_setup_ntlmssp_done(struct tevent_req *subreq)
if (!NT_STATUS_IS_OK(status)
&& !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
TALLOC_FREE(subreq);
- ntlmssp_end(&state->ntlmssp_state);
+ TALLOC_FREE(state->ntlmssp_state);
tevent_req_nterror(req, status);
return;
}
diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c
index 228d19536e..a0dc39be3e 100644
--- a/source3/libsmb/ntlmssp.c
+++ b/source3/libsmb/ntlmssp.c
@@ -275,23 +275,6 @@ NTSTATUS ntlmssp_update(struct ntlmssp_state *ntlmssp_state,
}
/**
- * End an NTLMSSP state machine
- *
- * @param ntlmssp_state NTLMSSP State, free()ed by this function
- */
-
-void ntlmssp_end(struct ntlmssp_state **ntlmssp_state)
-{
- data_blob_free(&(*ntlmssp_state)->chal);
- data_blob_free(&(*ntlmssp_state)->lm_resp);
- data_blob_free(&(*ntlmssp_state)->nt_resp);
- TALLOC_FREE(*ntlmssp_state);
-
- *ntlmssp_state = NULL;
- return;
-}
-
-/**
* Determine correct target name flags for reply, given server role
* and negotiated flags
*
diff --git a/source3/libsmb/smb_seal.c b/source3/libsmb/smb_seal.c
index 92d7fef651..4610850638 100644
--- a/source3/libsmb/smb_seal.c
+++ b/source3/libsmb/smb_seal.c
@@ -371,7 +371,7 @@ void common_free_encryption_state(struct smb_trans_enc_state **pp_es)
if (es->smb_enc_type == SMB_TRANS_ENC_NTLM) {
if (es->s.ntlmssp_state) {
- ntlmssp_end(&es->s.ntlmssp_state);
+ TALLOC_FREE(es->s.ntlmssp_state);
}
}
#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index a61200a104..8dd9386eab 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -2704,7 +2704,7 @@ NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx,
static int cli_auth_ntlmssp_data_destructor(struct cli_pipe_auth_data *auth)
{
- ntlmssp_end(&auth->a_u.ntlmssp_state);
+ TALLOC_FREE(auth->a_u.ntlmssp_state);
return 0;
}
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index e7887cca71..bfdc369b15 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -656,7 +656,7 @@ static NTSTATUS ntlm_auth_start_ntlmssp_client(struct ntlmssp_state **client_ntl
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Could not start NTLMSSP client: %s\n",
nt_errstr(status)));
- ntlmssp_end(client_ntlmssp_state);
+ TALLOC_FREE(*client_ntlmssp_state);
return status;
}
@@ -665,7 +665,7 @@ static NTSTATUS ntlm_auth_start_ntlmssp_client(struct ntlmssp_state **client_ntl
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Could not set username: %s\n",
nt_errstr(status)));
- ntlmssp_end(client_ntlmssp_state);
+ TALLOC_FREE(*client_ntlmssp_state);
return status;
}
@@ -674,7 +674,7 @@ static NTSTATUS ntlm_auth_start_ntlmssp_client(struct ntlmssp_state **client_ntl
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Could not set domain: %s\n",
nt_errstr(status)));
- ntlmssp_end(client_ntlmssp_state);
+ TALLOC_FREE(*client_ntlmssp_state);
return status;
}
@@ -684,7 +684,7 @@ static NTSTATUS ntlm_auth_start_ntlmssp_client(struct ntlmssp_state **client_ntl
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Could not set password: %s\n",
nt_errstr(status)));
- ntlmssp_end(client_ntlmssp_state);
+ TALLOC_FREE(*client_ntlmssp_state);
return status;
}
}
@@ -854,7 +854,7 @@ static void manage_squid_ntlmssp_request(struct ntlm_auth_state *state,
if (strncmp(buf, "YR", 2) == 0) {
if (state->ntlmssp_state)
- ntlmssp_end(&state->ntlmssp_state);
+ TALLOC_FREE(state->ntlmssp_state);
state->svr_state = SERVER_INITIAL;
} else if (strncmp(buf, "KK", 2) == 0) {
/* No special preprocessing required */
@@ -916,7 +916,7 @@ static void manage_squid_ntlmssp_request(struct ntlm_auth_state *state,
x_fprintf(x_stdout, "BH %s\n", nt_errstr(nt_status));
DEBUG(0, ("NTLMSSP BH: %s\n", nt_errstr(nt_status)));
- ntlmssp_end(&state->ntlmssp_state);
+ TALLOC_FREE(state->ntlmssp_state);
} else if (!NT_STATUS_IS_OK(nt_status)) {
x_fprintf(x_stdout, "NA %s\n", nt_errstr(nt_status));
DEBUG(10, ("NTLMSSP %s\n", nt_errstr(nt_status)));
@@ -1010,7 +1010,7 @@ static void manage_client_ntlmssp_request(struct ntlm_auth_state *state,
if (strncmp(buf, "YR", 2) == 0) {
if (state->ntlmssp_state)
- ntlmssp_end(&state->ntlmssp_state);
+ TALLOC_FREE(state->ntlmssp_state);
state->cli_state = CLIENT_INITIAL;
} else if (strncmp(buf, "TT", 2) == 0) {
/* No special preprocessing required */
@@ -1102,13 +1102,13 @@ static void manage_client_ntlmssp_request(struct ntlm_auth_state *state,
DEBUG(10, ("NTLMSSP OK!\n"));
state->cli_state = CLIENT_FINISHED;
if (state->ntlmssp_state)
- ntlmssp_end(&state->ntlmssp_state);
+ TALLOC_FREE(state->ntlmssp_state);
} else {
x_fprintf(x_stdout, "BH %s\n", nt_errstr(nt_status));
DEBUG(0, ("NTLMSSP BH: %s\n", nt_errstr(nt_status)));
state->cli_state = CLIENT_ERROR;
if (state->ntlmssp_state)
- ntlmssp_end(&state->ntlmssp_state);
+ TALLOC_FREE(state->ntlmssp_state);
}
data_blob_free(&request);
@@ -1223,7 +1223,7 @@ static void manage_gss_spnego_request(struct ntlm_auth_state *state,
if (strncmp(buf, "YR", 2) == 0) {
if (ntlmssp_state)
- ntlmssp_end(&ntlmssp_state);
+ TALLOC_FREE(ntlmssp_state);
} else if (strncmp(buf, "KK", 2) == 0) {
;
} else {
@@ -1288,7 +1288,7 @@ static void manage_gss_spnego_request(struct ntlm_auth_state *state,
x_fprintf(x_stdout, "BH Client wants a new "
"NTLMSSP challenge, but "
"already got one\n");
- ntlmssp_end(&ntlmssp_state);
+ TALLOC_FREE(ntlmssp_state);
return;
}
@@ -1394,7 +1394,7 @@ static void manage_gss_spnego_request(struct ntlm_auth_state *state,
if (NT_STATUS_IS_OK(status)) {
user = SMB_STRDUP(ntlmssp_state->user);
domain = SMB_STRDUP(ntlmssp_state->domain);
- ntlmssp_end(&ntlmssp_state);
+ TALLOC_FREE(ntlmssp_state);
}
}
@@ -1495,7 +1495,7 @@ static bool manage_client_ntlmssp_init(struct spnego_data spnego)
NT_STATUS_IS_OK(status)) ) {
DEBUG(1, ("Expected OK or MORE_PROCESSING_REQUIRED, got: %s\n",
nt_errstr(status)));
- ntlmssp_end(&client_ntlmssp_state);
+ TALLOC_FREE(client_ntlmssp_state);
return False;
}
@@ -1528,13 +1528,13 @@ static void manage_client_ntlmssp_targ(struct spnego_data spnego)
if (spnego.negTokenTarg.negResult == SPNEGO_REJECT) {
x_fprintf(x_stdout, "NA\n");
- ntlmssp_end(&client_ntlmssp_state);
+ TALLOC_FREE(client_ntlmssp_state);
return;
}
if (spnego.negTokenTarg.negResult == SPNEGO_ACCEPT_COMPLETED) {
x_fprintf(x_stdout, "AF\n");
- ntlmssp_end(&client_ntlmssp_state);
+ TALLOC_FREE(client_ntlmssp_state);
return;
}
@@ -1549,7 +1549,7 @@ static void manage_client_ntlmssp_targ(struct spnego_data spnego)
x_fprintf(x_stdout, "BH Expected MORE_PROCESSING_REQUIRED from "
"ntlmssp_client_update\n");
data_blob_free(&request);
- ntlmssp_end(&client_ntlmssp_state);
+ TALLOC_FREE(client_ntlmssp_state);
return;
}
@@ -1798,7 +1798,7 @@ static void manage_gss_spnego_client_request(struct ntlm_auth_state *state,
"negResult\n");
}
- ntlmssp_end(&client_ntlmssp_state);
+ TALLOC_FREE(client_ntlmssp_state);
goto out;
}
diff --git a/source3/winbindd/winbindd_ccache_access.c b/source3/winbindd/winbindd_ccache_access.c
index c5a760af05..6a265ccaf0 100644
--- a/source3/winbindd/winbindd_ccache_access.c
+++ b/source3/winbindd/winbindd_ccache_access.c
@@ -136,7 +136,7 @@ static NTSTATUS do_ntlm_auth_with_hashes(const char *username,
status = NT_STATUS_OK;
done:
- ntlmssp_end(&ntlmssp_state);
+ TALLOC_FREE(ntlmssp_state);
return status;
}