[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Tue Jan 18 09:27:01 MST 2011


The branch, master has been updated
       via  93733e4 s4:tls_tstream: also use a dynamic buffer for the pull side
       via  361b4ed s4:tls_tstream: fix partial reads, so that the gnutls layer doesn't read the same data twice
      from  f6077f2 s4-tests: Added a test for correct inheritance of IO flagged ACEs.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 93733e4e316dc7f80bbc002778914b9dc09fe6d7
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 14 15:24:22 2010 +0100

    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 at samba.org>
    Autobuild-Date: Tue Jan 18 17:26:08 CET 2011 on sn-devel-104

commit 361b4ed016a06717682e4071aa499a52b6c29dda
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 14 15:00:15 2010 +0100

    s4:tls_tstream: fix partial reads, so that the gnutls layer doesn't read the same data twice
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source4/lib/tls/tls_tstream.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/lib/tls/tls_tstream.c b/source4/lib/tls/tls_tstream.c
index e113757..c64b2ea 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;
@@ -305,14 +306,20 @@ static ssize_t tstream_tls_pull_function(gnutls_transport_ptr ptr,
 	}
 
 	if (tlss->pull.iov.iov_base) {
+		uint8_t *b;
 		size_t n;
 
+		b = (uint8_t *)tlss->pull.iov.iov_base;
+
 		n = MIN(tlss->pull.iov.iov_len, size);
-		memcpy(buf, tlss->pull.iov.iov_base, n);
+		memcpy(buf, b, n);
 
 		tlss->pull.iov.iov_len -= n;
+		b += n;
+		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;
@@ -322,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,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list