s.upgradehelpers : module documentation

Part of samba

Helpers used for upgrading between different database formats.
Class ProvisionLDB Undocumented
Function get_ldbs Return LDB object mapped on most important databases
Function usn_in_range Check if the usn is in one of the range provided. To do so, the value is checked to be between the lower bound and higher bound of a range
Function get_paths Get paths to important provision objects (smb.conf, ldb files, ...)
Function update_policyids Update policy ids that could have changed after sam update
Function newprovision Create a new provision.
Function dn_sort Sorts two DNs in the lexicographical order it and put higher level DN before.
Function identic_rename Perform a back and forth rename to trigger renaming on attribute that can't be directly modified.
Function chunck_acl Return separate ACE of an ACL
Function chunck_sddl Return separate parts of the SDDL (owner, group, ...)
Function get_diff_sddls Get the difference between 2 sddl
Function update_secrets Update secrets.ldb
Function getOEMInfo Return OEM Information on the top level Samba4 use to store version info in this field
Function updateOEMInfo Update the OEMinfo field to add information about upgrade
Function update_gpo Create missing GPO file object if needed
Function increment_calculated_keyversion_number No summary
Function delta_update_basesamdb Update the provision container db: sam.ldb This function is aimed for alpha9 and newer;
Function construct_existor_expr Construct a exists or LDAP search expression.
Function update_machine_account_password Update (change) the password of the current DC both in the SAM db and in secret one
Function update_dns_account_password Update (change) the password of the dns both in the SAM db and in secret one
Function search_constructed_attrs_stored Search a given sam DB for calculated attributes that are still stored in the db.
Function int64range2str Display the int64 range stored in value as xxx-yyy
def get_ldbs(paths, creds, session, lp):
Return LDB object mapped on most important databases
ParameterspathsAn object holding the different importants paths for provision object
credsCredential used for openning LDB files
sessionSession to use for openning LDB files
lpA loadparam object
ReturnsA ProvisionLDB object that contains LDB object for the different LDB files of the provision
def usn_in_range(usn, range):
Check if the usn is in one of the range provided. To do so, the value is checked to be between the lower bound and higher bound of a range
ParametersusnA integer value corresponding to the usn that we want to update
rangeA list of integer representing ranges, lower bounds are in the even indices, higher in odd indices
ReturnsTrue if the usn is in one of the range, False otherwise
def get_paths(param, targetdir=None, smbconf=None):
Get paths to important provision objects (smb.conf, ldb files, ...)
ParametersparamParam object
targetdirDirectory where the provision is (or will be) stored
smbconfPath to the smb.conf file
ReturnsA list with the path of important provision objects
def update_policyids(names, samdb):
Update policy ids that could have changed after sam update
ParametersnamesList of key provision parameters
samdbAn Ldb object conntected with the sam DB
def newprovision(names, creds, session, smbconf, provdir, logger):
Create a new provision.

This provision will be the reference for knowing what has changed in the since the latest upgrade in the current provision

ParametersnamesList of provision parameters
credsCredentials for the authentification
sessionSession object
smbconfPath to the smb.conf file
provdirDirectory where the provision will be stored
loggerA Logger
def dn_sort(x, y):
Sorts two DNs in the lexicographical order it and put higher level DN before.

So given the dns cn=bar,cn=foo and cn=foo the later will be return as smaller

ParametersxFirst object to compare
ySecond object to compare
def identic_rename(ldbobj, dn):
Perform a back and forth rename to trigger renaming on attribute that can't be directly modified.
ParameterslbdobjAn Ldb Object
dnDN of the object to manipulate
def chunck_acl(acl):
Return separate ACE of an ACL
ParametersaclA string representing the ACL
ReturnsA hash with different parts
def chunck_sddl(sddl):
Return separate parts of the SDDL (owner, group, ...)
ParameterssddlAn string containing the SDDL to chunk
ReturnsA hash with the different chunk
def get_diff_sddls(refsddl, cursddl, checkSacl=True):
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

ParametersrefsddlFirst sddl to compare
cursddlSecond sddl to compare
checkSaclIf false we skip the sacl checks
ReturnsA string that explain difference between sddls
def update_secrets(newsecrets_ldb, secrets_ldb, messagefunc):
Update secrets.ldb
Parametersnewsecrets_ldbAn LDB object that is connected to the secrets.ldb of the reference provision
secrets_ldbAn LDB object that is connected to the secrets.ldb of the updated provision
def getOEMInfo(samdb, rootdn):
Return OEM Information on the top level Samba4 use to store version info in this field
ParameterssamdbAn LDB object connect to sam.ldb
rootdnRoot DN of the domain
ReturnsThe content of the field oEMInformation (if any)
def updateOEMInfo(samdb, rootdn):
Update the OEMinfo field to add information about upgrade
Parameterssamdban LDB object connected to the sam DB
rootdnThe string representation of the root DN of the provision (ie. DC=...,DC=...)
def update_gpo(paths, samdb, names, lp, message, force=0):
Create missing GPO file object if needed

Set ACL correctly also. Check ACLs for sysvol/netlogon dirs also

def increment_calculated_keyversion_number(samdb, rootdn, hashDns):
For a given hash associating dn and a number, this function will update the replPropertyMetaData of each dn in the hash, so that the calculated value of the msDs-KeyVersionNumber is equal or superior to the one associated to the given dn.
ParameterssamdbAn SamDB object pointing to the sam
rootdnThe base DN where we want to start
hashDnsA hash with dn as key and number representing the minimum value of msDs-KeyVersionNumber that we want to have
def delta_update_basesamdb(refsampath, sampath, creds, session, lp, message):
Update the provision container db: sam.ldb This function is aimed for alpha9 and newer;
ParametersrefsampathPath to the samdb in the reference provision
sampathPath to the samdb in the upgraded provision
credsCredential used for openning LDB files
sessionSession to use for openning LDB files
lpA loadparam object
ReturnsA msg_diff object with the difference between the @ATTRIBUTES of the current provision and the reference provision
def construct_existor_expr(attrs):
Construct a exists or LDAP search expression.
ParametersattrsList of attribute on which we want to create the search expression.
ReturnsA string representing the expression, if attrs is empty an empty string is returned
def update_machine_account_password(samdb, secrets_ldb, names):
Update (change) the password of the current DC both in the SAM db and in
secret one
ParameterssamdbAn LDB object related to the sam.ldb file of a given provision
secrets_ldbAn LDB object related to the secrets.ldb file of a given provision
namesList of key provision parameters
def update_dns_account_password(samdb, secrets_ldb, names):
Update (change) the password of the dns both in the SAM db and in
secret one
ParameterssamdbAn LDB object related to the sam.ldb file of a given provision
secrets_ldbAn LDB object related to the secrets.ldb file of a given provision
namesList of key provision parameters
def search_constructed_attrs_stored(samdb, rootdn, attrs):
Search a given sam DB for calculated attributes that are still stored in the db.
ParameterssamdbAn LDB object pointing to the sam
rootdnThe base DN where the search should start
attrsA list of attributes to be searched
ReturnsA hash with attributes as key and an array of array. Each array contains the dn and the associated values for this attribute as they are stored in the sam.
def int64range2str(value):
Display the int64 range stored in value as xxx-yyy
ParametersvalueThe int64 range
ReturnsA string of the representation of the range
API Documentation for Samba, generated by pydoctor at 2012-03-06 23:17:58.