1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

samba.provision: Fix setup_path.

This commit is contained in:
Jelmer Vernooij 2010-11-28 04:22:46 +01:00
parent 8caac9462a
commit 7c65ab12af
3 changed files with 73 additions and 72 deletions

View File

@ -61,6 +61,7 @@ def drs_DsBind(drs):
return (handle, info.info.supported_extensions)
class drs_Replicate:
'''DRS replication calls'''
@ -71,8 +72,6 @@ class drs_Replicate:
self.samdb = samdb
self.replication_state = self.net.replicate_init(self.samdb, lp, self.drs)
def drs_get_rodc_partial_attribute_set(self):
'''get a list of attributes for RODC replication'''
partial_attribute_set = drsuapi.DsPartialAttributeSet()
@ -110,7 +109,6 @@ class drs_Replicate:
partial_attribute_set.num_attids = len(attids)
return partial_attribute_set
def replicate(self, dn, source_dsa_invocation_id, destination_dsa_guid,
schema=False, exop=drsuapi.DRSUAPI_EXOP_NONE, rodc=False,
replica_flags=None):

View File

@ -87,11 +87,11 @@ def find_setup_dir():
if in_source_tree():
# In source tree
dirname = os.path.dirname(__file__)
return os.path.normpath(os.path.join(dirname, "../../../setup"))
return os.path.normpath(os.path.join(dirname, "../../../../setup"))
else:
import sys
for prefix in [sys.prefix,
os.path.join(os.path.dirname(__file__), "../../../..")]:
os.path.join(os.path.dirname(__file__), "../../../../..")]:
for suffix in ["share/setup", "share/samba/setup", "setup"]:
ret = os.path.normpath(os.path.join(prefix, suffix))
if os.path.isdir(ret):
@ -469,7 +469,7 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None,
for x in netbiosname:
if x.isalnum() or x in VALID_NETBIOS_CHARS:
newnbname = "%s%c" % (newnbname, x)
#force the length to be <16
# force the length to be <16
netbiosname = newnbname[0:15]
assert netbiosname is not None
netbiosname = netbiosname.upper()
@ -780,8 +780,7 @@ def secretsdb_self_join(secretsdb, domain,
# than one record for this SID, realm or netbios domain at a time,
# but we don't delete the old record that we are about to modify,
# because that would delete the keytab and previous password.
res = secretsdb.search(base="cn=Primary Domains",
attrs=attrs,
res = secretsdb.search(base="cn=Primary Domains", attrs=attrs,
expression=("(&(|(flatname=%s)(realm=%s)(objectSid=%s))(objectclass=primaryDomain)(!(dn=%s)))" % (domain, realm, str(domainsid), str(msg.dn))),
scope=ldb.SCOPE_ONELEVEL)
@ -929,8 +928,7 @@ def setup_registry(path, setup_path, session_info, lp):
:param lp: Loadparm context
"""
reg = samba.registry.Registry()
hive = samba.registry.open_ldb(path, session_info=session_info,
lp_ctx=lp)
hive = samba.registry.open_ldb(path, session_info=session_info, lp_ctx=lp)
reg.mount_hive(hive, samba.registry.HKEY_LOCAL_MACHINE)
provision_reg = setup_path("provision.reg")
assert os.path.exists(provision_reg)
@ -970,8 +968,7 @@ def setup_samdb_rootdse(samdb, setup_path, names):
})
def setup_self_join(samdb, names,
machinepass, dnspass,
def setup_self_join(samdb, names, machinepass, dnspass,
domainsid, next_rid, invocationid, setup_path,
policyguid, policyguid_dc, domainControllerFunctionality,
ntdsguid):
@ -1316,6 +1313,7 @@ FILL_DRS = "DRS"
SYSVOL_ACL = "O:LAG:BAD:P(A;OICI;0x001f01ff;;;BA)(A;OICI;0x001200a9;;;SO)(A;OICI;0x001f01ff;;;SY)(A;OICI;0x001200a9;;;AU)"
POLICIES_ACL = "O:LAG:BAD:P(A;OICI;0x001f01ff;;;BA)(A;OICI;0x001200a9;;;SO)(A;OICI;0x001f01ff;;;SY)(A;OICI;0x001200a9;;;AU)(A;OICI;0x001301bf;;;PA)"
def set_dir_acl(path, acl, lp, domsid):
setntacl(lp, path, acl, domsid)
for root, dirs, files in os.walk(path, topdown=False):

View File

@ -113,7 +113,7 @@ class ExistingBackend(ProvisionBackend):
super(ExistingBackend, self).__init__(backend_type=backend_type,
paths=paths, setup_path=setup_path, lp=lp,
credentials=credentials, names=names, logger=logger,
ldap_backend_forced_uri=ldap_backend_forced_uri)
ldap_backend_forced_uri=ldapi_uri)
def init(self):
# Check to see that this 'existing' LDAP backend in fact exists
@ -134,8 +134,8 @@ class LDAPBackend(ProvisionBackend):
def __init__(self, backend_type, paths=None, setup_path=None, lp=None,
credentials=None, names=None, logger=None, domainsid=None,
schema=None, hostname=None, ldapadminpass=None, slapd_path=None,
ldap_backend_extra_port=None,
schema=None, hostname=None, ldapadminpass=None,
slapd_path=None, ldap_backend_extra_port=None,
ldap_backend_forced_uri=None, ldap_dryrun_mode=False):
super(LDAPBackend, self).__init__(backend_type=backend_type,
@ -251,7 +251,8 @@ class LDAPBackend(ProvisionBackend):
ldapi_db = Ldb(self.ldap_uri, lp=self.lp, credentials=self.credentials)
ldapi_db.search(base="", scope=SCOPE_BASE,
expression="(objectClass=OpenLDAProotDSE)")
# If we have got here, then we must have a valid connection to the LDAP server!
# If we have got here, then we must have a valid connection to
# the LDAP server!
return
except LdbError:
time.sleep(1)
@ -269,7 +270,7 @@ class LDAPBackend(ProvisionBackend):
# and check its proper termination
if self.slapd.poll() is None:
# Kill the slapd
if hasattr(self.slapd, "terminate"):
if getattr(self.slapd, "terminate", None) is not None:
self.slapd.terminate()
else:
# Older python versions don't have .terminate()
@ -332,7 +333,8 @@ class OpenLDAPBackend(LDAPBackend):
# Wipe the directories so we can start
shutil.rmtree(os.path.join(self.ldapdir, "db"), True)
#Allow the test scripts to turn off fsync() for OpenLDAP as for TDB and LDB
# Allow the test scripts to turn off fsync() for OpenLDAP as for TDB
# and LDB
nosync_config = ""
if self.nosync:
nosync_config = "dbnosync"
@ -586,16 +588,19 @@ class FDSBackend(LDAPBackend):
self.sambadn = "CN=Samba"
self.fedoradsinf = os.path.join(self.ldapdir, "fedorads.inf")
self.partitions_ldif = os.path.join(self.ldapdir, "fedorads-partitions.ldif")
self.partitions_ldif = os.path.join(self.ldapdir,
"fedorads-partitions.ldif")
self.sasl_ldif = os.path.join(self.ldapdir, "fedorads-sasl.ldif")
self.dna_ldif = os.path.join(self.ldapdir, "fedorads-dna.ldif")
self.pam_ldif = os.path.join(self.ldapdir, "fedorads-pam.ldif")
self.refint_ldif = os.path.join(self.ldapdir, "fedorads-refint.ldif")
self.linked_attrs_ldif = os.path.join(self.ldapdir, "fedorads-linked-attributes.ldif")
self.linked_attrs_ldif = os.path.join(self.ldapdir,
"fedorads-linked-attributes.ldif")
self.index_ldif = os.path.join(self.ldapdir, "fedorads-index.ldif")
self.samba_ldif = os.path.join(self.ldapdir, "fedorads-samba.ldif")
self.samba3_schema = self.setup_path("../../examples/LDAP/samba.schema")
self.samba3_schema = self.setup_path(
"../../examples/LDAP/samba.schema")
self.samba3_ldif = os.path.join(self.ldapdir, "samba3.ldif")
self.retcode = subprocess.call(["bin/oLschema2ldif",