[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Mar 17 18:24:01 UTC 2021


The branch, master has been updated
       via  8aef8992a81 py.join: remove unused untested get_naming_master
       via  17c14a45535 samba-tool: domain tombstones expunge reminds on semi-noop
       via  94d7378fa23 pytests: dns_base: remove a py2 compat thing
       via  c4f338b7e4e kcc: use py3 compatible sort in rarely visited branch
       via  6e61d032c42 py3compat: remove obsolete comments
       via  f3309818d38 py bindings: write 'bytes', not 'PY_DESC_PY3_BYTES'
       via  ebad0bcb6b2 py/provision: provision_become_dc(): remove unused arguments
       via  45e8c32b569 py/provision: remove unused variable, thence import
      from  1c1ff48e7a9 selftest/flapping: remove python[23] lines

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


- Log -----------------------------------------------------------------
commit 8aef8992a81f2e9c6ba5356fe43484d6f72d5454
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Feb 17 12:47:42 2021 +1300

    py.join: remove unused untested get_naming_master
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Mar 17 18:23:04 UTC 2021 on sn-devel-184

commit 17c14a4553558347e0edbfe6b06f96eddaa7ca4f
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Jan 7 16:14:45 2021 +1300

    samba-tool: domain tombstones expunge reminds on semi-noop
    
    Sometimes people assume `samba-tool domain tombstones expunge` will
    expunge tombstones, but in the general case it won't because it only
    affects those that have reached the tombstone lifetime, but these are
    likely to have already been deleted by the regularly scheduled task.
    You need to set the tombstone lifetime to have much effect.
    
    This patch doesn't change the behaviour, but it does warn the user
    that they are probably doing nothing of significance.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 94d7378fa23583f7fd7aa92ace089443b27a5efe
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Dec 2 22:57:48 2020 +0000

    pytests: dns_base: remove a py2 compat thing
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c4f338b7e4ef068b516e80165cf5032815b0bb2d
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Dec 2 13:47:14 2020 +1300

    kcc: use py3 compatible sort in rarely visited branch
    
    This won't have worked for some time, but nobody has complained,
    because nobody uses DS_NTDSSETTINGS_OPT_IS_RAND_BH_SELECTION_DISABLED
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6e61d032c420203cd493ea17008d99758708106b
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Dec 2 12:51:44 2020 +1300

    py3compat: remove obsolete comments
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f3309818d3885c09b73fec4907872fac3fcf4e9a
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Dec 2 12:27:35 2020 +1300

    py bindings: write 'bytes', not 'PY_DESC_PY3_BYTES'
    
    Because it is shorter, clearer, and reduces py3compat.h
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ebad0bcb6b2ff25a432210c4f814510d2e1c5f13
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Dec 2 12:11:04 2020 +1300

    py/provision: provision_become_dc(): remove unused arguments
    
    The only caller is source4/param/provision.c, which doesn't supply these arguments,
    and they aren't used inside the function.
    
    This makes it just slightly less overwhelming
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 45e8c32b569e4b635cd70141ad5b7f8cce3e3e13
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed Dec 2 12:09:05 2020 +1300

    py/provision: remove unused variable, thence import
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 python/py3compat.h                 | 18 ------------------
 python/samba/join.py               | 14 --------------
 python/samba/kcc/__init__.py       |  4 ++--
 python/samba/netcmd/domain.py      |  7 +++++++
 python/samba/provision/__init__.py | 17 +++++++----------
 python/samba/tests/dns_base.py     |  5 +----
 source3/libsmb/pylibsmb.c          |  6 +++---
 source4/dsdb/pydsdb.c              |  6 ++----
 8 files changed, 22 insertions(+), 55 deletions(-)


Changeset truncated at 500 lines:

diff --git a/python/py3compat.h b/python/py3compat.h
index d09947bf90d..01108214783 100644
--- a/python/py3compat.h
+++ b/python/py3compat.h
@@ -22,13 +22,6 @@
 #include <Python.h>
 
 /* Quick docs:
- *
- * "PyStr_*" works like PyUnicode_* on Python 3, but uses bytestrings (str)
- * under Python 2.
- *
- * "PyBytes_*" work like in Python 3; on Python 2 they are aliased to their
- * PyString_* names.
- *
  * Syntax for module initialization is as in Python 3, except the entrypoint
  * function definition and declaration:
  *     PyMODINIT_FUNC PyInit_modulename(void);
@@ -44,19 +37,8 @@
  *
  * In the entrypoint, create a module using PyModule_Create and PyModuleDef,
  * and return it. See Python 3 documentation for details.
- * For Python 2 compatibility, always set PyModuleDef.m_size to -1.
- *
  */
 
-/***** Python 3 *****/
-
-/* Strings */
-
-/* description of bytes objects */
-#define PY_DESC_PY3_BYTES "bytes"
-
-/* Module init */
-
 #define MODULE_INIT_FUNC(name) \
     PyMODINIT_FUNC PyInit_ ## name(void); \
     PyMODINIT_FUNC PyInit_ ## name(void)
diff --git a/python/samba/join.py b/python/samba/join.py
index 59de000a401..28698e1744c 100644
--- a/python/samba/join.py
+++ b/python/samba/join.py
@@ -399,20 +399,6 @@ class DCJoinContext(object):
                                 ldb.OID_COMPARATOR_AND, samba.dsdb.SYSTEM_FLAG_CR_NTDS_DOMAIN))
         return str(res[0].dn)
 
