mirror of
https://github.com/samba-team/samba.git
synced 2025-07-06 08:59:08 +03:00
s4-python: Fix formatting of docstrings for the purpose of pydoctor.
This commit is contained in:
@ -235,7 +235,7 @@ def update_policyids(names, samdb):
|
||||
scope=SCOPE_ONELEVEL, attrs=["cn","displayName"])
|
||||
names.policyid = str(res[0]["cn"]).replace("{","").replace("}","")
|
||||
# dc policy guid
|
||||
res2 = samdb.search(expression="(displayName=Default Domain Controllers" \
|
||||
res2 = samdb.search(expression="(displayName=Default Domain Controllers"
|
||||
" Policy)",
|
||||
base="CN=Policies,CN=System," + str(names.rootdn),
|
||||
scope=SCOPE_ONELEVEL, attrs=["cn","displayName"])
|
||||
@ -267,7 +267,7 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf, lp)
|
||||
names.realm = string.upper(names.realm)
|
||||
# netbiosname
|
||||
# Get the netbiosname first (could be obtained from smb.conf in theory)
|
||||
res = secretsdb.search(expression="(flatname=%s)" % \
|
||||
res = secretsdb.search(expression="(flatname=%s)" %
|
||||
names.domain,base="CN=Primary Domains",
|
||||
scope=SCOPE_SUBTREE, attrs=["sAMAccountName"])
|
||||
names.netbiosname = str(res[0]["sAMAccountName"]).replace("$","")
|
||||
@ -333,7 +333,7 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf, lp)
|
||||
scope=SCOPE_ONELEVEL, attrs=["cn","displayName"])
|
||||
names.policyid = str(res7[0]["cn"]).replace("{","").replace("}","")
|
||||
# dc policy guid
|
||||
res8 = samdb.search(expression="(displayName=Default Domain Controllers" \
|
||||
res8 = samdb.search(expression="(displayName=Default Domain Controllers"
|
||||
" Policy)",
|
||||
base="CN=Policies,CN=System," + basedn,
|
||||
scope=SCOPE_ONELEVEL, attrs=["cn","displayName"])
|
||||
@ -341,7 +341,7 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf, lp)
|
||||
names.policyid_dc = str(res8[0]["cn"]).replace("{","").replace("}","")
|
||||
else:
|
||||
names.policyid_dc = None
|
||||
res9 = idmapdb.search(expression="(cn=%s)" % \
|
||||
res9 = idmapdb.search(expression="(cn=%s)" %
|
||||
(security.SID_BUILTIN_ADMINISTRATORS),
|
||||
attrs=["xidNumber"])
|
||||
if len(res9) == 1:
|
||||
@ -358,12 +358,12 @@ def newprovision(names, setup_dir, creds, session, smbconf, provdir, logger):
|
||||
since the latest upgrade in the current provision
|
||||
|
||||
:param names: List of provision parameters
|
||||
:param setup_dis: Directory where the setup files are stored
|
||||
:param setup_dir: Directory where the setup files are stored
|
||||
:param creds: Credentials for the authentification
|
||||
:param session: Session object
|
||||
:param smbconf: Path to the smb.conf file
|
||||
:param provdir: Directory where the provision will be stored
|
||||
:param logger: A `Logger`
|
||||
:param logger: A Logger
|
||||
"""
|
||||
if os.path.isdir(provdir):
|
||||
shutil.rmtree(provdir)
|
||||
@ -472,14 +472,17 @@ def chunck_sddl(sddl):
|
||||
|
||||
return hash
|
||||
|
||||
|
||||
def get_diff_sddls(refsddl, cursddl):
|
||||
"""Get the difference between 2 sddl
|
||||
This function split the textual representation of ACL into smaller
|
||||
chunck in order to not to report a simple permutation as a difference
|
||||
|
||||
:param refsddl: First sddl to compare
|
||||
:param cursddl: Second sddl to compare
|
||||
:return: A string that explain difference between sddls"""
|
||||
This function split the textual representation of ACL into smaller
|
||||
chunck in order to not to report a simple permutation as a difference
|
||||
|
||||
:param refsddl: First sddl to compare
|
||||
:param cursddl: Second sddl to compare
|
||||
:return: A string that explain difference between sddls
|
||||
"""
|
||||
|
||||
txt = ""
|
||||
hash_new = chunck_sddl(cursddl)
|
||||
@ -537,9 +540,9 @@ def update_secrets(newsecrets_ldb, secrets_ldb, messagefunc):
|
||||
"""Update secrets.ldb
|
||||
|
||||
:param newsecrets_ldb: An LDB object that is connected to the secrets.ldb
|
||||
of the reference provision
|
||||
of the reference provision
|
||||
:param secrets_ldb: An LDB object that is connected to the secrets.ldb
|
||||
of the updated provision
|
||||
of the updated provision
|
||||
"""
|
||||
|
||||
messagefunc(SIMPLE, "update secrets.ldb")
|
||||
@ -590,7 +593,7 @@ def update_secrets(newsecrets_ldb, secrets_ldb, messagefunc):
|
||||
delta = secrets_ldb.msg_diff(empty, reference[0])
|
||||
for att in hashAttrNotCopied.keys():
|
||||
delta.remove(att)
|
||||
messagefunc(CHANGE, "Entry %s is missing from secrets.ldb" % \
|
||||
messagefunc(CHANGE, "Entry %s is missing from secrets.ldb" %
|
||||
reference[0].dn)
|
||||
for att in delta:
|
||||
messagefunc(CHANGE, " Adding attribute %s" % att)
|
||||
@ -607,7 +610,7 @@ def update_secrets(newsecrets_ldb, secrets_ldb, messagefunc):
|
||||
delta.remove(att)
|
||||
for att in delta:
|
||||
if att == "name":
|
||||
messagefunc(CHANGE, "Found attribute name on %s," \
|
||||
messagefunc(CHANGE, "Found attribute name on %s,"
|
||||
" must rename the DN" % (current[0].dn))
|
||||
identic_rename(secrets_ldb, reference[0].dn)
|
||||
else:
|
||||
@ -626,7 +629,7 @@ def update_secrets(newsecrets_ldb, secrets_ldb, messagefunc):
|
||||
delta.remove(att)
|
||||
if att != "dn":
|
||||
messagefunc(CHANGE,
|
||||
"Adding/Changing attribute %s to %s" % \
|
||||
"Adding/Changing attribute %s to %s" %
|
||||
(att, current[0].dn))
|
||||
|
||||
delta.dn = current[0].dn
|
||||
@ -639,13 +642,15 @@ def update_secrets(newsecrets_ldb, secrets_ldb, messagefunc):
|
||||
messagefunc(SIMPLE, "Remove old dns account")
|
||||
secrets_ldb.delete(res2[0]["dn"])
|
||||
|
||||
|
||||
def getOEMInfo(samdb, rootdn):
|
||||
"""Return OEM Information on the top level
|
||||
Samba4 use to store version info in this field
|
||||
"""Return OEM Information on the top level Samba4 use to store version
|
||||
info in this field
|
||||
|
||||
:param samdb: An LDB object connect to sam.ldb
|
||||
:param rootdn: Root DN of the domain
|
||||
:return: The content of the field oEMInformation (if any)"""
|
||||
:return: The content of the field oEMInformation (if any)
|
||||
"""
|
||||
res = samdb.search(expression="(objectClass=*)", base=str(rootdn),
|
||||
scope=SCOPE_BASE, attrs=["dn", "oEMInformation"])
|
||||
if len(res) > 0:
|
||||
@ -654,11 +659,13 @@ def getOEMInfo(samdb, rootdn):
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def updateOEMInfo(samdb, rootdn):
|
||||
"""Update the OEMinfo field to add information about upgrade
|
||||
:param samdb: an LDB object connected to the sam DB
|
||||
:param rootdn: The string representation of the root DN of
|
||||
the provision (ie. DC=...,DC=...)
|
||||
|
||||
:param samdb: an LDB object connected to the sam DB
|
||||
:param rootdn: The string representation of the root DN of
|
||||
the provision (ie. DC=...,DC=...)
|
||||
"""
|
||||
res = samdb.search(expression="(objectClass=*)", base=rootdn,
|
||||
scope=SCOPE_BASE, attrs=["dn", "oEMInformation"])
|
||||
@ -803,14 +810,15 @@ def delta_update_basesamdb(refsampath, sampath, creds, session, lp, message):
|
||||
|
||||
return deltaattr
|
||||
|
||||
|
||||
def construct_existor_expr(attrs):
|
||||
"""Construct a exists or LDAP search expression.
|
||||
ie (|(foo=*)(bar=*)
|
||||
|
||||
:param attrs: List of attribute on which we want to create the search
|
||||
expression.
|
||||
expression.
|
||||
:return: A string representing the expression, if attrs is empty an
|
||||
empty string is returned"""
|
||||
empty string is returned
|
||||
"""
|
||||
expr = ""
|
||||
if len(attrs) > 0:
|
||||
expr = "(|"
|
||||
|
Reference in New Issue
Block a user