[SCM] Samba Shared Repository - branch master updated
Andreas Schneider
asn at samba.org
Fri Jul 17 08:40:06 UTC 2020
The branch, master has been updated
via d05fc858bf7 python: samba.compat rejects Python 2
via 914226bf526 python: wrap 'import dckeytab' in an explanatory function
via 98f6ece5ad0 python/join: use the provided krbtgt link in cleanup_old_accounts
via 820b3d82fa8 python/upgradehelpers: remove unused imports and variables
via 78383dd8fc3 samba-tool ntacl: remove unused imports and variables
via e15ee51ef58 s4/scripting/samba_dnsupdate: remove unreachable code
via 65b49259f5a python/ms_forest_updates_markdown: avoid implicit global variable
via 5a078bc961a dbcheck: omit unused argument in err_wrong_default_sd
from 8e1d72b7132 s4/torture: fix compilation in smb2/multichannel
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit d05fc858bf7820aaf651fd0855305dc99fbf9136
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Sat Jul 4 13:30:28 2020 +1200
python: samba.compat rejects Python 2
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: David Mulder <dmulder at samba.org>
Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Fri Jul 17 08:39:38 UTC 2020 on sn-devel-184
commit 914226bf526093ffb795994c3434dff702ee4aca
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Sat Jul 4 16:20:47 2020 +1200
python: wrap 'import dckeytab' in an explanatory function
The samba.dckeytab module has magic effects on samba.net, but never
appears to be used. That can be confusing, both to people and to
linters. Here we wrap that confusion up into a well-commented
function, so we never again have to wonder why the unused import is
there.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: David Mulder <dmulder at samba.org>
commit 98f6ece5ad03a822180796873197383c17c3c6d9
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu Oct 11 13:08:38 2018 +1300
python/join: use the provided krbtgt link in cleanup_old_accounts
Before we were putting it in an otherwise unused variable, and
deleting the previous krbtgt_dn, if any.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: David Mulder <dmulder at samba.org>
commit 820b3d82fa8298d3f100c295bd931eef20108d3d
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu Oct 11 13:14:02 2018 +1300
python/upgradehelpers: remove unused imports and variables
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: David Mulder <dmulder at samba.org>
commit 78383dd8fc34356859f5c77c919ce2bd7949b024
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu Oct 11 12:40:50 2018 +1300
samba-tool ntacl: remove unused imports and variables
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: David Mulder <dmulder at samba.org>
commit e15ee51ef58c5adfd5d4b943be03362ddf18ec31
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu Oct 11 22:54:32 2018 +1300
s4/scripting/samba_dnsupdate: remove unreachable code
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: David Mulder <dmulder at samba.org>
commit 65b49259f5a1ae40a8527b43f53cda5be79a1e85
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Sun Oct 28 10:37:51 2018 +1300
python/ms_forest_updates_markdown: avoid implicit global variable
out_dict would have been shared across all calls, aggregating values as it went.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: David Mulder <dmulder at samba.org>
commit 5a078bc961a71258833cdd2517b1ea1177081fce
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu Nov 1 09:46:46 2018 +1300
dbcheck: omit unused argument in err_wrong_default_sd
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: David Mulder <dmulder at samba.org>
-----------------------------------------------------------------------
Summary of changes:
python/samba/__init__.py | 17 +++++++
python/samba/compat.py | 73 +-----------------------------
python/samba/dbchecker.py | 4 +-
python/samba/join.py | 2 +-
python/samba/ms_forest_updates_markdown.py | 2 +-
python/samba/netcmd/domain.py | 3 +-
python/samba/netcmd/ntacl.py | 2 +-
python/samba/tests/dckeytab.py | 6 ++-
python/samba/upgradehelpers.py | 2 +-
source4/scripting/bin/samba_dnsupdate | 9 +---
10 files changed, 34 insertions(+), 86 deletions(-)
Changeset truncated at 500 lines:
diff --git a/python/samba/__init__.py b/python/samba/__init__.py
index d851bf3606c..6272b3fb390 100644
--- a/python/samba/__init__.py
+++ b/python/samba/__init__.py
@@ -386,6 +386,23 @@ def arcfour_encrypt(key, data):
return arcfour_crypt_blob(data, key)
+def enable_net_export_keytab():
+ """This function modifies the samba.net.Net class to contain
+ an export_keytab() method."""
+ # This looks very strange because it is.
+ #
+ # The dckeytab modules contains nothing, but the act of importing
+ # it pushes a method into samba.net.Net. It ended up this way
+ # because Net.export_keytab() only works on Heimdal builds, and
+ # people sometimes want to compile Samba without Heimdal while
+ # still having a working samba-tool.
+ #
+ # There is probably a better way to do this than a magic module
+ # import (yes, that's a FIXME if you can be bothered).
+ from samba import net
+ from samba import dckeytab
+
+
version = _glue.version
interface_ips = _glue.interface_ips
fault_setup = _glue.fault_setup
diff --git a/python/samba/compat.py b/python/samba/compat.py
index 3762ca441e1..a6baa8dad1a 100644
--- a/python/samba/compat.py
+++ b/python/samba/compat.py
@@ -83,76 +83,7 @@ if PY3:
def ConfigParser(defaults=None, dict_type=dict, allow_no_value=False):
from configparser import ConfigParser
return ConfigParser(defaults, dict_type, allow_no_value, interpolation=None)
-else:
- # Helper function to return bytes.
- # if 'unicode' is passed in then it is decoded using 'utf8' and
- # the result returned. If 'str' is passed then it is returned unchanged.
- # Using this function is PY2/PY3 code should ensure in most cases
- # the PY2 code runs unchanged in PY2 whereas the code in PY3 possibly
- # encodes the variable (see PY3 implementation of this function above)
- def get_bytes(bytesorstring):
- tmp = bytesorstring
- if isinstance(bytesorstring, unicode):
- tmp = bytesorstring.encode('utf8')
- elif not isinstance(bytesorstring, str):
- raise ValueError('Expected string for %s:%s' % (type(bytesorstring), bytesorstring))
- return tmp
-
- # Helper function to return string.
- # if 'str' or 'unicode' passed in they are returned unchanged
- # otherwise an exception is generated
- # Using this function is PY2/PY3 code should ensure in most cases
- # the PY2 code runs unchanged in PY2 whereas the code in PY3 possibly
- # decodes the variable (see PY3 implementation of this function above)
- def get_string(bytesorstring):
- tmp = bytesorstring
- if not(isinstance(bytesorstring, str) or isinstance(bytesorstring, unicode)):
- raise ValueError('Expected str or unicode for %s:%s' % (type(bytesorstring), bytesorstring))
- return tmp
- if sys.version_info < (2, 7):
- def cmp_to_key_fn(mycmp):
-
- """Convert a cmp= function into a key= function"""
- class K(object):
- __slots__ = ['obj']
-
- def __init__(self, obj, *args):
- self.obj = obj
-
- def __lt__(self, other):
- return mycmp(self.obj, other.obj) < 0
-
- def __gt__(self, other):
- return mycmp(self.obj, other.obj) > 0
-
- def __eq__(self, other):
- return mycmp(self.obj, other.obj) == 0
-
- def __le__(self, other):
- return mycmp(self.obj, other.obj) <= 0
-
- def __ge__(self, other):
- return mycmp(self.obj, other.obj) >= 0
-
- def __ne__(self, other):
- return mycmp(self.obj, other.obj) != 0
-
- def __hash__(self):
- raise TypeError('hash not implemented')
- return K
- else:
- from functools import cmp_to_key as cmp_to_key_fn
-
- # compat types
- integer_types = (int, long)
- string_types = basestring
- text_type = unicode
- binary_type = str
-
- # alias
- import cStringIO
- StringIO = cStringIO.StringIO
- from ConfigParser import ConfigParser
- cmp_fn = cmp
+else:
+ raise NotImplementedError("Samba versions >= 4.11 do not support Python 2.x")
diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py
index 7496a463930..45dda945d21 100644
--- a/python/samba/dbchecker.py
+++ b/python/samba/dbchecker.py
@@ -1738,7 +1738,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
"Failed to fix attribute %s" % sd_attr):
self.report("Fixed attribute '%s' of '%s'\n" % (sd_attr, dn))
- def err_wrong_default_sd(self, dn, sd, sd_old, diff):
+ def err_wrong_default_sd(self, dn, sd, diff):
'''re-write the SD due to not matching the default (optional mode for fixing an incorrect provision)'''
sd_attr = "nTSecurityDescriptor"
sd_val = ndr_pack(sd)
@@ -2379,7 +2379,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
diff = get_diff_sds(well_known_sd, current_sd, security.dom_sid(self.samdb.get_domain_sid()))
if diff != "":
- self.err_wrong_default_sd(dn, well_known_sd, current_sd, diff)
+ self.err_wrong_default_sd(dn, well_known_sd, diff)
error_count += 1
continue
continue
diff --git a/python/samba/join.py b/python/samba/join.py
index 7273f3734d3..a35cf1d9a38 100644
--- a/python/samba/join.py
+++ b/python/samba/join.py
@@ -259,7 +259,7 @@ class DCJoinContext(object):
ctx.del_noerror(res[0].dn, recursive=True)
if "msDS-Krbtgtlink" in res[0]:
- new_krbtgt_dn = res[0]["msDS-Krbtgtlink"][0]
+ ctx.new_krbtgt_dn = res[0]["msDS-Krbtgtlink"][0]
ctx.del_noerror(ctx.new_krbtgt_dn)
res = ctx.samdb.search(base=ctx.samdb.get_default_basedn(),
diff --git a/python/samba/ms_forest_updates_markdown.py b/python/samba/ms_forest_updates_markdown.py
index 26cc3fd776a..62e9ad9b354 100644
--- a/python/samba/ms_forest_updates_markdown.py
+++ b/python/samba/ms_forest_updates_markdown.py
@@ -195,7 +195,7 @@ def innertext(tag):
(tag.tail or '')
-def read_ms_markdown(in_file, out_folder=None, out_dict={}):
+def read_ms_markdown(in_file, out_folder=None, out_dict=None):
"""
Read Github documentation to produce forest wide udpates
:param in_file: Forest-Wide-Updates.md
diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py
index 4cb873fd634..8561188511e 100644
--- a/python/samba/netcmd/domain.py
+++ b/python/samba/netcmd/domain.py
@@ -40,6 +40,7 @@ from samba import NTSTATUSError
from samba import werror
from getpass import getpass
from samba.net import Net, LIBNET_JOIN_AUTOMATIC
+from samba import enable_net_export_keytab
import samba.ntacls
from samba.join import join_RODC, join_DC
from samba.auth import system_session
@@ -162,7 +163,7 @@ def get_testparm_var(testparm, smbconf, varname):
try:
- import samba.dckeytab
+ enable_net_export_keytab()
except ImportError:
cmd_domain_export_keytab = None
else:
diff --git a/python/samba/netcmd/ntacl.py b/python/samba/netcmd/ntacl.py
index a8a9fa1e49f..7df75d247fe 100644
--- a/python/samba/netcmd/ntacl.py
+++ b/python/samba/netcmd/ntacl.py
@@ -23,7 +23,7 @@ from samba.ntacls import setntacl, getntacl, getdosinfo
from samba import Ldb
from samba.ndr import ndr_unpack, ndr_print
from samba.samdb import SamDB
-from samba.samba3 import param as s3param, passdb, smbd
+from samba.samba3 import param as s3param, passdb
from samba import provision
from samba.auth_util import system_session_unix
import os
diff --git a/python/samba/tests/dckeytab.py b/python/samba/tests/dckeytab.py
index cdb8c5151e7..5d975f53500 100644
--- a/python/samba/tests/dckeytab.py
+++ b/python/samba/tests/dckeytab.py
@@ -20,11 +20,15 @@ import os
import sys
import string
from samba.net import Net
-import samba.dckeytab
+from samba import enable_net_export_keytab
+
from samba import tests
from samba.param import LoadParm
+enable_net_export_keytab()
+
+
def open_bytes(filename):
if sys.version_info[0] == 3:
return open(filename, errors='ignore')
diff --git a/python/samba/upgradehelpers.py b/python/samba/upgradehelpers.py
index 32e7ae263a6..bc16590df28 100644
--- a/python/samba/upgradehelpers.py
+++ b/python/samba/upgradehelpers.py
@@ -37,7 +37,7 @@ from samba.provision import (provision_paths_from_lp,
provision, ProvisioningError,
secretsdb_self_join)
from samba.provision.common import FILL_FULL
-from samba.dcerpc import xattr, drsblobs, security
+from samba.dcerpc import drsblobs
from samba.dcerpc.misc import SEC_CHAN_BDC
from samba.ndr import ndr_unpack
from samba.samdb import SamDB
diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate
index 44eb1cadd27..1eac41dd77f 100755
--- a/source4/scripting/bin/samba_dnsupdate
+++ b/source4/scripting/bin/samba_dnsupdate
@@ -569,13 +569,8 @@ def call_samba_tool(d, op="add", zone=None):
if op == "add" and d.existing_port is not None:
print("Not handling modify of existing SRV %s using samba-tool" % d)
return False
- op = "update"
- args = [rpc_server_ip, zone, short_name, "SRV",
- "%s %s %s %s" % (d.existing_weight,
- d.existing_port, "0", "100"),
- "%s %s %s %s" % (d.dest, d.port, "0", "100")]
- else:
- args = [rpc_server_ip, zone, short_name, "SRV", "%s %s %s %s" % (d.dest, d.port, "0", "100")]
+ args = [rpc_server_ip, zone, short_name, "SRV",
+ "%s %s %s %s" % (d.dest, d.port, "0", "100")]
if d.type == "CNAME":
if d.existing_cname_target is None:
args = [rpc_server_ip, zone, short_name, "CNAME", d.dest]
--
Samba Shared Repository
More information about the samba-cvs
mailing list