From d6fa371b92681a327a86239721fc5990d91ad74f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 25 May 2010 20:55:40 +1000 Subject: s3:ntlmssp Use a TALLOC_CTX for ntlmssp_sign_packet() and ntlmssp_seal_packet() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This ensures the results can't be easily left to leak. Andrew Bartlett Signed-off-by: Stefan Metzmacher Signed-off-by: Günther Deschner --- source3/libads/sasl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source3/libads/sasl.c') diff --git a/source3/libads/sasl.c b/source3/libads/sasl.c index 8f7f6c11df..04b9a71d76 100644 --- a/source3/libads/sasl.c +++ b/source3/libads/sasl.c @@ -30,19 +30,23 @@ static ADS_STATUS ads_sasl_ntlmssp_wrap(ADS_STRUCT *ads, uint8 *buf, uint32 len) ADS_STATUS status; NTSTATUS nt_status; DATA_BLOB sig; + TALLOC_CTX *frame; uint8 *dptr = ads->ldap.out.buf + (4 + NTLMSSP_SIG_SIZE); + frame = talloc_stackframe(); /* copy the data to the right location */ memcpy(dptr, buf, len); /* create the signature and may encrypt the data */ if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_SEAL) { nt_status = ntlmssp_seal_packet(ntlmssp_state, + frame, dptr, len, dptr, len, &sig); } else { nt_status = ntlmssp_sign_packet(ntlmssp_state, + frame, dptr, len, dptr, len, &sig); @@ -54,7 +58,7 @@ static ADS_STATUS ads_sasl_ntlmssp_wrap(ADS_STRUCT *ads, uint8 *buf, uint32 len) memcpy(ads->ldap.out.buf + 4, sig.data, NTLMSSP_SIG_SIZE); - data_blob_free(&sig); + TALLOC_FREE(frame); /* set how many bytes must be written to the underlying socket */ ads->ldap.out.left = 4 + NTLMSSP_SIG_SIZE + len; -- cgit