[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Wed Jul 13 08:11:04 UTC 2016


The branch, master has been updated
       via  f818136 python/remove_dc: handle dnsNode objects without dnsRecord attribute
      from  be39b73 dsdb: Fix CID 1363810: Null pointer dereferences

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


- Log -----------------------------------------------------------------
commit f8181360a89ac9e53cc991e966958e496271fa15
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Jul 11 15:25:31 2016 +0200

    python/remove_dc: handle dnsNode objects without dnsRecord attribute
    
    If we have dnsNode objects without dnsRecord attribute values we trigger
    the following error triggered by 'samba-tool domain demote --remove-other-dead-server=server2'
    
      ERROR(<type 'exceptions.TypeError'>): uncaught exception - __ndr_unpack__()
      argument 1 must be string or read-only buffer, not dnsp.DnssrvRpcRecord
        File "/usr/lib64/python2.6/site-packages/samba/netcmd/__init__.py", line 175,
      in _run
          return self.run(*args, **kwargs)
        File "/usr/lib64/python2.6/site-packages/samba/netcmd/domain.py", line 720, in
      run
          remove_dc.remove_dc(samdb, logger, remove_other_dead_server)
        File "/usr/lib64/python2.6/site-packages/samba/remove_dc.py", line 423, in
      remove_dc
          remove_dns_account=True)
        File "/usr/lib64/python2.6/site-packages/samba/remove_dc.py", line 351, in
      offline_remove_ntds_dc
          remove_dns_account=remove_dns_account)
        File "/usr/lib64/python2.6/site-packages/samba/remove_dc.py", line 266, in
      offline_remove_server
          remove_dns_references(samdb, logger, dnsHostName)
        File "/usr/lib64/python2.6/site-packages/samba/remove_dc.py", line 186, in
      remove_dns_references
          for v in values if not to_remove(v) ]
        File "/usr/lib64/python2.6/site-packages/samba/remove_dc.py", line 160, in
      to_remove
          dnsRecord = ndr_unpack(dnsp.DnssrvRpcRecord, value)
        File "/usr/lib64/python2.6/site-packages/samba/ndr.py", line 45, in ndr_unpack
          object.__ndr_unpack__(data, allow_remaining=allow_remaining)
      A transaction is still active in ldb context [0xe1f320] on
      tdb:///var/lib/samba/private/sam.ldb
    
    "next" is used in perl not in python!
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12018
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Wed Jul 13 10:10:30 CEST 2016 on sn-devel-144

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

Summary of changes:
 python/samba/remove_dc.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/python/samba/remove_dc.py b/python/samba/remove_dc.py
index 055a516..db7bb82 100644
--- a/python/samba/remove_dc.py
+++ b/python/samba/remove_dc.py
@@ -176,19 +176,18 @@ def remove_dns_references(samdb, logger, dnsHostName):
                                attrs=["dnsRecord"])
         for record in records:
             try:
-                values = record["dnsRecord"]
+                orig_values = record["dnsRecord"]
             except KeyError:
-                next
-            orig_num_values = len(values)
+                continue
 
             # Remove references to dnsHostName in A, AAAA, NS, CNAME and SRV
             values = [ ndr_unpack(dnsp.DnssrvRpcRecord, v)
-                       for v in values if not to_remove(v) ]
+                       for v in orig_values if not to_remove(v) ]
 
-            if len(values) != orig_num_values:
+            if len(values) != len(orig_values):
                 logger.info("updating %s keeping %d values, removing %s values" \
                             % (record.dn, len(values),
-                               orig_num_values - len(values)))
+                               len(orig_values) - len(values)))
 
                 # This requires the values to be unpacked, so this
                 # has been done in the list comprehension above


-- 
Samba Shared Repository



More information about the samba-cvs mailing list