[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Jun 20 21:04:03 UTC 2017


The branch, master has been updated
       via  d7ccf0d messaging: Fix queueing on FreeBSD
       via  b67262b ldb: Fix CID 1412926 Unchecked return value
       via  67040cf pidl: Fix array range checks in python output
      from  e60aeb6 s3:tests: Add test for smbclient -UDOMAIN+username

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


- Log -----------------------------------------------------------------
commit d7ccf0d977c39d49c29a4abb1d0b3e2f7a406016
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 23 16:51:25 2016 +0100

    messaging: Fix queueing on FreeBSD
    
    FreeBSD does not do the nice blocking send that Linux does. Instead,
    it returns ENOBUFS if the dst socket is full. According to the
    manpage you have to do polling. Try with exponential backoff, at
    the end try once a second forever.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Jun 20 23:03:11 CEST 2017 on sn-devel-144

commit b67262b40a924d5fa6576aacd2409ace808c730d
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jun 20 14:50:41 2017 +0200

    ldb: Fix CID 1412926 Unchecked return value
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 67040cf61232dd1cdcc820237919ac1e073c31c2
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jun 20 15:31:18 2017 +0200

    pidl: Fix array range checks in python output
    
    Without this, we generated code like
    
    if (ndr_table_dnsserver.num_calls < 0) {
            PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_DnssrvOperation_ndr_pack");
            return NULL;
    }
    call = &ndr_table_dnsserver.calls[0];
    
    This does not really make sense, and Coverity found comparing the unsigned
    num_calls against <0 a bit pointless.
    
    Should fix 138 Coverity findings and make the code a bit more correct.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 lib/ldb/tests/ldb_msg.c              |  3 ++-
 pidl/lib/Parse/Pidl/Samba4/Python.pm |  9 ++++++---
 source3/lib/messages_dgm.c           | 37 +++++++++++++++++++++++++++++++++++-
 3 files changed, 44 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/tests/ldb_msg.c b/lib/ldb/tests/ldb_msg.c
index 5261a73..e665d55 100644
--- a/lib/ldb/tests/ldb_msg.c
+++ b/lib/ldb/tests/ldb_msg.c
@@ -84,7 +84,8 @@ static void test_ldb_msg_find_duplicate_val(void **state)
 	struct ldb_val dummy;
 	struct ldb_val *dupe = &dummy;  /* so we can tell it was modified to NULL, not left as NULL */
 
-	ldb_msg_add_empty(msg, "el1", 0, &el);
+	ret = ldb_msg_add_empty(msg, "el1", 0, &el);
+	assert_int_equal(ret, LDB_SUCCESS);
 
 	for (i = 0; i < 5; i++) {
 		add_uint_value(test_ctx, msg, "el1", i);
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 79beb2e..f418ac4 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -521,7 +521,8 @@ sub PythonFunctionStruct($$$$)
 	$self->pidl("DATA_BLOB blob;");
 	$self->pidl("enum ndr_err_code err;");
 	$self->pidl("");
-	$self->pidl("if (ndr_table_$iface\.num_calls < $fn->{OPNUM}) {");
+	$self->pidl("if (ndr_table_$iface\.num_calls < " . ($fn->{OPNUM}+1) .
+		    ") {");
 	$self->indent;
 	$self->pidl("PyErr_SetString(PyExc_TypeError, \"Internal Error, ndr_interface_call missing for py_$name\_ndr_pack\");");
 	$self->pidl("return NULL;");
@@ -633,7 +634,8 @@ sub PythonFunctionStruct($$$$)
 	$self->pidl("struct ndr_pull *pull = NULL;");
 	$self->pidl("enum ndr_err_code err;");
 	$self->pidl("");
-	$self->pidl("if (ndr_table_$iface\.num_calls < $fn->{OPNUM}) {");
+	$self->pidl("if (ndr_table_$iface\.num_calls < " . ($fn->{OPNUM}+1) .
+		    ") {");
 	$self->indent;
 	$self->pidl("PyErr_SetString(PyExc_TypeError, \"Internal Error, ndr_interface_call missing for py_$name\_ndr_unpack\");");
 	$self->pidl("return NULL;");
@@ -797,7 +799,8 @@ sub PythonFunctionStruct($$$$)
 	$self->pidl("PyObject *ret;");
 	$self->pidl("char *retstr;");
 	$self->pidl("");
-	$self->pidl("if (ndr_table_$iface\.num_calls < $fn->{OPNUM}) {");
+	$self->pidl("if (ndr_table_$iface\.num_calls < " . ($fn->{OPNUM}+1) .
+		    ") {");
 	$self->indent;
 	$self->pidl("PyErr_SetString(PyExc_TypeError, \"Internal Error, ndr_interface_call missing for py_$name\_ndr_print\");");
 	$self->pidl("return NULL;");
diff --git a/source3/lib/messages_dgm.c b/source3/lib/messages_dgm.c
index 095a319..f29180d 100644
--- a/source3/lib/messages_dgm.c
+++ b/source3/lib/messages_dgm.c
@@ -541,9 +541,35 @@ static void messaging_dgm_out_threaded_job(void *private_data)
 	struct iovec iov = { .iov_base = state->buf,
 			     .iov_len = talloc_get_size(state->buf) };
 	size_t num_fds = talloc_array_length(state->fds);
+	int msec = 1;
 
-	state->sent = messaging_dgm_sendmsg(state->sock, &iov, 1,
+	while (true) {
+		int ret;
+
+		state->sent = messaging_dgm_sendmsg(state->sock, &iov, 1,
 					    state->fds, num_fds, &state->err);
+
+		if (state->sent != -1) {
+			return;
+		}
+		if (errno != ENOBUFS) {
+			return;
+		}
+
+		/*
+		 * ENOBUFS is the FreeBSD way of saying "Try
+		 * again". We have to do polling.
+		 */
+		do {
+			ret = poll(NULL, 0, msec);
+		} while ((ret == -1) && (errno == EINTR));
+
+		/*
+		 * Exponential backoff up to once a second
+		 */
+		msec *= 2;
+		msec = MIN(msec, 1000);
+	}
 }
 
 /*
@@ -619,6 +645,15 @@ static int messaging_dgm_out_send_fragment(
 			return 0;
 		}
 
+		if (err == ENOBUFS) {
+			/*
+			 * FreeBSD's way of telling us the dst socket
+			 * is full. EWOULDBLOCK makes us spawn a
+			 * polling helper thread.
+			 */
+			err = EWOULDBLOCK;
+		}
+
 		if (err != EWOULDBLOCK) {
 			return err;
 		}


-- 
Samba Shared Repository



More information about the samba-cvs mailing list