-    def get_naming_master(ctx):
-        '''get the parent domain partition DN from parent DNS name'''
-        res = ctx.samdb.search(base='CN=Partitions,%s' % ctx.config_dn, attrs=['fSMORoleOwner'],
-                               scope=ldb.SCOPE_BASE, controls=["extended_dn:1:1"])
-        if 'fSMORoleOwner' not in res[0]:
-            raise DCJoinException("Can't find naming master on partition DN %s in %s" % (ctx.partition_dn, ctx.samdb.url))
-        try:
-            master_guid = str(misc.GUID(ldb.Dn(ctx.samdb, res[0]['fSMORoleOwner'][0].decode('utf8')).get_extended_component('GUID')))
-        except KeyError:
-            raise DCJoinException("Can't find GUID in naming master on partition DN %s" % res[0]['fSMORoleOwner'][0])
-
-        master_host = '%s._msdcs.%s' % (master_guid, ctx.dnsforest)
-        return master_host
-
     def get_mysid(ctx):
         '''get the SID of the connected user. Only works with w2k8 and later,
            so only used for RODC join'''
diff --git a/python/samba/kcc/__init__.py b/python/samba/kcc/__init__.py
index 73cdc9f1ef0..c87cc14fcff 100644
--- a/python/samba/kcc/__init__.py
+++ b/python/samba/kcc/__init__.py
@@ -21,7 +21,7 @@
 
 import random
 import uuid
-
+from functools import cmp_to_key
 import itertools
 from samba import unix2nttime, nttime2unix
 from samba import ldb, dsdb, drs_utils
@@ -1285,7 +1285,7 @@ class KCC(object):
         # ELSE
         #    SORT bhs in a random order
         if site.is_random_bridgehead_disabled():
-            bhs.sort(sort_dsa_by_gc_and_guid)
+            bhs.sort(key=cmp_to_key(sort_dsa_by_gc_and_guid))
         else:
             random.shuffle(bhs)
         debug.DEBUG_YELLOW(bhs)
diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py
index 6a02b2ecac0..ffabe8098c0 100644
--- a/python/samba/netcmd/domain.py
+++ b/python/samba/netcmd/domain.py
@@ -3822,6 +3822,13 @@ This command expunges tombstones from the database."""
         samdb = SamDB(url=H, session_info=system_session(),
                       credentials=creds, lp=lp)
 
+        if current_time_string is None and tombstone_lifetime is None:
+            print("Note: without --current-time or --tombstone-lifetime "
+                  "only tombstones already scheduled for deletion will "
+                  "be deleted.", file=self.outf)
+            print("To remove all tombstones, use --tombstone-lifetime=0.",
+                  file=self.outf)
+
         if current_time_string is not None:
             current_time_obj = time.strptime(current_time_string, "%Y-%m-%d")
             current_time = int(time.mktime(current_time_obj))
diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py
index 136267e7aad..b87ad38eeff 100644
--- a/python/samba/provision/__init__.py
+++ b/python/samba/provision/__init__.py
@@ -26,7 +26,6 @@
 
 __docformat__ = "restructuredText"
 
-from urllib.parse import quote as urllib_quote
 from base64 import b64encode
 import errno
 import os
@@ -2256,8 +2255,6 @@ def provision(logger, session_info, smbconf=None,
     if paths.sysvol and not os.path.exists(paths.sysvol):
         os.makedirs(paths.sysvol, 0o775)
 
-    ldapi_url = "ldapi://%s" % urllib_quote(paths.s4_ldapi_path, safe="")
-
     schema = Schema(domainsid, invocationid=invocationid,
                     schemadn=names.schemadn, base_schema=base_schema)
 
@@ -2427,13 +2424,13 @@ def provision(logger, session_info, smbconf=None,
     return result
 
 
-def provision_become_dc(smbconf=None, targetdir=None,
-                        realm=None, rootdn=None, domaindn=None, schemadn=None, configdn=None,
-                        serverdn=None, domain=None, hostname=None, domainsid=None,
-                        adminpass=None, krbtgtpass=None, domainguid=None, policyguid=None,
-                        policyguid_dc=None, invocationid=None, machinepass=None, dnspass=None,
-                        dns_backend=None, root=None, nobody=None, users=None,
-                        backup=None, serverrole=None, sitename=None, debuglevel=1, use_ntvfs=False):
+def provision_become_dc(smbconf=None, targetdir=None, realm=None,
+                        rootdn=None, domaindn=None, schemadn=None,
+                        configdn=None, serverdn=None, domain=None,
+                        hostname=None, domainsid=None,
+                        machinepass=None, dnspass=None,
+                        dns_backend=None, sitename=None, debuglevel=1,
+                        use_ntvfs=False):
 
     logger = logging.getLogger("provision")
     samba.set_debug_level(debuglevel)
diff --git a/python/samba/tests/dns_base.py b/python/samba/tests/dns_base.py
index a5c7c5eb982..5c0d6201b06 100644
--- a/python/samba/tests/dns_base.py
+++ b/python/samba/tests/dns_base.py
@@ -298,10 +298,7 @@ class DNSTKeyTest(DNSTest):
         # so it can be modified
         response_packet_list = [x if isinstance(x, int) else ord(x) for x in response_packet]
         del response_packet_list[-tsig_record_len:]
-        if isinstance(response_packet_list[11], int):
-            response_packet_list[11] = 0
-        else:
-            response_packet_list[11] = chr(0)
+        response_packet_list[11] = 0
 
         # convert modified list (of string char or int) to str/bytes
         response_packet_wo_tsig = bytes(response_packet_list)
diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c
index 45abbec14d2..06d821ae390 100644
--- a/source3/libsmb/pylibsmb.c
+++ b/source3/libsmb/pylibsmb.c
@@ -1735,10 +1735,10 @@ static PyMethodDef py_cli_state_methods[] = {
 	  "chkpath(dir_path) -> True or False\n\n"
 	  "\t\tReturn true if directory exists, false otherwise." },
 	{ "savefile", (PyCFunction)py_smb_savefile, METH_VARARGS,
-	  "savefile(path, str) -> None\n\n"
-	  "\t\tWrite " PY_DESC_PY3_BYTES " str to file." },
+	  "savefile(path, bytes) -> None\n\n"
+	  "\t\tWrite bytes to file." },
 	{ "loadfile", (PyCFunction)py_smb_loadfile, METH_VARARGS,
-	  "loadfile(path) -> file contents as a " PY_DESC_PY3_BYTES
+	  "loadfile(path) -> file contents as a bytes object"
 	  "\n\n\t\tRead contents of a file." },
 	{ "get_sd", (PyCFunction)py_smb_get_sd, METH_VARARGS,
 	  "get_sd(fnum[, security_info=0]) -> security_descriptor object\n\n"
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c
index 95b23d8adc3..832899ef1a9 100644
--- a/source4/dsdb/pydsdb.c
+++ b/source4/dsdb/pydsdb.c
@@ -587,8 +587,7 @@ static PyObject *py_dsdb_DsReplicaAttribute(PyObject *self, PyObject *args)
 			PyObject *item = PyList_GetItem(el_list, i);
 			if (!(PyBytes_Check(item))) {
 				PyErr_Format(PyExc_TypeError,
-					     "ldif_element type should be "
-					     PY_DESC_PY3_BYTES
+					     "ldif_element type should be bytes"
 					     );
 				talloc_free(tmp_ctx);
 				return NULL;
@@ -698,8 +697,7 @@ static PyObject *py_dsdb_normalise_attributes(PyObject *self, PyObject *args)
 			PyObject *item = PyList_GetItem(el_list, i);
 			if (!PyBytes_Check(item)) {
 				PyErr_Format(PyExc_TypeError,
-					     "ldif_element type should be "
-					     PY_DESC_PY3_BYTES
+					     "ldif_element type should be bytes"
 					     );
 				talloc_free(tmp_ctx);
 				return NULL;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list