[SCM] Samba Shared Repository - branch master updated

Douglas Bagnall dbagnall at samba.org
Wed Mar 12 04:37:01 UTC 2025


The branch, master has been updated
       via  5e8f998efa5 pylibsmb: do not use obsolete PyEval_InitThreads() for Python > 3.6
       via  90c04dd62c1 pylibsmb: fix cast warnings in Python method definitions
       via  e64e533c770 librpc/wsp: use unsigned char for high byte comparison
       via  495ca09cb76 s4/ldap server: avoid NULL deref if search control has no data
      from  b85f056e731 s3/lib: fix matching interfaces with multiple assigned IPs

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


- Log -----------------------------------------------------------------
commit 5e8f998efa54d276d02b90664125a7b577e091b9
Author: Dmitry Antipov <dantipov at cloudlinux.com>
Date:   Wed Feb 8 11:59:59 2023 +0300

    pylibsmb: do not use obsolete PyEval_InitThreads() for Python > 3.6
    
    Do not use obsolete PyEval_InitThreads() for Python > 3.6:
    
    ../../source3/libsmb/pylibsmb.c: In function ‘py_cli_state_setup_mt_ev’:
    ../../source3/libsmb/pylibsmb.c:271:9: warning: ‘PyEval_InitThreads’ is
    deprecated [-Wdeprecated-declarations]
      271 |         PyEval_InitThreads();
          |         ^~~~~~~~~~~~~~~~~~
    In file included from /usr/include/python3.11/Python.h:95,
                     from ../../source3/libsmb/pylibsmb.c:48:
    /usr/include/python3.11/ceval.h:132:37: note: declared here
      132 | Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);
    
    Signed-off-by: Dmitry Antipov <dantipov at cloudlinux.com>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    
    Autobuild-User(master): Douglas Bagnall <dbagnall at samba.org>
    Autobuild-Date(master): Wed Mar 12 04:36:21 UTC 2025 on atb-devel-224

