"""Guess configuration settings to use."""
if hostname is None:
- hostname = socket.gethostname().split(".")[0].lower()
+ hostname = socket.gethostname().split(".")[0]
- netbiosname = hostname.upper()
+ netbiosname = lp.get("netbios name")
+ if netbiosname is None:
+ netbiosname = hostname
+ assert netbiosname is not None
+ netbiosname = netbiosname.upper()
if not valid_netbios_name(netbiosname):
raise InvalidNetbiosName(netbiosname)
- hostname = hostname.lower()
-
if dnsdomain is None:
- dnsdomain = lp.get("realm").lower()
+ dnsdomain = lp.get("realm")
+ assert dnsdomain is not None
+ dnsdomain = dnsdomain.lower()
if serverrole is None:
serverrole = lp.get("server role")
+ assert serverrole is not None
+ serverrole = serverrole.lower()
- assert dnsdomain is not None
realm = dnsdomain.upper()
if lp.get("realm").upper() != realm:
- raise Exception("realm '%s' in %s must match chosen realm '%s'" %
- (lp.get("realm"), lp.configfile, realm))
-
+ raise ProvisioningError("guess_names: Realm '%s' in smb.conf must match chosen realm '%s'!", lp.get("realm").upper(), realm)
+
if serverrole == "domain controller":
if domain is None:
domain = lp.get("workgroup")
+ assert domain is not None
+ domain = domain.upper()
+
+ if lp.get("workgroup").upper() != domain:
+ raise ProvisioningError("guess_names: Workgroup '%s' in smb.conf must match chosen domain '%s'!", lp.get("workgroup").upper(), domain)
+
if domaindn is None:
domaindn = "DC=" + dnsdomain.replace(".", ",DC=")
- if lp.get("workgroup").upper() != domain.upper():
- raise Exception("workgroup '%s' in smb.conf must match chosen domain '%s'",
- lp.get("workgroup"), domain)
else:
domain = netbiosname
if domaindn is None:
domaindn = "DC=" + netbiosname
- assert domain is not None
- domain = domain.upper()
-
if not valid_netbios_name(domain):
raise InvalidNetbiosName(domain)
- if netbiosname.upper() == realm:
- raise Exception("realm %s must not be equal to netbios domain name %s", realm, netbiosname)
-
if hostname.upper() == realm:
- raise Exception("realm %s must not be equal to hostname %s", realm, hostname)
-
- if domain.upper() == realm:
- raise Exception("realm %s must not be equal to domain name %s", realm, domain)
+ raise ProvisioningError("guess_names: Realm '%s' must not be equal to hostname '%s'!", realm, hostname)
+ if netbiosname == realm:
+ raise ProvisioningError("guess_names: Realm '%s' must not be equal to netbios hostname '%s'!", realm, netbiosname)
+ if domain == realm:
+ raise ProvisioningError("guess_names: Realm '%s' must not be equal to short domain name '%s'!", realm, domain)
if rootdn is None:
rootdn = domaindn
"""
assert smbconf is not None
if hostname is None:
- hostname = socket.gethostname().split(".")[0].lower()
+ hostname = socket.gethostname().split(".")[0]
+ netbiosname = hostname.upper()
if serverrole is None:
serverrole = "standalone"
smbconfsuffix = "standalone"
assert domain is not None
+ domain = domain.upper()
+
assert realm is not None
+ realm = realm.upper()
default_lp = param.LoadParm()
#Load non-existant file
setup_file(setup_path("provision.smb.conf.%s" % smbconfsuffix),
smbconf, {
- "HOSTNAME": hostname,
+ "NETBIOS_NAME": netbiosname,
"DOMAIN": domain,
"REALM": realm,
"SERVERROLE": serverrole,
"linked_attributes",
"extended_dn_out_ldb"]
modules_list2 = ["show_deleted",
+ "schema_load",
"new_partition",
- "partition"]
+ "partition"]
ldap_backend_line = "# No LDAP backend"
if ldap_backend is not None:
ldap_backend_line = "ldapBackend: %s" % ldap_backend.ldapi_uri
if ldap_backend.ldap_backend_type == "fedora-ds":
backend_modules = ["nsuniqueid", "paged_searches"]
# We can handle linked attributes here, as we don't have directory-side subtree operations
- tdb_modules_list = ["extended_dn_out_dereference"]
+ tdb_modules_list = ["extended_dn_out_fds"]
elif ldap_backend.ldap_backend_type == "openldap":
backend_modules = ["entryuuid", "paged_searches"]
# OpenLDAP handles subtree renames, so we don't want to do any of these things
- tdb_modules_list = ["extended_dn_out_dereference"]
+ tdb_modules_list = ["extended_dn_out_openldap"]
elif serverrole == "domain controller":
tdb_modules_list.insert(0, "repl_meta_data")
"SCHEMADN_MOD2": ",objectguid",
"CONFIGDN": ldb.Dn(schema.ldb, names.configdn).get_casefold(),
"DOMAINDN": ldb.Dn(schema.ldb, names.domaindn).get_casefold(),
- "SCHEMADN_MOD": "schema_fsmo",
+ "SCHEMADN_MOD": "schema_data",
"CONFIGDN_MOD": "naming_fsmo",
"DOMAINDN_MOD": "pdc_fsmo",
"MODULES_LIST": ",".join(modules_list),
lp = param.LoadParm()
lp.load(smbconf)
- names = guess_names(lp=lp, hostname=hostname, domain=domain,
- dnsdomain=realm, serverrole=serverrole, sitename=sitename,
- rootdn=rootdn, domaindn=domaindn, configdn=configdn, schemadn=schemadn,
- serverdn=serverdn)
+ names = guess_names(lp=lp, hostname=hostname, domain=domain,
+ dnsdomain=realm, serverrole=serverrole,
+ domaindn=domaindn, configdn=configdn, schemadn=schemadn,
+ serverdn=serverdn, sitename=sitename)
paths = provision_paths_from_lp(lp, names.dnsdomain)