From 5ad7665b6377768d3710b00b25aeb530131924cc Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 14 Jan 2012 15:30:34 +1100 Subject: libcli/smb: Convert struct smb_trans_enc_state to talloc Signed-off-by: Stefan Metzmacher --- libcli/smb/smbXcli_base.c | 4 ++-- libcli/smb/smb_seal.c | 19 ------------------- libcli/smb/smb_seal.h | 1 - 3 files changed, 2 insertions(+), 22 deletions(-) (limited to 'libcli/smb') diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index 06fcb34a31..df0145718e 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -214,7 +214,7 @@ static int smbXcli_conn_destructor(struct smbXcli_conn *conn) } if (conn->smb1.trans_enc) { - common_free_encryption_state(&conn->smb1.trans_enc); + TALLOC_FREE(conn->smb1.trans_enc); } return 0; @@ -596,7 +596,7 @@ void smb1cli_conn_set_encryption(struct smbXcli_conn *conn, { /* Replace the old state, if any. */ if (conn->smb1.trans_enc) { - common_free_encryption_state(&conn->smb1.trans_enc); + TALLOC_FREE(conn->smb1.trans_enc); } conn->smb1.trans_enc = es; } diff --git a/libcli/smb/smb_seal.c b/libcli/smb/smb_seal.c index a56dc6092e..d5bb2388bb 100644 --- a/libcli/smb/smb_seal.c +++ b/libcli/smb/smb_seal.c @@ -199,25 +199,6 @@ NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf) return common_gensec_decrypt_buffer(es->gensec_security, buf); } -/****************************************************************************** - Shutdown an encryption state. -******************************************************************************/ - -void common_free_encryption_state(struct smb_trans_enc_state **pp_es) -{ - struct smb_trans_enc_state *es = *pp_es; - - if (es == NULL) { - return; - } - - if (es->gensec_security) { - TALLOC_FREE(es->gensec_security); - } - SAFE_FREE(es); - *pp_es = NULL; -} - /****************************************************************************** Free an encryption-allocated buffer. ******************************************************************************/ diff --git a/libcli/smb/smb_seal.h b/libcli/smb/smb_seal.h index 01a61e8586..f47f904528 100644 --- a/libcli/smb/smb_seal.h +++ b/libcli/smb/smb_seal.h @@ -32,7 +32,6 @@ NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16_t *p_enc_ctx_num); bool common_encryption_on(struct smb_trans_enc_state *es); NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out); NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf); -void common_free_encryption_state(struct smb_trans_enc_state **pp_es); void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf); #endif /* _HEADER_SMB_CRYPT_H */ -- cgit