summaryrefslogtreecommitdiff
path: root/source4/lib/tls
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-12-14 15:24:22 +0100
committerStefan Metzmacher <metze@samba.org>2011-01-18 17:26:08 +0100
commit93733e4e316dc7f80bbc002778914b9dc09fe6d7 (patch)
tree56f8a083e08dc7695af1d224f5a58bd2f16b61e5 /source4/lib/tls
parent361b4ed016a06717682e4071aa499a52b6c29dda (diff)
downloadsamba-93733e4e316dc7f80bbc002778914b9dc09fe6d7.tar.gz
samba-93733e4e316dc7f80bbc002778914b9dc09fe6d7.tar.bz2
samba-93733e4e316dc7f80bbc002778914b9dc09fe6d7.zip
s4:tls_tstream: also use a dynamic buffer for the pull side
Maybe that fixes the remaining issues with some gnutls versions. metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Tue Jan 18 17:26:08 CET 2011 on sn-devel-104
Diffstat (limited to 'source4/lib/tls')
-rw-r--r--source4/lib/tls/tls_tstream.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source4/lib/tls/tls_tstream.c b/source4/lib/tls/tls_tstream.c
index 09fe5714eb..c64b2eaa49 100644
--- a/source4/lib/tls/tls_tstream.c
+++ b/source4/lib/tls/tls_tstream.c
@@ -58,7 +58,7 @@ struct tstream_tls {
} push;
struct {
- uint8_t buffer[1024];
+ uint8_t *buf;
struct iovec iov;
struct tevent_req *subreq;
} pull;
@@ -293,6 +293,7 @@ static ssize_t tstream_tls_pull_function(gnutls_transport_ptr ptr,
tstream_context_data(stream,
struct tstream_tls);
struct tevent_req *subreq;
+ size_t len;
if (tlss->error != 0) {
errno = tlss->error;
@@ -318,6 +319,7 @@ static ssize_t tstream_tls_pull_function(gnutls_transport_ptr ptr,
tlss->pull.iov.iov_base = (char *)b;
if (tlss->pull.iov.iov_len == 0) {
tlss->pull.iov.iov_base = NULL;
+ TALLOC_FREE(tlss->pull.buf);
}
return n;
@@ -327,8 +329,15 @@ static ssize_t tstream_tls_pull_function(gnutls_transport_ptr ptr,
return 0;
}
- tlss->pull.iov.iov_base = tlss->pull.buffer;
- tlss->pull.iov.iov_len = MIN(size, sizeof(tlss->pull.buffer));
+ len = MIN(size, UINT16_MAX);
+
+ tlss->pull.buf = talloc_array(tlss, uint8_t, len);
+ if (tlss->pull.buf == NULL) {
+ return -1;
+ }
+
+ tlss->pull.iov.iov_base = (char *)tlss->pull.buf;
+ tlss->pull.iov.iov_len = len;
subreq = tstream_readv_send(tlss,
tlss->current_ev,