[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Mon Oct 29 22:14:02 UTC 2018


The branch, master has been updated
       via  b37f8f8 python: do not use "is" for string equality
       via  0b60afe python/samdb: properly use property()
       via  ba17cae s3:winbind: Check return code of initialize_password_db()
      from  5391e21 lib:socket: If returning early, set ifaces

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


- Log -----------------------------------------------------------------
commit b37f8f88eaf26a4d12fe9728e09aed68ddaaf1c0
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Fri Oct 26 20:25:59 2018 +1300

    python: do not use "is" for string equality
    
    This is not always going to work, and is not guaranteed to be
    consistent even between minor versions.
    
    Here is a simple counterexample:
    
    >>> a = 'hello'
    >>> a is 'hello'
    True
    >>> a is 'hello'.lower()
    False
    >>> a == a.lower()
    True
    
    Possibly it always works for the empty string, but we cannot rely
    on that.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Mon Oct 29 23:13:36 CET 2018 on sn-devel-144

commit 0b60afec7b6c21df58a8efa2c54f033badb4cd7e
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Oct 25 22:09:59 2018 +1300

    python/samdb: properly use property()
    
    Python's property() function works like this:
    
    property([getter[, setter[, delete[, doc]]]])
    
    but we have been forgetting the delete function, or rather setting it
    to be a string. A string is not callable and is unlikely to succeed at
    deleting the property.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit ba17cae4cab686b8d018c39d16706e621f9f93ac
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Oct 29 19:45:58 2018 +0100

    s3:winbind: Check return code of initialize_password_db()
    
    See https://retrace.fedoraproject.org/faf/reports/1577174/
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13668
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 python/samba/netcmd/domain.py                 |  4 ++--
 python/samba/netcmd/user.py                   | 10 +++++-----
 python/samba/provision/backend.py             |  2 +-
 python/samba/samdb.py                         |  8 ++++----
 source3/winbindd/winbindd.c                   |  8 +++++++-
 source4/dsdb/tests/python/password_lockout.py |  6 +++---
 6 files changed, 22 insertions(+), 16 deletions(-)


Changeset truncated at 500 lines:

diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py
index a85c16a..159b571 100644
--- a/python/samba/netcmd/domain.py
+++ b/python/samba/netcmd/domain.py
@@ -2334,7 +2334,7 @@ class cmd_domain_trust_create(DomainTrustCommand):
         def get_password(name):
             password = None
             while True:
-                if password is not None and password is not '':
+                if password is not None and password != '':
                     return password
                 password = getpass("New %s Password: " % name)
                 passwordverify = getpass("Retype %s Password: " % name)
@@ -2625,7 +2625,7 @@ class cmd_domain_trust_create(DomainTrustCommand):
                 self.outf.write("Deleting local TDO.\n")
                 local_lsa.DeleteObject(local_tdo_handle)
                 local_tdo_handle = None
-            if current_request['location'] is "remote":
+            if current_request['location'] == "remote":
                 raise self.RemoteRuntimeError(self, error, "%s" % (
                                               current_request['name']))
             raise self.LocalRuntimeError(self, error, "%s" % (
diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py
index 87726d4..2b1410b 100644
--- a/python/samba/netcmd/user.py
+++ b/python/samba/netcmd/user.py
@@ -325,7 +325,7 @@ Example5 shows how to create an RFC2307/NIS domain enabled user account. If
             smartcard_required=False):
 
         if smartcard_required:
-            if password is not None and password is not '':
+            if password is not None and password != '':
                 raise CommandError('It is not allowed to specify '
                                    '--newpassword '
                                    'together with --smartcard-required.')
@@ -340,7 +340,7 @@ Example5 shows how to create an RFC2307/NIS domain enabled user account. If
         while True:
             if smartcard_required:
                 break
-            if password is not None and password is not '':
+            if password is not None and password != '':
                 break
             password = getpass("New Password: ")
             passwordverify = getpass("Retype Password: ")
@@ -714,7 +714,7 @@ class cmd_user_password(Command):
 
         password = newpassword
         while True:
-            if password is not None and password is not '':
+            if password is not None and password != '':
                 break
             password = getpass("New Password: ")
             passwordverify = getpass("Retype Password: ")
@@ -798,7 +798,7 @@ Example3 shows how an administrator would reset TestUser3 user's password to pas
         password = newpassword
 
         if smartcard_required:
-            if password is not None and password is not '':
+            if password is not None and password != '':
                 raise CommandError('It is not allowed to specify '
                                    '--newpassword '
                                    'together with --smartcard-required.')
@@ -817,7 +817,7 @@ Example3 shows how an administrator would reset TestUser3 user's password to pas
         while True:
             if smartcard_required:
                 break
-            if password is not None and password is not '':
+            if password is not None and password != '':
                 break
             password = getpass("New Password: ")
             passwordverify = getpass("Retype Password: ")
diff --git a/python/samba/provision/backend.py b/python/samba/provision/backend.py
index 2e3b1dc..502afdf 100644
--- a/python/samba/provision/backend.py
+++ b/python/samba/provision/backend.py
@@ -569,7 +569,7 @@ class OpenLDAPBackend(LDAPBackend):
 
         self.slapd_provision_command.extend([self.ldap_uri, "-d0"])
         uris = self.ldap_uri
-        if server_port_string is not "":
+        if server_port_string != "":
             uris = uris + " " + server_port_string
 
         self.slapd_command.append(uris)
diff --git a/python/samba/samdb.py b/python/samba/samdb.py
index fa3e4b1..415142b 100644
--- a/python/samba/samdb.py
+++ b/python/samba/samdb.py
@@ -380,7 +380,7 @@ member: %s
             displayname += ' %s' % surname
 
         cn = username
-        if useusernameascn is None and displayname is not "":
+        if useusernameascn is None and displayname != "":
             cn = displayname
 
         user_dn = "CN=%s,%s,%s" % (cn, (userou or "CN=Users"), self.domain_dn())
@@ -405,7 +405,7 @@ member: %s
         if givenname is not None:
             ldbmessage["givenName"] = givenname
 
-        if displayname is not "":
+        if displayname != "":
             ldbmessage["displayName"] = displayname
             ldbmessage["name"] = displayname
 
@@ -676,7 +676,7 @@ accountExpires: %u
         return dsdb._samdb_get_domain_sid(self)
 
     domain_sid = property(get_domain_sid, set_domain_sid,
-                          "SID for the domain")
+                          doc="SID for the domain")
 
     def set_invocation_id(self, invocation_id):
         """Set the invocation id for this SamDB handle.
@@ -690,7 +690,7 @@ accountExpires: %u
         return dsdb._samdb_ntds_invocation_id(self)
 
     invocation_id = property(get_invocation_id, set_invocation_id,
-                             "Invocation ID GUID")
+                             doc="Invocation ID GUID")
 
     def get_oid_from_attid(self, attid):
         return dsdb._dsdb_get_oid_from_attid(self, attid)
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index ae25c6a..2378418 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -1846,7 +1846,13 @@ int main(int argc, const char **argv)
 	if (!NT_STATUS_IS_OK(status)) {
 		exit_daemon("Winbindd reinit_after_fork() failed", map_errno_from_nt_status(status));
 	}
-	initialize_password_db(true, global_event_context());
+
+	ok = initialize_password_db(true, global_event_context());
+	if (!ok) {
+		exit_daemon("Failed to initialize passdb backend! "
+			    "Check the 'passdb backend' variable in your "
+			    "smb.conf file.", EINVAL);
+	}
 
 	/*
 	 * Do not initialize the parent-child-pipe before becoming
diff --git a/source4/dsdb/tests/python/password_lockout.py b/source4/dsdb/tests/python/password_lockout.py
index aceebd6..14cf00a 100755
--- a/source4/dsdb/tests/python/password_lockout.py
+++ b/source4/dsdb/tests/python/password_lockout.py
@@ -151,11 +151,11 @@ userAccountControl: %d
 """ % uac)
 
     def _reset_by_method(self, res, method):
-        if method is "ldap_userAccountControl":
+        if method == "ldap_userAccountControl":
             self._reset_ldap_userAccountControl(res)
-        elif method is "ldap_lockoutTime":
+        elif method == "ldap_lockoutTime":
             self._reset_ldap_lockoutTime(res)
-        elif method is "samr":
+        elif method == "samr":
             self._reset_samr(res)
         else:
             self.assertTrue(False, msg="Invalid reset method[%s]" % method)


-- 
Samba Shared Repository



More information about the samba-cvs mailing list