[SCM] Samba Shared Repository - branch v4-0-test updated - release-4-0-0alpha3-6-gd333668

Andrew Bartlett abartlet at samba.org
Wed Apr 2 01:04:42 GMT 2008


The branch, v4-0-test has been updated
       via  d3336684f084f984500dd0893dd01bcfc5be0ab1 (commit)
       via  8585a3c77d5dfe97bca3f08716fc06ac2819f578 (commit)
       via  c5b287c056855892f30fbbf32efe7d65da31ce91 (commit)
      from  15cf55f9799d806c31a6a4e14a5c77df89dfe35b (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit d3336684f084f984500dd0893dd01bcfc5be0ab1
Merge: c5b287c056855892f30fbbf32efe7d65da31ce91 8585a3c77d5dfe97bca3f08716fc06ac2819f578
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Apr 2 12:03:03 2008 +1100

    Fix merge of my host GUID removal and the IPv6 addition to provision
    
    Merge branch 'v4-0-ipv6' of git://git.id10ts.net/samba into 4-0-abartlet
    
    Andrew Bartlett

commit 8585a3c77d5dfe97bca3f08716fc06ac2819f578
Author: Andrew Kroeger <andrew at sprocks.gotdns.com>
Date:   Tue Apr 1 19:51:24 2008 -0500

    provision: Add support for IPv6 (bz #4593).

commit c5b287c056855892f30fbbf32efe7d65da31ce91
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Apr 2 11:38:58 2008 +1100

    Remove references to setting the host GUID, as the repl_meta_data
    module prohibits it anyway.
    
    Andrew Bartlett

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

Summary of changes:
 source/scripting/python/samba/provision.py |   51 ++++++++++++++++-----------
 source/setup/provision                     |   10 +++++-
 source/setup/provision.zone                |    2 +
 source/setup/provision_self_join.ldif      |    1 -
 4 files changed, 41 insertions(+), 23 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/scripting/python/samba/provision.py b/source/scripting/python/samba/provision.py
index b03457e..dfeb61e 100644
--- a/source/scripting/python/samba/provision.py
+++ b/source/scripting/python/samba/provision.py
@@ -28,7 +28,7 @@ import pwd
 import grp
 import time
 import uuid, misc
-from socket import gethostname, gethostbyname
+import socket
 import param
 import registry
 import samba
@@ -267,7 +267,7 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None, serverrole=
               rootdn=None, domaindn=None, configdn=None, schemadn=None, sitename=None):
 
     if hostname is None:
-        hostname = gethostname().split(".")[0].lower()
+        hostname = socket.gethostname().split(".")[0].lower()
 
     netbiosname = hostname.upper()
     if not valid_netbios_name(netbiosname):
@@ -348,7 +348,7 @@ def load_or_make_smbconf(smbconf, setup_path, hostname, domain, realm, serverrol
 
     if not os.path.exists(smbconf):
         if hostname is None:
-            hostname = gethostname().split(".")[0].lower()
+            hostname = socket.gethostname().split(".")[0].lower()
 
         if serverrole is None:
             serverrole = "standalone"
@@ -695,13 +695,8 @@ def setup_samdb_rootdse(samdb, setup_path, schemadn, domaindn, hostname,
 def setup_self_join(samdb, names,
                     machinepass, dnspass, 
                     domainsid, invocationid, setup_path,
-                    policyguid, hostguid=None):
+                    policyguid):
     """Join a host to its own domain."""
-    if hostguid is not None:
-        hostguid_add = "objectGUID: %s" % hostguid
-    else:
-        hostguid_add = ""
-
     setup_add_ldif(samdb, setup_path("provision_self_join.ldif"), { 
               "CONFIGDN": names.configdn, 
               "SCHEMADN": names.schemadn,
@@ -714,7 +709,6 @@ def setup_self_join(samdb, names,
               "DNSPASS_B64": b64encode(dnspass),
               "REALM": names.realm,
               "DOMAIN": names.domain,
-              "HOSTGUID_ADD": hostguid_add,
               "DNSDOMAIN": names.dnsdomain})
     setup_add_ldif(samdb, setup_path("provision_group_policy.ldif"), { 
               "POLICYGUID": policyguid,
@@ -727,7 +721,7 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
                 names, message, 
                 domainsid, aci, domainguid, policyguid, 
                 fill, adminpass, krbtgtpass, 
-                machinepass, hostguid, invocationid, dnspass,
+                machinepass, invocationid, dnspass,
                 serverrole, ldap_backend=None, 
                 ldap_backend_type=None):
     """Setup a complete SAM Database.
@@ -880,7 +874,6 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
                                 dnspass=dnspass,  
                                 machinepass=machinepass, 
                                 domainsid=domainsid, policyguid=policyguid,
-                                hostguid=hostguid, 
                                 setup_path=setup_path)
 
     #We want to setup the index last, as adds are faster unindexed
@@ -901,8 +894,8 @@ FILL_DRS = "DRS"
 def provision(setup_dir, message, session_info, 
               credentials, smbconf=None, targetdir=None, samdb_fill=FILL_FULL, realm=None, 
               rootdn=None, domaindn=None, schemadn=None, configdn=None,
-              domain=None, hostname=None, hostip=None, domainsid=None, 
-              hostguid=None, adminpass=None, krbtgtpass=None, domainguid=None, 
+              domain=None, hostname=None, hostip=None, hostip6=None, 
+              domainsid=None, adminpass=None, krbtgtpass=None, domainguid=None, 
               policyguid=None, invocationid=None, machinepass=None, 
               dnspass=None, root=None, nobody=None, nogroup=None, users=None, 
               wheel=None, backup=None, aci=None, serverrole=None, 
@@ -955,7 +948,12 @@ def provision(setup_dir, message, session_info,
     paths = provision_paths_from_lp(lp, names.dnsdomain)
 
     if hostip is None:
-        hostip = gethostbyname(names.hostname)
+        hostip = socket.getaddrinfo(names.hostname, None, socket.AF_INET, socket.AI_CANONNAME, socket.IPPROTO_IP)[0][-1][0]
+
+    if hostip6 is None:
+        try:
+            hostip6 = socket.getaddrinfo(names.hostname, None, socket.AF_INET6, socket.AI_CANONNAME, socket.IPPROTO_IP)[0][-1][0]
+        except socket.gaierror: pass
 
     if serverrole is None:
         serverrole = lp.get("server role")
@@ -1006,7 +1004,7 @@ def provision(setup_dir, message, session_info,
                         aci=aci, domainguid=domainguid, policyguid=policyguid, 
                         fill=samdb_fill, 
                         adminpass=adminpass, krbtgtpass=krbtgtpass,
-                        hostguid=hostguid, invocationid=invocationid, 
+                        invocationid=invocationid, 
                         machinepass=machinepass, dnspass=dnspass,
                         serverrole=serverrole, ldap_backend=ldap_backend, 
                         ldap_backend_type=ldap_backend_type)
@@ -1048,7 +1046,8 @@ def provision(setup_dir, message, session_info,
             assert isinstance(hostguid, str)
             
             create_zone_file(paths.dns, setup_path, samdb, 
-                             hostname=names.hostname, hostip=hostip, dnsdomain=names.dnsdomain,
+                             hostname=names.hostname, hostip=hostip,
+                             hostip6=hostip6, dnsdomain=names.dnsdomain,
                              domaindn=names.domaindn, dnspass=dnspass, realm=names.realm, 
                              domainguid=domainguid, hostguid=hostguid)
             message("Please install the zone located in %s into your DNS server" % paths.dns)
@@ -1077,7 +1076,7 @@ def provision_become_dc(setup_dir=None,
                         smbconf=None, targetdir=None, realm=None, 
                         rootdn=None, domaindn=None, schemadn=None, configdn=None,
                         domain=None, hostname=None, domainsid=None, 
-                        hostguid=None, adminpass=None, krbtgtpass=None, domainguid=None, 
+                        adminpass=None, krbtgtpass=None, domainguid=None, 
                         policyguid=None, invocationid=None, machinepass=None, 
                         dnspass=None, root=None, nobody=None, nogroup=None, users=None, 
                         wheel=None, backup=None, aci=None, serverrole=None, 
@@ -1114,7 +1113,7 @@ def provision_backend(setup_dir=None, message=None,
         return os.path.join(setup_dir, file)
 
     if hostname is None:
-        hostname = gethostname().split(".")[0].lower()
+        hostname = socket.gethostname().split(".")[0].lower()
 
     if root is None:
         root = findnss(pwd.getpwnam, ["root"])[0]
@@ -1247,7 +1246,7 @@ def create_phpldapadmin_config(path, setup_path, ldapi_uri):
 
 
 def create_zone_file(path, setup_path, samdb, dnsdomain, domaindn, 
-                  hostip, hostname, dnspass, realm, domainguid, hostguid):
+                  hostip, hostip6, hostname, dnspass, realm, domainguid, hostguid):
     """Write out a DNS zone file, from the info in the current database.
     
     :param path: Path of the new file.
@@ -1255,7 +1254,8 @@ def create_zone_file(path, setup_path, samdb, dnsdomain, domaindn,
     :param samdb: SamDB object
     :param dnsdomain: DNS Domain name
     :param domaindn: DN of the Domain
-    :param hostip: Local IP
+    :param hostip: Local IPv4 IP
+    :param hostip6: Local IPv6 IP
     :param hostname: Local hostname
     :param dnspass: Password for DNS
     :param realm: Realm name
@@ -1264,6 +1264,13 @@ def create_zone_file(path, setup_path, samdb, dnsdomain, domaindn,
     """
     assert isinstance(domainguid, str)
 
+    hostip6_base_line = ""
+    hostip6_host_line = ""
+
+    if hostip6 is not None:
+        hostip6_base_line = "			IN AAAA	" + hostip6
+        hostip6_host_line = hostname + "		IN AAAA	" + hostip6
+
     setup_file(setup_path("provision.zone"), path, {
             "DNSPASS_B64": b64encode(dnspass),
             "HOSTNAME": hostname,
@@ -1274,6 +1281,8 @@ def create_zone_file(path, setup_path, samdb, dnsdomain, domaindn,
             "DATESTRING": time.strftime("%Y%m%d%H"),
             "DEFAULTSITE": DEFAULTSITE,
             "HOSTGUID": hostguid,
+            "HOSTIP6_BASE_LINE": hostip6_base_line,
+            "HOSTIP6_HOST_LINE": hostip6_host_line,
         })
 
 def load_schema(setup_path, samdb, schemadn, netbiosname, configdn, sitename):
diff --git a/source/setup/provision b/source/setup/provision
index e354f4d..afda9ee 100755
--- a/source/setup/provision
+++ b/source/setup/provision
@@ -52,14 +52,22 @@ parser.add_option("--domain-sid", type="string", metavar="SID",
 		help="set domainsid (otherwise random)")
 parser.add_option("--policy-guid", type="string", metavar="GUID",
 				  help="set policy guid")
+parser.add_option("--invocationid", type="string", metavar="GUID", 
+		  help="set invocationid (otherwise random)")
 parser.add_option("--host-name", type="string", metavar="HOSTNAME", 
 		help="set hostname")
 parser.add_option("--host-ip", type="string", metavar="IPADDRESS", 
+<<<<<<< HEAD:source/setup/provision
 		help="set ipaddress")
+=======
+		help="set IPv4 ipaddress")
+parser.add_option("--host-ip6", type="string", metavar="IP6ADDRESS", 
+		help="set IPv6 ipaddress")
 parser.add_option("--host-guid", type="string", metavar="GUID", 
 		help="set hostguid (otherwise random)")
 parser.add_option("--invocationid", type="string", metavar="GUID", 
 		help="set invocationid (otherwise random)")
+>>>>>>> 8585a3c77d5dfe97bca3f08716fc06ac2819f578:source/setup/provision
 parser.add_option("--adminpass", type="string", metavar="PASSWORD", 
 		help="choose admin password (otherwise random)")
 parser.add_option("--krbtgtpass", type="string", metavar="PASSWORD", 
@@ -141,7 +149,7 @@ provision(setup_dir, message,
           samdb_fill=samdb_fill, realm=opts.realm, domain=opts.domain,
           domainguid=opts.domain_guid, domainsid=opts.domain_sid,
           policyguid=opts.policy_guid, hostname=opts.host_name,
-          hostip=opts.host_ip, hostguid=opts.host_guid, 
+          hostip=opts.host_ip, hostip6=opts.host_ip6,
           invocationid=opts.invocationid, adminpass=opts.adminpass,
           krbtgtpass=opts.krbtgtpass, machinepass=opts.machinepass,
           dnspass=opts.dnspass, root=opts.root, nobody=opts.nobody,
diff --git a/source/setup/provision.zone b/source/setup/provision.zone
index 371dfd9..28c1c29 100644
--- a/source/setup/provision.zone
+++ b/source/setup/provision.zone
@@ -9,8 +9,10 @@ $TTL 1W
                                 6W              ; expiry
                                 1W )            ; minimum
 			IN NS	${HOSTNAME}
+${HOSTIP6_BASE_LINE}
 			IN A	${HOSTIP}
 ;
+${HOSTIP6_HOST_LINE}
 ${HOSTNAME}		IN A	${HOSTIP}
 ${HOSTGUID}._msdcs	IN CNAME ${HOSTNAME}
 ;
diff --git a/source/setup/provision_self_join.ldif b/source/setup/provision_self_join.ldif
index 503656a..a0cfa7e 100644
--- a/source/setup/provision_self_join.ldif
+++ b/source/setup/provision_self_join.ldif
@@ -19,7 +19,6 @@ servicePrincipalName: HOST/${DNSNAME}/${REALM}
 servicePrincipalName: HOST/${NETBIOSNAME}/${REALM}
 servicePrincipalName: HOST/${DNSNAME}/${DOMAIN}
 servicePrincipalName: HOST/${NETBIOSNAME}/${DOMAIN}
-${HOSTGUID_ADD}
 
 #Provide a account for DNS keytab export
 dn: CN=dns,CN=Users,${DOMAINDN}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list