[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Sat Jun 13 06:51:18 UTC 2020


The branch, master has been updated
       via  d827392f2ab replmd: slightly clarify a comment
       via  0f6c8a75e60 dsdb/mod/acl_util: do not deref NULL sd_flags control
       via  e73c89f1550 ldb commandline: don't crash if a received control contains no data
       via  def6b65c42a ldb/controls: avoid stealing our own stuff
       via  3fb21ed12e2 ldb/mod/paged_searches: cope with NULL control data
       via  2323ea6f07f python: do not always import socket_server
       via  5c06ab83381 python: do not always import urllib
      from  4aba00b554f doc: Add markup to README.Coding for samba wiki links

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


- Log -----------------------------------------------------------------
commit d827392f2ab8d6c9c0d61a5681ecb30bd80aa485
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Apr 23 15:37:53 2020 +1200

    replmd: slightly clarify a comment
    
    it has been a long time since we introduced "control", so lets remind
    ourselves which control it was.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Sat Jun 13 06:50:12 UTC 2020 on sn-devel-184

commit 0f6c8a75e604f80234ae7fe3edfd655cc8fe59c7
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Apr 23 15:31:13 2020 +1200

    dsdb/mod/acl_util: do not deref NULL sd_flags control
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit e73c89f15504e31ce5102b487dddb1be9e22d1ea
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Apr 23 10:57:24 2020 +1200

    ldb commandline: don't crash if a received control contains no data
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit def6b65c42a4f8b93536d71292b5966a58777bfd
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Apr 23 10:32:17 2020 +1200

    ldb/controls: avoid stealing our own stuff
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3fb21ed12e21382607ed9dc8dc879d62ec43f119
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Apr 23 10:31:39 2020 +1200

    ldb/mod/paged_searches: cope with NULL control data
    
    We won't get NULL data over ldap, but it can be set via 'local_oid:'.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 2323ea6f07f0a05a4bc3091236fa3a6502ca12bd
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Tue May 26 11:33:42 2020 +1200

    python: do not always import socket_server
    
    This cost around 10ms for every Python script, and was only used in one
    test.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 5c06ab83381c5e652626d66b95c3b67ce309b249
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Tue May 26 11:31:16 2020 +1200

    python: do not always import urllib
    
    Only provision.py wants a function from urllib, but we were importing
    it in samba.compat, which is imported by samba, mening that every
    python script importing anything from samba took 40ms longer to start
    up.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 lib/ldb/common/ldb_controls.c                      |  2 +-
 lib/ldb/modules/paged_searches.c                   |  4 +-
 lib/ldb/tools/cmdline.c                            | 45 ++++++++++++++++++++--
 python/samba/compat.py                             |  9 -----
 python/samba/provision/__init__.py                 |  2 +-
 python/samba/tests/dns_forwarder_helpers/server.py |  2 +-
 source4/dsdb/samdb/ldb_modules/acl_util.c          |  2 +-
 source4/dsdb/samdb/ldb_modules/repl_meta_data.c    |  2 +-
 8 files changed, 48 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/common/ldb_controls.c b/lib/ldb/common/ldb_controls.c
index 4af06a436ab..d67c0afd845 100644
--- a/lib/ldb/common/ldb_controls.c
+++ b/lib/ldb/common/ldb_controls.c
@@ -737,7 +737,7 @@ struct ldb_control *ldb_parse_control_from_string(struct ldb_context *ldb, TALLO
 
 		ctrl->oid = LDB_CONTROL_EXTENDED_DN_OID;
 		ctrl->critical = crit;
-		ctrl->data = talloc_steal(ctrl, control);
+		ctrl->data = control;
 
 		return ctrl;
 	}
diff --git a/lib/ldb/modules/paged_searches.c b/lib/ldb/modules/paged_searches.c
index f8f3895e19d..315a17a092a 100644
--- a/lib/ldb/modules/paged_searches.c
+++ b/lib/ldb/modules/paged_searches.c
@@ -72,8 +72,8 @@ static int check_ps_continuation(struct ps_context *ac, struct ldb_request *req,
 	}
 
 	req_control = ldb_request_get_control(req, LDB_CONTROL_PAGED_RESULTS_OID);
-	if (req_control == NULL) {
-		ldb_set_errstring(ldb, "paged_searches: control is missing");
+	if (req_control == NULL || req_control->data == NULL) {
+		ldb_set_errstring(ldb, "paged_searches: control is missing or malformed");
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
diff --git a/lib/ldb/tools/cmdline.c b/lib/ldb/tools/cmdline.c
index e5bb499c97e..c32470864d4 100644
--- a/lib/ldb/tools/cmdline.c
+++ b/lib/ldb/tools/cmdline.c
@@ -358,13 +358,19 @@ int handle_controls_reply(struct ldb_control **reply, struct ldb_control **reque
 	int ret = 0;
 
 	if (reply == NULL || request == NULL) return -1;
-	
+
 	for (i = 0; reply[i]; i++) {
 		if (strcmp(LDB_CONTROL_VLV_RESP_OID, reply[i]->oid) == 0) {
 			struct ldb_vlv_resp_control *rep_control;
 
 			rep_control = talloc_get_type(reply[i]->data, struct ldb_vlv_resp_control);
-			
+			if (rep_control == NULL) {
+				fprintf(stderr,
+					"Warning VLV reply OID received "
+					"with no VLV data\n");
+				continue;
+			}
+
 			/* check we have a matching control in the request */
 			for (j = 0; request[j]; j++) {
 				if (strcmp(LDB_CONTROL_VLV_REQ_OID, request[j]->oid) == 0)
@@ -389,6 +395,12 @@ int handle_controls_reply(struct ldb_control **reply, struct ldb_control **reque
 			struct ldb_asq_control *rep_control;
 
 			rep_control = talloc_get_type(reply[i]->data, struct ldb_asq_control);
+			if (rep_control == NULL) {
+				fprintf(stderr,
+					"Warning ASQ reply OID received "
+					"with no ASQ data\n");
+				continue;
+			}
 
 			/* check the result */
 			if (rep_control->result != 0) {
@@ -402,8 +414,16 @@ int handle_controls_reply(struct ldb_control **reply, struct ldb_control **reque
 			struct ldb_paged_control *rep_control, *req_control;
 
 			rep_control = talloc_get_type(reply[i]->data, struct ldb_paged_control);
-			if (rep_control->cookie_len == 0) /* we are done */
+			if (rep_control == NULL) {
+				fprintf(stderr,
+					"Warning PAGED_RESULTS reply OID "
+					"received with no data\n");
+				continue;
+			}
+
+			if (rep_control->cookie_len == 0) { /* we are done */
 				break;
+			}
 
 			/* more processing required */
 			/* let's fill in the request control with the new cookie */
@@ -434,6 +454,12 @@ int handle_controls_reply(struct ldb_control **reply, struct ldb_control **reque
 			struct ldb_sort_resp_control *rep_control;
 
 			rep_control = talloc_get_type(reply[i]->data, struct ldb_sort_resp_control);
+			if (rep_control == NULL) {
+				fprintf(stderr,
+					"Warning SORT reply OID "
+					"received with no data\n");
+				continue;
+			}
 
 			/* check we have a matching control in the request */
 			for (j = 0; request[j]; j++) {
@@ -458,6 +484,12 @@ int handle_controls_reply(struct ldb_control **reply, struct ldb_control **reque
 			char *cookie;
 
 			rep_control = talloc_get_type(reply[i]->data, struct ldb_dirsync_control);
+			if (rep_control == NULL) {
+				fprintf(stderr,
+					"Warning DIRSYNC reply OID "
+					"received with no data\n");
+				continue;
+			}
 			if (rep_control->cookie_len == 0) /* we are done */
 				break;
 
@@ -491,6 +523,12 @@ int handle_controls_reply(struct ldb_control **reply, struct ldb_control **reque
 			char *cookie;
 
 			rep_control = talloc_get_type(reply[i]->data, struct ldb_dirsync_control);
+			if (rep_control == NULL) {
+				fprintf(stderr,
+					"Warning DIRSYNC_EX reply OID "
+					"received with no data\n");
+				continue;
+			}
 			if (rep_control->cookie_len == 0) /* we are done */
 				break;
 
@@ -526,4 +564,3 @@ int handle_controls_reply(struct ldb_control **reply, struct ldb_control **reque
 
 	return ret;
 }
-
diff --git a/python/samba/compat.py b/python/samba/compat.py
index d7603d3964e..3762ca441e1 100644
--- a/python/samba/compat.py
+++ b/python/samba/compat.py
@@ -69,11 +69,7 @@ if PY3:
 
         return (x > y) - (x < y)
     # compat functions
-    from urllib.parse import quote as urllib_quote
-    from urllib.parse import urljoin as urllib_join
-    from urllib.request import urlopen as urllib_urlopen
     from functools import cmp_to_key as cmp_to_key_fn
-    import socketserver as SocketServer
 
     # compat types
     integer_types = int,
@@ -148,11 +144,6 @@ else:
             return K
     else:
         from functools import cmp_to_key as cmp_to_key_fn
-    # compat functions
-    from urllib import quote as urllib_quote
-    from urllib import urlopen as urllib_urlopen
-    from urlparse import urljoin as urllib_join
-    import SocketServer as SocketServer
 
     # compat types
     integer_types = (int, long)
diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py
index fe58569e5e5..3f176e00ba4 100644
--- a/python/samba/provision/__init__.py
+++ b/python/samba/provision/__init__.py
@@ -26,7 +26,7 @@
 
 __docformat__ = "restructuredText"
 
-from samba.compat import urllib_quote
+from urllib.parse import quote as urllib_quote
 from samba.compat import string_types
 from samba.compat import binary_type
 from base64 import b64encode
diff --git a/python/samba/tests/dns_forwarder_helpers/server.py b/python/samba/tests/dns_forwarder_helpers/server.py
index 32b0ffe052a..803372f73c1 100644
--- a/python/samba/tests/dns_forwarder_helpers/server.py
+++ b/python/samba/tests/dns_forwarder_helpers/server.py
@@ -18,7 +18,7 @@
 #
 # Based on the EchoServer example from python docs
 from __future__ import print_function
-from samba.compat import SocketServer
+import socketserver as SocketServer
 import sys
 from threading import Timer
 from samba.dcerpc import dns
diff --git a/source4/dsdb/samdb/ldb_modules/acl_util.c b/source4/dsdb/samdb/ldb_modules/acl_util.c
index b9931795e19..f917d99517a 100644
--- a/source4/dsdb/samdb/ldb_modules/acl_util.c
+++ b/source4/dsdb/samdb/ldb_modules/acl_util.c
@@ -257,7 +257,7 @@ uint32_t dsdb_request_sd_flags(struct ldb_request *req, bool *explicit)
 	}
 
 	sd_control = ldb_request_get_control(req, LDB_CONTROL_SD_FLAGS_OID);
-	if (sd_control) {
+	if (sd_control != NULL && sd_control->data != NULL) {
 		struct ldb_sd_flags_control *sdctr = (struct ldb_sd_flags_control *)sd_control->data;
 
 		sd_flags = sdctr->secinfo_flags;
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 97c08a2ffcd..58c04da5f53 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -1486,7 +1486,7 @@ static int replmd_add(struct ldb_module *module, struct ldb_request *req)
 		}
 	}
 
-	/* mark the control done */
+	/* mark the relax control done */
 	if (control) {
 		control->critical = 0;
 	}


-- 
Samba Shared Repository



More information about the samba-cvs mailing list