[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Thu Jun 9 00:16:02 MDT 2011


The branch, master has been updated
       via  516dc40 samba-tool: added --local option to drs replicate command
       via  1596595 s4-ipv6: don't default to 127.0.0.1 in provision
      from  19213b8 Ensure when creating a directory, if we make any changes due to inheritance parameters, we update the stat returned.

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


- Log -----------------------------------------------------------------
commit 516dc404fd7f299b68adae356f2416ca8e265031
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Jun 9 15:01:30 2011 +1000

    samba-tool: added --local option to drs replicate command
    
    this allows replication directly to the local SAM, which means it can
    run without the samba daemon running. It also bypasses all usnChanged
    checks, which is useful for forcing replication of a set of objects
    which are not marked as replication being needed
    
    Autobuild-User: Andrew Tridgell <tridge at samba.org>
    Autobuild-Date: Thu Jun  9 08:15:10 CEST 2011 on sn-devel-104

commit 1596595b7e644de6432d7c8fb9e10ee2b525440e
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Jun 9 15:00:03 2011 +1000

    s4-ipv6: don't default to 127.0.0.1 in provision
    
    it is better to just leave the IPv4 address out of the zone file
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 source4/scripting/python/samba/netcmd/drs.py       |   40 +++++++++++++++++++-
 .../scripting/python/samba/provision/__init__.py   |   13 ++++--
 2 files changed, 47 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/scripting/python/samba/netcmd/drs.py b/source4/scripting/python/samba/netcmd/drs.py
index 56c0e39..61717a7 100644
--- a/source4/scripting/python/samba/netcmd/drs.py
+++ b/source4/scripting/python/samba/netcmd/drs.py
@@ -233,6 +233,39 @@ class cmd_drs_kcc(Command):
         self.message("Consistency check on %s successful." % DC)
 
 
+def drs_local_replicate(self, SOURCE_DC, NC):
+    '''replicate from a source DC to the local SAM'''
+    self.server = SOURCE_DC
+    drsuapi_connect(self)
+
+    self.local_samdb = SamDB(session_info=system_session(), url=None,
+                             credentials=self.creds, lp=self.lp)
+
+    self.samdb = SamDB(url="ldap://%s" % self.server,
+                       session_info=system_session(),
+                       credentials=self.creds, lp=self.lp)
+
+    # work out the source and destination GUIDs
+    res = self.local_samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["dsServiceName"])
+    self.ntds_dn = res[0]["dsServiceName"][0]
+
+    res = self.local_samdb.search(base=self.ntds_dn, scope=ldb.SCOPE_BASE, attrs=["objectGUID"])
+    self.ntds_guid = misc.GUID(self.samdb.schema_format_value("objectGUID", res[0]["objectGUID"][0]))
+
+
+    source_dsa_invocation_id = misc.GUID(self.samdb.get_invocation_id())
+    destination_dsa_guid = self.ntds_guid
+
+    self.samdb.transaction_start()
+    repl = drs_utils.drs_Replicate("ncacn_ip_tcp:%s[seal]" % self.server, self.lp,
+                                   self.creds, self.local_samdb)
+    try:
+        repl.replicate(NC, source_dsa_invocation_id, destination_dsa_guid)
+    except Exception, e:
+        raise CommandError("Error replicating DN %s" % NC, e)
+    self.samdb.transaction_commit()
+
+
 
 class cmd_drs_replicate(Command):
     """replicate a naming context between two DCs"""
@@ -250,9 +283,10 @@ class cmd_drs_replicate(Command):
     takes_options = [
         Option("--add-ref", help="use ADD_REF to add to repsTo on source", action="store_true"),
         Option("--sync-forced", help="use SYNC_FORCED to force inbound replication", action="store_true"),
+        Option("--local", help="pull changes directly into the local database (destination DC is ignored)", action="store_true"),
         ]
 
-    def run(self, DEST_DC, SOURCE_DC, NC, add_ref=False, sync_forced=False,
+    def run(self, DEST_DC, SOURCE_DC, NC, add_ref=False, sync_forced=False, local=False,
             sambaopts=None,
             credopts=None, versionopts=None, server=None):
 
@@ -261,6 +295,10 @@ class cmd_drs_replicate(Command):
 
         self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
 
+        if local:
+            drs_local_replicate(self, SOURCE_DC, NC)
+            return
+
         drsuapi_connect(self)
         samdb_connect(self)
 
diff --git a/source4/scripting/python/samba/provision/__init__.py b/source4/scripting/python/samba/provision/__init__.py
index 324e76f..f272872 100644
--- a/source4/scripting/python/samba/provision/__init__.py
+++ b/source4/scripting/python/samba/provision/__init__.py
@@ -1585,14 +1585,15 @@ def provision(logger, session_info, credentials, smbconf=None,
     if hostip is None:
         logger.info("Looking up IPv4 addresses")
         hostips = interface_ips_v4(lp)
-        if len(hostips) == 0:
-            logger.warning("No external IPv4 address has been found. Using loopback.")
-            hostip = '127.0.0.1'
-        else:
+        if len(hostips) > 0:
             hostip = hostips[0]
             if len(hostips) > 1:
                 logger.warning("More than one IPv4 address found. Using %s",
                     hostip)
+    if hostip == "127.0.0.1":
+        hostip = None
+    if hostip is None:
+        logger.warning("No IPv4 address will be assigned")
 
     if hostip6 is None:
         logger.info("Looking up IPv6 addresses")
@@ -1601,6 +1602,8 @@ def provision(logger, session_info, credentials, smbconf=None,
             hostip6 = hostips[0]
         if len(hostips) > 1:
             logger.warning("More than one IPv6 address found. Using %s", hostip6)
+    if hostip6 is None:
+        logger.warning("No IPv6 address will be assigned")
 
     if serverrole is None:
         serverrole = lp.get("server role")
@@ -1868,7 +1871,7 @@ def provision_become_dc(smbconf=None, targetdir=None,
         smbconf=smbconf, targetdir=targetdir, samdb_fill=FILL_DRS,
         realm=realm, rootdn=rootdn, domaindn=domaindn, schemadn=schemadn,
         configdn=configdn, serverdn=serverdn, domain=domain,
-        hostname=hostname, hostip="127.0.0.1", domainsid=domainsid,
+        hostname=hostname, hostip=None, domainsid=domainsid,
         machinepass=machinepass, serverrole="domain controller",
         sitename=sitename)
     res.lp.set("debuglevel", str(debuglevel))


-- 
Samba Shared Repository


More information about the samba-cvs mailing list