commit 90c04dd62c108c13b11ead1d4afb023f96a9886d
Author: Dmitry Antipov <dantipov at cloudlinux.com>
Date:   Wed Feb 8 12:03:16 2023 +0300

    pylibsmb: fix cast warnings in Python method definitions
    
    Fix the following cast warnings in Python method definitions:
    
    ../../source3/libsmb/pylibsmb.c:1867:28: warning: cast between incompatible
    function types from ‘PyObject * (*)(struct py_cli_notify_state *, PyObject *,
    PyObject *)’ {aka ‘struct _object * (*)(struct py_cli_notify_state *, struct
    _object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’
    {aka ‘struct _object * (*)(struct _object *, struct _object *)’}
    [-Wcast-function-type]
     1867 |                 .ml_meth = (PyCFunction)py_cli_notify_get_changes,
          |                            ^
    
    ../../source3/libsmb/pylibsmb.c:2661:11: warning: cast between incompatible
    function types from ‘PyObject * (*)(struct py_cli_state *, PyObject *,
    PyObject *)’ {aka ‘struct _object * (*)(struct py_cli_state *, struct
    _object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’
    {aka ‘struct _object * (*)(struct _object *, struct _object *)’}
    [-Wcast-function-type]
     2661 |           (PyCFunction)py_cli_fsctl,
          |           ^
    
    Signed-off-by: Dmitry Antipov <dantipov at cloudlinux.com>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

commit e64e533c77041444ee30586319ee1c5691320e5c
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Nov 28 16:06:10 2024 +1300

    librpc/wsp: use unsigned char for high byte comparison
    
    ../../librpc/wsp/wsp_util.c:244:28: warning: result of comparison of constant 160 with expression of type 'char' is always false [-Wtautological-constant-out-of-range-compare]
      244 |                 if (strlen(t) == 1 && *t == 0xa0) {
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 495ca09cb7643d9b68b03bb85a7dc8284ec8c906
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Apr 23 15:33:59 2020 +1200

    s4/ldap server: avoid NULL deref if search control has no data
    
    We switch to ldb_request_replace_control() so that the old search
    control is removed in the NULL data case.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Volker Lendecke <vl at samba.org>

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

Summary of changes:
 librpc/wsp/wsp_util.c              |  2 +-
 source3/libsmb/pylibsmb.c          | 11 +++++++++--
 source4/ldap_server/ldap_backend.c |  8 ++++++--
 3 files changed, 16 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/wsp/wsp_util.c b/librpc/wsp/wsp_util.c
index d07338b1b5a..a072fbc4d26 100644
--- a/librpc/wsp/wsp_util.c
+++ b/librpc/wsp/wsp_util.c
@@ -241,7 +241,7 @@ static bool parse_properties_line(TALLOC_CTX *ctx,
 	for (pos = 0; pos < talloc_array_length(csv_line); pos++) {
 		t = strv_next(strv, t);
 		/* the scraped property file can have a non ascii char */
-		if (strlen(t) == 1 && *t == 0xa0) {
+		if (strlen(t) == 1 && *(unsigned char *)t == 0xa0) {
 			csv_line[pos] = talloc_strdup(csv_line,
 					"");
 		} else {
diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c
index 97ae69ef50e..bfbddbd5e7b 100644
--- a/source3/libsmb/pylibsmb.c
+++ b/source3/libsmb/pylibsmb.c
@@ -271,7 +271,13 @@ static bool py_cli_state_setup_mt_ev(struct py_cli_state *self)
 		goto fail;
 	}
 
+#if PY_VERSION_HEX < 0x03070000
+	/*
+	 * Should be explicitly called in 3.6 and older, see
+	 * https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads
+	 */
 	PyEval_InitThreads();
+#endif
 
 	ret = pthread_create(&t->id, NULL, py_cli_state_poll_thread, self);
 	if (ret != 0) {
@@ -2111,7 +2117,8 @@ static PyObject *py_cli_notify_get_changes(struct py_cli_notify_state *self,
 static PyMethodDef py_cli_notify_state_methods[] = {
 	{
 		.ml_name = "get_changes",
-		.ml_meth = (PyCFunction)py_cli_notify_get_changes,
+		.ml_meth = (PY_DISCARD_FUNC_SIG(PyCFunction,
+			    py_cli_notify_get_changes)),
 		.ml_flags = METH_VARARGS|METH_KEYWORDS,
 		.ml_doc  = "Wait for change notifications: \n"
 			   "N.get_changes(wait=BOOLEAN) -> "
@@ -3122,7 +3129,7 @@ static PyMethodDef py_cli_state_methods[] = {
 	  "smb1_stat(path) -> stat info",
 	},
 	{ "fsctl",
-	  (PyCFunction)py_cli_fsctl,
+	  PY_DISCARD_FUNC_SIG(PyCFunction, py_cli_fsctl),
 	  METH_VARARGS|METH_KEYWORDS,
 	  "fsctl(fnum, ctl_code, in_bytes, max_out) -> out_bytes",
 	},
diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c
index 986bc1db941..7314e65778a 100644
--- a/source4/ldap_server/ldap_backend.c
+++ b/source4/ldap_server/ldap_backend.c
@@ -858,14 +858,18 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call)
 		search_control = ldb_request_get_control(lreq, LDB_CONTROL_SEARCH_OPTIONS_OID);
 
 		search_options = NULL;
-		if (search_control) {
+		if (search_control != NULL && search_control->data != NULL) {
 			search_options = talloc_get_type(search_control->data, struct ldb_search_options_control);
 			search_options->search_options |= LDB_SEARCH_OPTION_PHANTOM_ROOT;
 		} else {
 			search_options = talloc(lreq, struct ldb_search_options_control);
 			NT_STATUS_HAVE_NO_MEMORY(search_options);
 			search_options->search_options = LDB_SEARCH_OPTION_PHANTOM_ROOT;
-			ldb_request_add_control(lreq, LDB_CONTROL_SEARCH_OPTIONS_OID, false, search_options);
+			ldb_request_replace_control(
+				lreq,
+				LDB_CONTROL_SEARCH_OPTIONS_OID,
+				false,
+				search_options);
 		}
 	} else {
 		ldb_request_add_control(lreq, DSDB_CONTROL_NO_GLOBAL_CATALOG, false, NULL);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list