summaryrefslogtreecommitdiff
path: root/source4/auth
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-10-19 17:12:35 +1100
committerAndrew Bartlett <abartlet@samba.org>2010-10-19 08:37:45 +0000
commit73d6bb74476561ef0140d21810541825c44b44a4 (patch)
treee9c7d68f82f74d735c10eefdd7b2b9eb043a6d64 /source4/auth
parent15a3077885227cc5e81e331979713c27192a01ef (diff)
downloadsamba-73d6bb74476561ef0140d21810541825c44b44a4.tar.gz
samba-73d6bb74476561ef0140d21810541825c44b44a4.tar.bz2
samba-73d6bb74476561ef0140d21810541825c44b44a4.zip
s4-gensec Don't give more to sasl_encode() than it will permit
We need to ask the library how much data to pass in at any time. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Tue Oct 19 08:37:45 UTC 2010 on sn-devel-104
Diffstat (limited to 'source4/auth')
-rw-r--r--source4/auth/gensec/cyrus_sasl.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source4/auth/gensec/cyrus_sasl.c b/source4/auth/gensec/cyrus_sasl.c
index c95bae91fe..e05a3b8222 100644
--- a/source4/auth/gensec/cyrus_sasl.c
+++ b/source4/auth/gensec/cyrus_sasl.c
@@ -263,10 +263,17 @@ static NTSTATUS gensec_sasl_wrap_packets(struct gensec_security *gensec_security
struct gensec_sasl_state);
const char *out_data;
unsigned int out_len;
+ unsigned len_permitted;
+ int sasl_ret = sasl_getprop(gensec_sasl_state->conn, SASL_SSF,
+ (const void**)&len_permitted);
+ if (sasl_ret != SASL_OK) {
+ return sasl_nt_status(sasl_ret);
+ }
+ len_permitted = MIN(len_permitted, in->length);
- int sasl_ret = sasl_encode(gensec_sasl_state->conn,
- (char*)in->data, in->length, &out_data,
- &out_len);
+ sasl_ret = sasl_encode(gensec_sasl_state->conn,
+ (char*)in->data, len_permitted, &out_data,
+ &out_len);
if (sasl_ret == SASL_OK) {
*out = data_blob_talloc(out_mem_ctx, out_data, out_len);
*len_processed = in->length;