[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Sat Dec 4 04:56:02 MST 2010


The branch, master has been updated
       via  929063b lib/torture: add torture_assert_u64_equal_goto()
       via  69ad3f7 tls_tstream: use a dynamic buffer for the push case
       via  a42ccab tls_tstream: increase the buffer size
      from  14d3027 s4:samr RPC server - dcesrv_samr_GetBootKeyInformation - return NOT_SUPPORTED

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


- Log -----------------------------------------------------------------
commit 929063bb126b45cfe175a0e9518905bfcc8c95a2
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Nov 22 12:38:41 2010 +0100

    lib/torture: add torture_assert_u64_equal_goto()
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Sat Dec  4 12:55:44 CET 2010 on sn-devel-104

commit 69ad3f7f90273cb62f67331982a40aa99ea05d90
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Nov 29 12:27:11 2010 +0100

    tls_tstream: use a dynamic buffer for the push case
    
    Some versions of gnutls doesn't handle EAGAIN correctly,
    so we better allow sending buffers without a low size limitation,
    the limit is now UINT16_MAX (0xFFFF) and we allocate the buffer
    with talloc each time.
    
    metze

commit a42ccab929766702029f624f5cc18bc034889c29
Author: Matthieu Patou <mat at matws.net>
Date:   Thu Nov 18 10:35:06 2010 +0300

    tls_tstream: increase the buffer size
    
    The problem is that with certain version of gnutls are not working
    properly if the server is sending in different packet things like (at
    least)
    
    * Certificate
    * Server Key exchange
    * Client certificate
    
    Somehow it really expect this to be done in one packet as some
    structures used _gnutls_send_handshake are reinitialized at every
    packet exchange and intermediate steps didn't expect it
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 lib/torture/torture.h         |   13 +++++++++++++
 source4/lib/tls/tls_tstream.c |   27 +++++++++++++++++++++------
 2 files changed, 34 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index 605ba34..aeedd71 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -416,6 +416,19 @@ void torture_result(struct torture_context *test,
 	} \
 	} while(0)
 
+#define torture_assert_u64_equal_goto(torture_ctx,got,expected,ret,label,cmt)\
+	do { uint64_t __got = (got), __expected = (expected); \
+	if (__got != __expected) { \
+		torture_result(torture_ctx, TORTURE_FAIL, \
+			__location__": "#got" was %llu (0x%llX), expected %llu (0x%llX): %s", \
+			(unsigned long long)__got, (unsigned long long)__got, \
+			(unsigned long long)__expected, (unsigned long long)__expected, \
+			cmt); \
+		ret = false; \
+		goto label; \
+	} \
+	} while(0)
+
 #define torture_assert_errno_equal(torture_ctx,expected,cmt)\
 	do { int __expected = (expected); \
 	if (errno != __expected) { \
diff --git a/source4/lib/tls/tls_tstream.c b/source4/lib/tls/tls_tstream.c
index 8e80454..e113757 100644
--- a/source4/lib/tls/tls_tstream.c
+++ b/source4/lib/tls/tls_tstream.c
@@ -50,7 +50,7 @@ struct tstream_tls {
 	struct tevent_immediate *retry_im;
 
 	struct {
-		uint8_t buffer[1024];
+		uint8_t *buf;
 		off_t ofs;
 		struct iovec iov;
 		struct tevent_req *subreq;
@@ -153,6 +153,7 @@ static ssize_t tstream_tls_push_function(gnutls_transport_ptr ptr,
 	struct tstream_tls *tlss =
 		tstream_context_data(stream,
 		struct tstream_tls);
+	uint8_t *nbuf;
 	size_t len;
 
 	if (tlss->error != 0) {
@@ -165,13 +166,26 @@ static ssize_t tstream_tls_push_function(gnutls_transport_ptr ptr,
 		return -1;
 	}
 
-	if (tlss->push.ofs == sizeof(tlss->push.buffer)) {
+	len = MIN(size, UINT16_MAX - tlss->push.ofs);
+
+	if (len == 0) {
 		errno = EAGAIN;
 		return -1;
 	}
 
-	len = MIN(size, sizeof(tlss->push.buffer) - tlss->push.ofs);
-	memcpy(tlss->push.buffer + tlss->push.ofs, buf, len);
+	nbuf = talloc_realloc(tlss, tlss->push.buf,
+			      uint8_t, tlss->push.ofs + len);
+	if (nbuf == NULL) {
+		if (tlss->push.buf) {
+			errno = EAGAIN;
+			return -1;
+		}
+
+		return -1;
+	}
+	tlss->push.buf = nbuf;
+
+	memcpy(tlss->push.buf + tlss->push.ofs, buf, len);
 
 	if (tlss->push.im == NULL) {
 		tlss->push.im = tevent_create_immediate(tlss);
@@ -187,7 +201,7 @@ static ssize_t tstream_tls_push_function(gnutls_transport_ptr ptr,
 		 * in the next event cycle.
 		 *
 		 * This way we can batch all push requests,
-		 * if they fit into the buffer.
+		 * if they fit into a UINT16_MAX buffer.
 		 *
 		 * This is important as gnutls_handshake()
 		 * had a bug in some versions e.g. 2.4.1
@@ -223,7 +237,7 @@ static void tstream_tls_push_trigger_write(struct tevent_context *ev,
 		return;
 	}
 
-	tlss->push.iov.iov_base = (char *)tlss->push.buffer;
+	tlss->push.iov.iov_base = (char *)tlss->push.buf;
 	tlss->push.iov.iov_len = tlss->push.ofs;
 
 	subreq = tstream_writev_send(tlss,
@@ -253,6 +267,7 @@ static void tstream_tls_push_done(struct tevent_req *subreq)
 
 	tlss->push.subreq = NULL;
 	ZERO_STRUCT(tlss->push.iov);
+	TALLOC_FREE(tlss->push.buf);
 	tlss->push.ofs = 0;
 
 	ret = tstream_writev_recv(subreq, &sys_errno);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list