[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Fri Dec 15 03:52:01 UTC 2023


The branch, master has been updated
       via  83e36d97c95 netcmd: add shell command
       via  c8ded4621d3 python: use python3 style super statements
       via  3db3251342a netcmd: getpassword: get rid of pointless overridden constructors
       via  ddba4a06bbe python: pep257: docstring should use double quotes
      from  ff52e342887 python: Remove references to removed parameters

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


- Log -----------------------------------------------------------------
commit 83e36d97c956c2dba1caef45e0205cb5b1b164f3
Author: Rob van der Linde <rob at catalyst.net.nz>
Date:   Thu Nov 2 20:28:34 2023 +1300

    netcmd: add shell command
    
    A simple samba-tool shell, can be quite useful to play around with the ldb database and models.
    
    All models get imported and the samdb connection variable made available.
    
    Example usage:
    
        bin/samba-tool shell -H <host> --workgroup <workgroup> --realm <realm>
    
    >>> silos = AuthenticationSilo.query(ldb)
    >>> for silo in silos:
    ...     print(silo)
    ...
    
    Signed-off-by: Rob van der Linde <rob at catalyst.net.nz>
    Reviewed-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Fri Dec 15 03:51:55 UTC 2023 on atb-devel-224

commit c8ded4621d399e3561d6043bee4202ff42d50f1a
Author: Rob van der Linde <rob at catalyst.net.nz>
Date:   Thu Dec 14 15:30:42 2023 +1300

    python: use python3 style super statements
    
    Signed-off-by: Rob van der Linde <rob at catalyst.net.nz>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3db3251342a9323be3ad3ec36588af7e9268af60
Author: Rob van der Linde <rob at catalyst.net.nz>
Date:   Thu Dec 14 15:24:29 2023 +1300

    netcmd: getpassword: get rid of pointless overridden constructors
    
    Signed-off-by: Rob van der Linde <rob at catalyst.net.nz>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ddba4a06bbe236dfecf6ee6fee8493e8ca0c2b14
Author: Rob van der Linde <rob at catalyst.net.nz>
Date:   Thu Dec 14 15:14:27 2023 +1300

    python: pep257: docstring should use double quotes
    
    Signed-off-by: Rob van der Linde <rob at catalyst.net.nz>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 docs-xml/manpages/samba-tool.8.xml                 |  18 +++
 python/samba/common.py                             |   2 +-
 python/samba/dbchecker.py                          |  90 +++++++--------
 python/samba/dnsserver.py                          |  16 +--
 python/samba/drs_utils.py                          |  27 ++---
 python/samba/gp/gp_sec_ext.py                      |   6 +-
 python/samba/gp/gpclass.py                         | 122 ++++++++++-----------
 python/samba/gp/util/logging.py                    |   4 +-
 python/samba/gp_parse/gp_ini.py                    |  15 +--
 python/samba/idmap.py                              |  10 +-
 python/samba/join.py                               |  56 +++++-----
 python/samba/kcc/kcc_utils.py                      |  54 ++++-----
 python/samba/logger.py                             |   2 +-
 python/samba/netcmd/common.py                      |  14 +--
 python/samba/netcmd/domain/backup.py               |  32 +++---
 python/samba/netcmd/drs.py                         |  12 +-
 python/samba/netcmd/gpcommon.py                    |   2 +-
 python/samba/netcmd/gpo.py                         |  25 ++---
 python/samba/netcmd/main.py                        |   1 +
 python/samba/netcmd/rodc.py                        |   2 +-
 python/samba/netcmd/shell.py                       |  74 +++++++++++++
 python/samba/netcmd/user/readpasswords/common.py   |   2 +-
 .../samba/netcmd/user/readpasswords/getpassword.py |   2 -
 .../netcmd/user/readpasswords/syncpasswords.py     |   2 -
 python/samba/ntacls.py                             |   2 +-
 python/samba/policies.py                           |  12 +-
 python/samba/provision/__init__.py                 |   4 +-
 python/samba/provision/sambadns.py                 |  26 ++---
 python/samba/samdb.py                              |  85 +++++++-------
 python/samba/subunit/run.py                        |   8 +-
 30 files changed, 404 insertions(+), 323 deletions(-)
 create mode 100644 python/samba/netcmd/shell.py


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/samba-tool.8.xml b/docs-xml/manpages/samba-tool.8.xml
index c05be31b3d3..6b3a73020e3 100644
--- a/docs-xml/manpages/samba-tool.8.xml
+++ b/docs-xml/manpages/samba-tool.8.xml
@@ -2406,6 +2406,24 @@
 	<para>Display an objectclass schema definition.</para>
 </refsect3>
 
+<refsect2>
+	<title>shell</title>
+	<para>Opens an interactive Samba Python shell.</para>
+</refsect2>
+
+<refsect3>
+	<title>shell [options]</title>
+	<para>Opens an interactive Python shell for Samba ldb connection.</para>
+	<variablelist>
+		<varlistentry>
+			<term>-H, --URL</term>
+			<listitem><para>
+				LDB URL for database or target server.
+			</para></listitem>
+		</varlistentry>
+	</variablelist>
+</refsect3>
+
 <refsect2>
 	<title>sites</title>
 	<para>Manage sites.</para>
diff --git a/python/samba/common.py b/python/samba/common.py
index 7cad8d30f08..c46f6cb1a70 100644
--- a/python/samba/common.py
+++ b/python/samba/common.py
@@ -64,7 +64,7 @@ def confirm(msg, forced=False, allow_all=False):
 
 
 def normalise_int32(ivalue):
-    '''normalise a ldap integer to signed 32 bit'''
+    """normalise a ldap integer to signed 32 bit"""
     if int(ivalue) & 0x80000000 and int(ivalue) > 0:
         return str(int(ivalue) - 0x100000000)
     return str(ivalue)
diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py
index 48669b5c521..e07afdc239b 100644
--- a/python/samba/dbchecker.py
+++ b/python/samba/dbchecker.py
@@ -245,7 +245,7 @@ class dbcheck(object):
 
     def check_database(self, DN=None, scope=ldb.SCOPE_SUBTREE, controls=None,
                        attrs=None):
-        '''perform a database check, returning the number of errors found'''
+        """perform a database check, returning the number of errors found"""
         res = self.samdb.search(base=DN, scope=scope, attrs=['dn'], controls=controls)
         self.report('Checking %u objects' % len(res))
         error_count = 0
@@ -390,7 +390,7 @@ systemFlags: -1946157056%s""" % (dn, sec_desc_b64, guid_suffix),
         return error_count
 
     def report(self, msg):
-        '''print a message unless quiet is set'''
+        """print a message unless quiet is set"""
         if self.quiet:
             return
         if self.colour:
@@ -410,7 +410,7 @@ systemFlags: -1946157056%s""" % (dn, sec_desc_b64, guid_suffix),
         print(msg)
 
     def confirm(self, msg, allow_all=False, forced=False):
-        '''confirm a change'''
+        """confirm a change"""
         if not self.fix:
             return False
         if self.quiet:
@@ -422,7 +422,7 @@ systemFlags: -1946157056%s""" % (dn, sec_desc_b64, guid_suffix),
     ################################################################
     # a local confirm function with support for 'all'
     def confirm_all(self, msg, all_attr):
-        '''confirm a change with support for "all" '''
+        """confirm a change with support for "all" """
         if not self.fix:
             return False
         if getattr(self, all_attr) == 'NONE':
@@ -443,7 +443,7 @@ systemFlags: -1946157056%s""" % (dn, sec_desc_b64, guid_suffix),
         return c
 
     def do_delete(self, dn, controls, msg):
-        '''delete dn with optional verbose output'''
+        """delete dn with optional verbose output"""
         if self.verbose:
             self.report("delete DN %s" % dn)
         try:
@@ -457,7 +457,7 @@ systemFlags: -1946157056%s""" % (dn, sec_desc_b64, guid_suffix),
         return True
 
     def do_modify(self, m, controls, msg, validate=True):
-        '''perform a modify with optional verbose output'''
+        """perform a modify with optional verbose output"""
         controls = controls + ["local_oid:%s:0" % dsdb.DSDB_CONTROL_DBCHECK]
         if self.verbose:
             self.report(self.samdb.write_ldif(m, ldb.CHANGETYPE_MODIFY))
@@ -472,7 +472,7 @@ systemFlags: -1946157056%s""" % (dn, sec_desc_b64, guid_suffix),
         return True
 
     def do_rename(self, from_dn, to_rdn, to_base, controls, msg):
-        '''perform a rename with optional verbose output'''
+        """perform a rename with optional verbose output"""
         if self.verbose:
             self.report("""dn: %s
 changeType: modrdn
@@ -502,7 +502,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         return linkID, revname
 
     def err_empty_attribute(self, dn, attrname):
-        '''fix empty attributes'''
+        """fix empty attributes"""
         self.report("ERROR: Empty attribute %s in %s" % (attrname, dn))
         if not self.confirm_all('Remove empty attribute %s from %s?' % (attrname, dn), 'remove_all_empty_attributes'):
             self.report("Not fixing empty attribute %s" % attrname)
@@ -516,7 +516,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Removed empty attribute %s" % attrname)
 
     def err_normalise_mismatch(self, dn, attrname, values):
-        '''fix attribute normalisation errors, without altering sort order'''
+        """fix attribute normalisation errors, without altering sort order"""
         self.report("ERROR: Normalisation error for attribute %s in %s" % (attrname, dn))
         mod_list = []
         for val in values:
@@ -547,7 +547,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Normalised attribute %s" % attrname)
 
     def err_normalise_mismatch_replace(self, dn, attrname, values):
-        '''fix attribute normalisation and/or sort errors'''
+        """fix attribute normalisation and/or sort errors"""
         normalised = self.samdb.dsdb_normalise_attributes(self.samdb_schema, attrname, values)
         if list(normalised) == values:
             # how we got here is a mystery.
@@ -568,7 +568,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Normalised attribute %s" % attrname)
 
     def err_duplicate_values(self, dn, attrname, dup_values, values):
-        '''fix duplicate attribute values'''
+        """fix duplicate attribute values"""
         self.report("ERROR: Duplicate values for attribute '%s' in '%s'" % (attrname, dn))
         self.report("Values contain a duplicate: [%s]/[%s]!" %
                     (dump_attr_values(dup_values), dump_attr_values(values)))
@@ -586,7 +586,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Removed duplicate value on attribute %s" % attrname)
 
     def is_deleted_objects_dn(self, dsdb_dn):
-        '''see if a dsdb_Dn is the special Deleted Objects DN'''
+        """see if a dsdb_Dn is the special Deleted Objects DN"""
         return dsdb_dn.prefix == "B:32:%s:" % dsdb.DS_GUID_DELETED_OBJECTS_CONTAINER
 
     def err_missing_objectclass(self, dn):
@@ -823,7 +823,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Fixed missing DN SID on attribute %s" % (attrname))
 
     def err_unknown_attribute(self, obj, attrname):
-        '''handle an unknown attribute error'''
+        """handle an unknown attribute error"""
         self.report("ERROR: unknown attribute '%s' in %s" % (attrname, obj.dn))
         if not self.confirm_all('Remove unknown attribute %s' % attrname, 'remove_all_unknown_attributes'):
             self.report("Not removing %s" % attrname)
@@ -836,7 +836,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Removed unknown attribute %s" % (attrname))
 
     def err_undead_linked_attribute(self, obj, attrname, val):
-        '''handle a link that should not be there on a deleted object'''
+        """handle a link that should not be there on a deleted object"""
         self.report("ERROR: linked attribute '%s' to '%s' is present on "
                     "deleted object %s" % (attrname, val, obj.dn))
         if not self.confirm_all('Remove linked attribute %s' % attrname, 'fix_undead_linked_attributes'):
@@ -852,7 +852,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Fixed undead forward link %s" % (attrname))
 
     def err_missing_backlink(self, obj, attrname, val, backlink_name, target_dn):
-        '''handle a missing backlink value'''
+        """handle a missing backlink value"""
         self.report("ERROR: missing backlink attribute '%s' in %s for link %s in %s" % (backlink_name, target_dn, attrname, obj.dn))
         if not self.confirm_all('Fix missing backlink %s' % backlink_name, 'fix_all_missing_backlinks'):
             self.report("Not fixing missing backlink %s" % backlink_name)
@@ -865,7 +865,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Fixed missing backlink %s" % (backlink_name))
 
     def err_incorrect_rmd_flags(self, obj, attrname, revealed_dn):
-        '''handle a incorrect RMD_FLAGS value'''
+        """handle a incorrect RMD_FLAGS value"""
         rmd_flags = int(revealed_dn.dn.get_extended_component("RMD_FLAGS"))
         self.report("ERROR: incorrect RMD_FLAGS value %u for attribute '%s' in %s for link %s" % (rmd_flags, attrname, obj.dn, revealed_dn.dn.extended_str()))
         if not self.confirm_all('Fix incorrect RMD_FLAGS %u' % rmd_flags, 'fix_rmd_flags'):
@@ -881,7 +881,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
     def err_orphaned_backlink(self, obj_dn, backlink_attr, backlink_val,
                               target_dn, forward_attr, forward_syntax,
                               check_duplicates=True):
-        '''handle a orphaned backlink value'''
+        """handle a orphaned backlink value"""
         if check_duplicates is True and self.has_duplicate_links(target_dn, forward_attr, forward_syntax):
             self.report("WARNING: Keep orphaned backlink attribute " +
                         "'%s' in '%s' for link '%s' in '%s'" % (
@@ -899,7 +899,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Fixed orphaned backlink %s" % (backlink_attr))
 
     def err_recover_forward_links(self, obj, forward_attr, forward_vals):
-        '''handle a duplicate links value'''
+        """handle a duplicate links value"""
 
         self.report("RECHECK: 'Missing/Duplicate/Correct link' lines above for attribute '%s' in '%s'" % (forward_attr, obj.dn))
 
@@ -918,7 +918,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.duplicate_link_cache[duplicate_cache_key] = False
 
     def err_no_fsmoRoleOwner(self, obj):
-        '''handle a missing fSMORoleOwner'''
+        """handle a missing fSMORoleOwner"""
         self.report("ERROR: fSMORoleOwner not found for role %s" % (obj.dn))
         res = self.samdb.search("",
                                 scope=ldb.SCOPE_BASE, attrs=["dsServiceName"])
@@ -935,7 +935,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Seized role %s onto current DC by adding fSMORoleOwner=%s" % (obj.dn, serviceName))
 
     def err_missing_parent(self, obj):
-        '''handle a missing parent'''
+        """handle a missing parent"""
         self.report("ERROR: parent object not found for %s" % (obj.dn))
         if not self.confirm_all('Move object %s into LostAndFound?' % (obj.dn), 'move_to_lost_and_found'):
             self.report('Not moving object %s into LostAndFound' % (obj.dn))
@@ -970,7 +970,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.samdb.transaction_cancel()
 
     def err_wrong_dn(self, obj, new_dn, rdn_attr, rdn_val, name_val, controls):
-        '''handle a wrong dn'''
+        """handle a wrong dn"""
 
         new_rdn = ldb.Dn(self.samdb, str(new_dn))
         new_rdn.remove_base_components(len(new_rdn) - 1)
@@ -991,7 +991,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Renamed %s into %s" % (obj.dn, new_dn))
 
     def err_wrong_instancetype(self, obj, calculated_instancetype):
-        '''handle a wrong instanceType'''
+        """handle a wrong instanceType"""
         self.report("ERROR: wrong instanceType %s on %s, should be %d" % (obj["instanceType"], obj.dn, calculated_instancetype))
         if not self.confirm_all('Change instanceType from %s to %d on %s?' % (obj["instanceType"], calculated_instancetype, obj.dn), 'fix_instancetype'):
             self.report('Not changing instanceType from %s to %d on %s' % (obj["instanceType"], calculated_instancetype, obj.dn))
@@ -1009,7 +1009,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         self.report("ERROR: incorrect userParameters value on object %s.  If you have another working DC that does not give this warning, please run 'samba-tool drs replicate --full-sync --local <destinationDC> <sourceDC> %s'" % (obj.dn, self.samdb.get_nc_root(obj.dn)))
 
     def err_base64_userParameters(self, obj, attrname, value):
-        '''handle a userParameters that is wrongly base64 encoded'''
+        """handle a userParameters that is wrongly base64 encoded"""
         self.report("ERROR: wrongly formatted userParameters %s on %s, should not be base64-encoded" % (value, obj.dn))
         if not self.confirm_all('Convert userParameters from base64 encoding on %s?' % (obj.dn), 'fix_base64_userparameters'):
             self.report('Not changing userParameters from base64 encoding on %s' % (obj.dn))
@@ -1023,7 +1023,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Corrected base64-encoded userParameters on %s by converting from base64" % (obj.dn))
 
     def err_utf8_userParameters(self, obj, attrname, value):
-        '''handle a userParameters that is wrongly utf-8 encoded'''
+        """handle a userParameters that is wrongly utf-8 encoded"""
         self.report("ERROR: wrongly formatted userParameters on %s, "
                     "should not be pseudo-UTF8 encoded" % (obj.dn))
         if not self.confirm_all('Convert userParameters from UTF8 encoding on %s?' % (obj.dn), 'fix_utf8_userparameters'):
@@ -1039,7 +1039,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Corrected psudo-UTF8 encoded userParameters on %s by converting from UTF8" % (obj.dn))
 
     def err_doubled_userParameters(self, obj, attrname, value):
-        '''handle a userParameters that has been utf-16 encoded twice'''
+        """handle a userParameters that has been utf-16 encoded twice"""
         self.report("ERROR: wrongly formatted userParameters on %s, should not be double UTF16 encoded" % (obj.dn))
         if not self.confirm_all('Convert userParameters from doubled UTF-16 encoding on %s?' % (obj.dn), 'fix_doubled_userparameters'):
             self.report('Not changing userParameters from doubled UTF-16 encoding on %s' % (obj.dn))
@@ -1069,7 +1069,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         self.report("ERROR: incorrect userParameters value on object %s (odd length).  If you have another working DC that does not give this warning, please run 'samba-tool drs replicate --full-sync --local <destinationDC> <sourceDC> %s'" % (obj.dn, self.samdb.get_nc_root(obj.dn)))
 
     def find_revealed_link(self, dn, attrname, guid):
-        '''return a revealed link in an object'''
+        """return a revealed link in an object"""
         res = self.samdb.search(base=dn, scope=ldb.SCOPE_BASE, attrs=[attrname],
                                 controls=["show_deleted:0", "extended_dn:0", "reveal_internals:0"])
         syntax_oid = self.samdb_schema.get_syntax_oid_from_lDAPDisplayName(attrname)
@@ -1081,7 +1081,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         return None
 
     def check_duplicate_links(self, obj, forward_attr, forward_syntax, forward_linkID, backlink_attr):
-        '''check a linked values for duplicate forward links'''
+        """check a linked values for duplicate forward links"""
         error_count = 0
 
         duplicate_dict = dict()
@@ -1146,7 +1146,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         return (error_count, duplicate_dict, unique_dict)
 
     def has_duplicate_links(self, dn, forward_attr, forward_syntax):
-        '''check a linked values for duplicate forward links'''
+        """check a linked values for duplicate forward links"""
         error_count = 0
 
         duplicate_cache_key = "%s:%s" % (str(dn), forward_attr)
@@ -1183,7 +1183,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
                                                   forward_syntax,
                                                   backlink_attr,
                                                   forward_unique_dict):
-        '''Find all backlinks linking to obj_guid_str not already in forward_unique_dict'''
+        """Find all backlinks linking to obj_guid_str not already in forward_unique_dict"""
         missing_forward_links = []
         error_count = 0
 
@@ -1281,7 +1281,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         return (missing_forward_links, error_count)
 
     def check_dn(self, obj, attrname, syntax_oid):
-        '''check a DN attribute for correctness'''
+        """check a DN attribute for correctness"""
         error_count = 0
         obj_guid = obj['objectGUID'][0]
 
@@ -1586,11 +1586,11 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         return None
 
     def get_originating_time(self, val, attid):
-        '''Read metadata properties and return the originating time for
+        """Read metadata properties and return the originating time for
            a given attributeId.
 
            :return: the originating time or 0 if not found
-        '''
+        """
 
         repl = ndr_unpack(drsblobs.replPropertyMetaDataBlob, val)
         o = self.find_repl_attid(repl, attid)
@@ -1599,8 +1599,8 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         return 0
 
     def process_metadata(self, dn, val):
-        '''Read metadata properties and list attributes in it.
-           raises KeyError if the attid is unknown.'''
+        """Read metadata properties and list attributes in it.
+           raises KeyError if the attid is unknown."""
 
         set_att = set()
         wrong_attids = set()
@@ -1621,8 +1621,8 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         return (set_att, list_attid, wrong_attids)
 
     def fix_metadata(self, obj, attr):
-        '''re-write replPropertyMetaData elements for a single attribute for a
-        object. This is used to fix missing replPropertyMetaData elements'''
+        """re-write replPropertyMetaData elements for a single attribute for a
+        object. This is used to fix missing replPropertyMetaData elements"""
         guid_str = str(ndr_unpack(misc.GUID, obj['objectGUID'][0]))
         dn = ldb.Dn(self.samdb, "<GUID=%s>" % guid_str)
         res = self.samdb.search(base=dn, scope=ldb.SCOPE_BASE, attrs=[attr],
@@ -1777,7 +1777,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         return (sd, None)
 
     def err_wrong_sd(self, dn, sd, sd_broken):
-        '''re-write the SD due to incorrect inherited ACEs'''
+        """re-write the SD due to incorrect inherited ACEs"""
         sd_attr = "nTSecurityDescriptor"
         sd_val = ndr_pack(sd)
         sd_flags = security.SECINFO_DACL | security.SECINFO_SACL
@@ -1794,7 +1794,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Fixed attribute '%s' of '%s'\n" % (sd_attr, dn))
 
     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)'''
+        """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)
         sd_flags = security.SECINFO_DACL | security.SECINFO_SACL
@@ -1815,7 +1815,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Fixed attribute '%s' of '%s'\n" % (sd_attr, dn))
 
     def err_missing_sd_owner(self, dn, sd):
-        '''re-write the SD due to a missing owner or group'''
+        """re-write the SD due to a missing owner or group"""
         sd_attr = "nTSecurityDescriptor"
         sd_val = ndr_pack(sd)
         sd_flags = security.SECINFO_OWNER | security.SECINFO_GROUP
@@ -2005,9 +2005,9 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
                 continue
 
             found = True
-            self.report('''ERROR: on replPropertyMetaData of %s, the instanceType on attribute 0x%08x,
+            self.report("""ERROR: on replPropertyMetaData of %s, the instanceType on attribute 0x%08x,
                            version %d changed at %s is 00000000-0000-0000-0000-000000000000,
-                           but should be non-zero.  Proposed fix is to set to our invocationID (%s).'''
+                           but should be non-zero.  Proposed fix is to set to our invocationID (%s)."""
                         % (dn, o.attid, o.version,
                            time.ctime(samba.nttime2unix(o.originating_change_time)),
                            self.samdb.get_invocation_id()))
@@ -2326,7 +2326,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         return attrs, lc_attrs
 
     def check_object(self, dn, requested_attrs=None):
-        '''check one object'''
+        """check one object"""
         if self.verbose:
             self.report("Checking object %s" % dn)
 
@@ -2882,7 +2882,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
     ################################################################
     # check special @ROOTDSE attributes
     def check_rootdse(self):
-        '''check the @ROOTDSE special object'''
+        """check the @ROOTDSE special object"""
         dn = ldb.Dn(self.samdb, '@ROOTDSE')
         if self.verbose:
             self.report("Checking object %s" % dn)
@@ -2918,7 +2918,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
     # re-index the database
 
     def reindex_database(self):
-        '''re-index the whole database'''
+        """re-index the whole database"""
         m = ldb.Message()
         m.dn = ldb.Dn(self.samdb, "@ATTRIBUTES")
         m['add']    = ldb.MessageElement('NONE', ldb.FLAG_MOD_ADD, 'force_reindex')
@@ -2928,7 +2928,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
     ###############################################
     # reset @MODULES
     def reset_modules(self):
-        '''reset @MODULES to that needed for current sam.ldb (to read a very old database)'''
+        """reset @MODULES to that needed for current sam.ldb (to read a very old database)"""
         m = ldb.Message()
         m.dn = ldb.Dn(self.samdb, "@MODULES")
         m['@LIST'] = ldb.MessageElement('samba_dsdb', ldb.FLAG_MOD_REPLACE, '@LIST')
diff --git a/python/samba/dnsserver.py b/python/samba/dnsserver.py
index 965977acdeb..d907f8e1b8d 100644
--- a/python/samba/dnsserver.py
+++ b/python/samba/dnsserver.py
@@ -49,7 +49,7 @@ class DNSParseError(ValueError):
 class ARecord(dnsserver.DNS_RPC_RECORD):
     def __init__(self, ip_addr, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE,
                  node_flag=0):
-        super(ARecord, self).__init__()
+        super().__init__()
         self.wType = dnsp.DNS_TYPE_A
         self.dwFlags = rank | node_flag
         self.dwSerial = serial
@@ -65,7 +65,7 @@ class AAAARecord(dnsserver.DNS_RPC_RECORD):
 
     def __init__(self, ip6_addr, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE,
                  node_flag=0):
-        super(AAAARecord, self).__init__()
+        super().__init__()
         self.wType = dnsp.DNS_TYPE_AAAA
         self.dwFlags = rank | node_flag
         self.dwSerial = serial
@@ -81,7 +81,7 @@ class PTRRecord(dnsserver.DNS_RPC_RECORD):
 
     def __init__(self, ptr, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE,
                  node_flag=0):
-        super(PTRRecord, self).__init__()
+        super().__init__()
         self.wType = dnsp.DNS_TYPE_PTR
         self.dwFlags = rank | node_flag
         self.dwSerial = serial
@@ -119,7 +119,7 @@ class NSRecord(dnsserver.DNS_RPC_RECORD):
 
     def __init__(self, dns_server, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE,
                  node_flag=0):
-        super(NSRecord, self).__init__()
+        super().__init__()
         self.wType = dnsp.DNS_TYPE_NS
         self.dwFlags = rank | node_flag
         self.dwSerial = serial
@@ -138,7 +138,7 @@ class MXRecord(dnsserver.DNS_RPC_RECORD):
 
     def __init__(self, mail_server, preference, serial=1, ttl=900,
                  rank=dnsp.DNS_RANK_ZONE, node_flag=0):
-        super(MXRecord, self).__init__()
+        super().__init__()
         self.wType = dnsp.DNS_TYPE_MX
         self.dwFlags = rank | node_flag
         self.dwSerial = serial
@@ -165,7 +165,7 @@ class SOARecord(dnsserver.DNS_RPC_RECORD):
     def __init__(self, mname, rname, serial=1, refresh=900, retry=600,
                  expire=86400, minimum=3600, ttl=3600, rank=dnsp.DNS_RANK_ZONE,
                  node_flag=dnsp.DNS_RPC_FLAG_AUTH_ZONE_ROOT):
-        super(SOARecord, self).__init__()
+        super().__init__()
         self.wType = dnsp.DNS_TYPE_SOA
         self.dwFlags = rank | node_flag
         self.dwSerial = serial
@@ -202,7 +202,7 @@ class SRVRecord(dnsserver.DNS_RPC_RECORD):
 
     def __init__(self, target, port, priority=0, weight=100, serial=1, ttl=900,
                  rank=dnsp.DNS_RANK_ZONE, node_flag=0):
-        super(SRVRecord, self).__init__()
+        super().__init__()
         self.wType = dnsp.DNS_TYPE_SRV
         self.dwFlags = rank | node_flag
         self.dwSerial = serial
@@ -237,7 +237,7 @@ class TXTRecord(dnsserver.DNS_RPC_RECORD):
 
     def __init__(self, slist, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE,
                  node_flag=0):
-        super(TXTRecord, self).__init__()
+        super().__init__()


-- 
Samba Shared Repository



More information about the samba-cvs mailing list