summaryrefslogtreecommitdiff
path: root/source3/libads/sasl.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-05-25 20:55:40 +1000
committerGünther Deschner <gd@samba.org>2010-05-31 15:11:27 +0200
commitd6fa371b92681a327a86239721fc5990d91ad74f (patch)
tree4f2cdef8f42b544a05237670bab6b0a5cca56f99 /source3/libads/sasl.c
parentebae21f0235b957c8faeeb51c926724909d353e9 (diff)
downloadsamba-d6fa371b92681a327a86239721fc5990d91ad74f.tar.gz
samba-d6fa371b92681a327a86239721fc5990d91ad74f.tar.bz2
samba-d6fa371b92681a327a86239721fc5990d91ad74f.zip
s3:ntlmssp Use a TALLOC_CTX for ntlmssp_sign_packet() and ntlmssp_seal_packet()
This ensures the results can't be easily left to leak. Andrew Bartlett Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3/libads/sasl.c')
-rw-r--r--source3/libads/sasl.c6
1 files changed, 5 insertions, 1 deletions
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;