[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Mon Apr 30 21:29:02 MDT 2012


The branch, master has been updated
       via  8135576 s4-upgradedns: Update serverdn with only the attributes that have changed
      from  6f3e011 Fix bug #8873 - self granting privileges in security=ads.

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


- Log -----------------------------------------------------------------
commit 813557629f33bdd672a27430d2f073888a0127e5
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Apr 20 09:39:53 2012 +1000

    s4-upgradedns: Update serverdn with only the attributes that have changed
    
    This fixes the issue of ldb 'Operations Error' when trying to modify
    hasPartialReplicaNCs attribute.
    
    Autobuild-User: Amitay Isaacs <amitay at samba.org>
    Autobuild-Date: Tue May  1 05:28:04 CEST 2012 on sn-devel-104

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

Summary of changes:
 source4/scripting/bin/samba_upgradedns |   32 +++++++++++++++++++++-----------
 1 files changed, 21 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/scripting/bin/samba_upgradedns b/source4/scripting/bin/samba_upgradedns
index 5a335a9..bd6a8b9 100755
--- a/source4/scripting/bin/samba_upgradedns
+++ b/source4/scripting/bin/samba_upgradedns
@@ -390,24 +390,34 @@ if __name__ == '__main__':
             for nc in ncs:
                 partial_nclist.append(nc)
 
-        modified = False
+        modified_master = False
+        modified_partial = False
         for nc in dns_nclist:
             if nc not in master_nclist:
                 master_nclist.append(nc)
-                modified = True
+                modified_master = True
             if nc in partial_nclist:
                 partial_nclist.remove(nc)
-                modified = True
+                modified_partial = True
 
-        if modified:
+        if modified_master or modified_partial:
             logger.debug("Updating msDS-hasMasterNCs and hasPartialReplicaNCs attributes")
-            msg["msDS-hasMasterNCs"] = ldb.MessageElement(master_nclist,
-                                                          ldb.FLAG_MOD_REPLACE,
-                                                          "msDS-hasMasterNCs")
-            msg["hasPartialReplicaNCs"] = ldb.MessageElement(partial_nclist,
-                                                             ldb.FLAG_MOD_REPLACE,
-                                                             "hasPartialReplicaNCs")
-            ldbs.sam.modify(msg)
+            m = ldb.Message()
+            m.dn = msg.dn
+            if modified_master:
+                m["msDS-hasMasterNCs"] = ldb.MessageElement(master_nclist,
+                                                            ldb.FLAG_MOD_REPLACE,
+                                                            "msDS-hasMasterNCs")
+            if modified_partial:
+                if partial_nclist:
+                    m["hasPartialReplicaNCs"] = ldb.MessageElement(partial_nclist,
+                                                                   ldb.FLAG_MOD_REPLACE,
+                                                                   "hasPartialReplicaNCs")
+                else:
+                    m["hasPartialReplicaNCs"] = ldb.MessageElement(ncs,
+                                                                   ldb.FLAG_MOD_DELETE,
+                                                                   "hasPartialReplicaNCs")
+            ldbs.sam.modify(m)
     except Exception:
         raise
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list