return ndr_pack(sec)
-def get_empty_descriptor(domain_sid, name_map={}):
+def get_empty_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = ""
return sddl2binary(sddl, domain_sid, name_map)
# "get_schema_descriptor" is located in "schema.py"
-def get_config_descriptor(domain_sid, name_map={}):
+def get_config_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "O:EAG:EAD:(OA;;CR;1131f6aa-9c07-11d1-f79f-00c04fc2dcd2;;ED)" \
"(OA;;CR;1131f6ab-9c07-11d1-f79f-00c04fc2dcd2;;ED)" \
"(OA;;CR;1131f6ac-9c07-11d1-f79f-00c04fc2dcd2;;ED)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_config_partitions_descriptor(domain_sid, name_map={}):
+def get_config_partitions_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "D:" \
"(A;;LCLORC;;;AU)" \
"(OA;;RP;e48d0154-bcf8-11d1-8702-00c04fb96050;;AU)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_config_sites_descriptor(domain_sid, name_map={}):
+def get_config_sites_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "D:" \
"(A;;RPLCLORC;;;AU)" \
"(OA;CIIO;SW;d31a8757-2447-4545-8081-3bb610cacbf2;f0f8ffab-1191-11d0-a060-00aa006c33ed;RO)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_config_ntds_quotas_descriptor(domain_sid, name_map={}):
+def get_config_ntds_quotas_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "D:" \
"(A;;RPWPCRCCDCLCLORCWOWDSDDTSW;;;EA)" \
"(A;;RPLCLORC;;;BA)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_config_delete_protected1_descriptor(domain_sid, name_map={}):
+def get_config_delete_protected1_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "D:AI" \
"(A;;RPLCLORC;;;AU)" \
"(A;;RPWPCRCCLCLORCWOWDSW;;;EA)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_config_delete_protected1wd_descriptor(domain_sid, name_map={}):
+def get_config_delete_protected1wd_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "D:AI" \
"(A;;RPLCLORC;;;WD)" \
"(A;;RPWPCRCCLCLORCWOWDSW;;;EA)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_config_delete_protected2_descriptor(domain_sid, name_map={}):
+def get_config_delete_protected2_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "D:AI" \
"(A;;RPLCLORC;;;AU)" \
"(A;;RPWPCRCCDCLCLORCWOWDSW;;;EA)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_domain_descriptor(domain_sid, name_map={}):
+def get_domain_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "O:BAG:BAD:AI(OA;CIIO;RP;4c164200-20c0-11d0-a768-00aa006e0529;4828cc14-1437-45bc-9b07-ad6f015e5f28;RU)" \
"(OA;CIIO;RP;4c164200-20c0-11d0-a768-00aa006e0529;bf967aba-0de6-11d0-a285-00aa003049e2;RU)" \
"(OA;CIIO;RP;5f202010-79a5-11d0-9020-00c04fc2d4cf;4828cc14-1437-45bc-9b07-ad6f015e5f28;RU)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_domain_infrastructure_descriptor(domain_sid, name_map={}):
+def get_domain_infrastructure_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "D:" \
"(A;;RPLCLORC;;;AU)" \
"(A;;RPWPCRCCLCLORCWOWDSW;;;DA)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_domain_builtin_descriptor(domain_sid, name_map={}):
+def get_domain_builtin_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "D:" \
"(OA;CIIO;RP;4c164200-20c0-11d0-a768-00aa006e0529;4828cc14-1437-45bc-9b07-ad6f015e5f28;RU)" \
"(OA;CIIO;RP;4c164200-20c0-11d0-a768-00aa006e0529;bf967aba-0de6-11d0-a285-00aa003049e2;RU)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_domain_computers_descriptor(domain_sid, name_map={}):
+def get_domain_computers_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "D:" \
"(A;;RPWPCRCCDCLCLORCWOWDSDDTSW;;;SY)" \
"(A;;RPWPCRCCDCLCLORCWOWDSW;;;DA)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_domain_users_descriptor(domain_sid, name_map={}):
+def get_domain_users_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "D:" \
"(A;;RPWPCRCCDCLCLORCWOWDSDDTSW;;;SY)" \
"(A;;RPWPCRCCDCLCLORCWOWDSW;;;DA)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_managed_service_accounts_descriptor(domain_sid, name_map={}):
+def get_managed_service_accounts_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "D:" \
"(A;;RPWPCRCCDCLCLORCWOWDSDDTSW;;;SY)" \
"(A;;RPWPCRCCDCLCLORCWOWDSW;;;DA)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_domain_controllers_descriptor(domain_sid, name_map={}):
+def get_domain_controllers_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "D:" \
"(A;;RPLCLORC;;;AU)" \
"(A;;RPWPCRCCLCLORCWOWDSW;;;DA)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_domain_delete_protected1_descriptor(domain_sid, name_map={}):
+def get_domain_delete_protected1_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "D:AI" \
"(A;;RPLCLORC;;;AU)" \
"(A;;RPWPCRCCLCLORCWOWDSW;;;DA)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_domain_delete_protected2_descriptor(domain_sid, name_map={}):
+def get_domain_delete_protected2_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "D:AI" \
"(A;;RPLCLORC;;;AU)" \
"(A;;RPWPCRCCDCLCLORCWOWDSW;;;DA)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_dns_partition_descriptor(domain_sid, name_map={}):
+def get_dns_partition_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "O:SYG:BAD:AI" \
"(OA;CIIO;RP;4c164200-20c0-11d0-a768-00aa006e0529;4828cc14-1437-45bc-9b07-ad6f015e5f28;RU)" \
"(OA;CIIO;RP;4c164200-20c0-11d0-a768-00aa006e0529;bf967aba-0de6-11d0-a285-00aa003049e2;RU)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_dns_forest_microsoft_dns_descriptor(domain_sid, name_map={}):
+def get_dns_forest_microsoft_dns_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "O:SYG:SYD:AI" \
"(A;;RPWPCRCCDCLCLORCWOWDSDDTSW;;;SY)" \
"(A;CI;RPWPCRCCDCLCRCWOWDSDDTSW;;;ED)"
return sddl2binary(sddl, domain_sid, name_map)
-def get_dns_domain_microsoft_dns_descriptor(domain_sid, name_map={}):
+def get_dns_domain_microsoft_dns_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "O:SYG:SYD:AI" \
"(A;;RPWPCRCCDCLCLORCWOWDSDDTSW;;;DA)" \
"(A;CI;RPWPCRCCDCLCRCWOWDSDDTSW;;;DnsAdmins)" \
return sddl2binary(sddl, domain_sid, name_map)
-def get_paritions_crossref_subdomain_descriptor(domain_sid, name_map={}):
+def get_paritions_crossref_subdomain_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "O:SubdomainAdminsG:SubdomainAdminsD:AI" \
"(A;;RPWPCRCCLCLORCWOWDSW;;;SubdomainAdmins)" \
"(A;;RPLCLORC;;;AU)" \
self.cumulative_duration = 0.0
self.packet_rate = [0, 1]
- def learn(self, conversations, dns_opcounts={}):
+ def learn(self, conversations, dns_opcounts=None):
+ if dns_opcounts is None:
+ dns_opcounts = {}
prev = 0.0
cum_duration = 0.0
key = (NON_PACKET,) * (self.n - 1)
result.append(data)
return result
-def fetch_template_attrs(ldb, name, attrs=['msPKI-Minimal-Key-Size']):
+def fetch_template_attrs(ldb, name, attrs=None):
+ if attrs is None:
+ attrs = ['msPKI-Minimal-Key-Size']
basedn = ldb.get_default_basedn()
dn = 'CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,%s' % basedn
expr = '(cn=%s)' % name
'''
pass
- def clean(self, guid, keep=[], remove=[], **kwargs):
+ def clean(self, guid, keep=None, remove=None, **kwargs):
'''Cleanup old removed attributes
keep - A list of attributes to keep
remove - A single attribute to remove, or a list of attributes to
'''
# Clean syntax is, either provide a single remove attribute,
# or a list of either removal attributes or keep attributes.
+ if keep is None:
+ keep = []
+ if remove is None:
+ remove = []
+
if type(remove) != list:
value = self.cache_get_attribute_value(guid, remove)
if value is not None:
'''
Structured log message class
'''
- def __init__(self, message, kwargs=dict()):
+ def __init__(self, message, kwargs=None):
+ if kwargs is None:
+ kwargs = {}
self.message = message
self.kwargs = kwargs
if not isinstance(self.kwargs, dict):
class log(object):
@staticmethod
- def info(message, data={}):
+ def info(message, data=None):
+ if data is None:
+ data = {}
msg = message_with_code('I', message)
logger.info(slogm(msg, data))
return msg
@staticmethod
- def warning(message, data={}):
+ def warning(message, data=None):
+ if data is None:
+ data = {}
msg = message_with_code('W', message)
logger.warning(slogm(msg, data))
return msg
@staticmethod
- def warn(message, data={}):
+ def warn(message, data=None):
+ if data is None:
+ data = {}
return log.warning(message, data)
@staticmethod
- def error(message, data={}):
+ def error(message, data=None):
+ if data is None:
+ data = {}
msg = message_with_code('E', message)
logger.error(slogm(msg, data))
return msg
@staticmethod
- def fatal(message, data={}):
+ def fatal(message, data=None):
+ if data is None:
+ data = {}
msg = message_with_code('F', message)
logger.fatal(slogm(msg, data))
return msg
@staticmethod
- def debug(message, data={}):
+ def debug(message, data=None):
+ if data is None:
+ data = {}
msg = message_with_code('D', message)
logger.debug(slogm(msg, data))
return msg
return vmap, replacements
-def compile_graph_key(key_items, nodes_above=[], elisions=None,
+def compile_graph_key(key_items, nodes_above=None, elisions=None,
prefix='key_', width=2):
"""Generate a dot file snippet that acts as a legend for a graph.
(True) or edge (False). Style is a dot style string for the edge
or vertex. label is the text associated with the key item.
"""
+ if nodes_above is None:
+ nodes_above = []
edge_lines = []
edge_names = []
vertex_lines = []
quick_membership_checks=False,
reset_well_known_acls=False,
selftest_check_expired_tombstones=False,
- yes_rules=[]):
+ yes_rules=None):
+
+ if yes_rules is None:
+ yes_rules = []
lp = sambaopts.get_loadparm()
"DnssrvUpdateRecord2"}:
return attr
- def f(*args, messages={}):
+ def f(*args, messages=None):
+ if messages is None:
+ messages = {}
+
try:
return attr(*args)
except WERRORError as e:
def run(self, domain=None, sambaopts=None, localdcopts=None, versionopts=None,
refresh=None, enable_all=False,
- enable_tln=[], disable_tln=[], add_tln_ex=[], delete_tln_ex=[],
- enable_sid_str=[], disable_sid_str=[], enable_nb=[], disable_nb=[],
- add_upn=[], delete_upn=[], add_spn=[], delete_spn=[]):
+ enable_tln=None, disable_tln=None, add_tln_ex=None, delete_tln_ex=None,
+ enable_sid_str=None, disable_sid_str=None, enable_nb=None, disable_nb=None,
+ add_upn=None, delete_upn=None, add_spn=None, delete_spn=None):
+
+ if enable_tln is None:
+ enable_tln = []
+ if disable_tln is None:
+ disable_tln = []
+ if add_tln_ex is None:
+ add_tln_ex = []
+ if delete_tln_ex is None:
+ delete_tln_ex = []
+ if enable_sid_str is None:
+ enable_sid_str = []
+ if disable_sid_str is None:
+ disable_sid_str = []
+ if enable_nb is None:
+ enable_nb = []
+ if disable_nb is None:
+ disable_nb = []
+ if add_upn is None:
+ add_upn = []
+ if delete_upn is None:
+ delete_upn = []
+ if add_spn is None:
+ add_spn = []
+ if delete_spn is None:
+ delete_spn = []
require_update = False
]
def run(self, gpo, H=None, content=None,
- machine_exts=['{35378EAC-683F-11D2-A89A-00C04FBBCFA2}'],
- user_exts=['{35378EAC-683F-11D2-A89A-00C04FBBCFA2}'],
+ machine_exts=None,
+ user_exts=None,
replace=False, sambaopts=None, credopts=None, versionopts=None):
+ if machine_exts is None:
+ machine_exts = ['{35378EAC-683F-11D2-A89A-00C04FBBCFA2}']
+ if user_exts is None:
+ user_exts = ['{35378EAC-683F-11D2-A89A-00C04FBBCFA2}']
if content is None:
policy_defs = json.loads(sys.stdin.read())
elif os.path.exists(content):
help="A user extension name to remove from gPCUserExtensionNames")
]
- def run(self, gpo, H=None, content=None, machine_exts=[], user_exts=[],
+ def run(self, gpo, H=None, content=None, machine_exts=None, user_exts=None,
sambaopts=None, credopts=None, versionopts=None):
+ if machine_exts is None:
+ machine_exts = []
+ if user_exts is None:
+ user_exts = []
if content is None:
policy_defs = json.loads(sys.stdin.read())
elif os.path.exists(content):
return os.path.join(setup_dir(), file)
-def setup_add_ldif(ldb, ldif_path, subst_vars=None, controls=["relax:0"]):
+def setup_add_ldif(ldb, ldif_path, subst_vars=None, controls=None):
"""Setup a ldb in the private dir.
:param ldb: LDB file to import data into
:param subst_vars: Optional variables to subsitute in LDIF.
:param nocontrols: Optional list of controls, can be None for no controls
"""
+ if controls is None:
+ controls = ["relax:0"]
assert isinstance(ldif_path, str)
data = read_and_sub_file(ldif_path, subst_vars)
ldb.add_ldif(data, controls)
-def setup_modify_ldif(ldb, ldif_path, subst_vars=None, controls=["relax:0"]):
+def setup_modify_ldif(ldb, ldif_path, subst_vars=None, controls=None):
"""Modify a ldb in the private dir.
:param ldb: LDB object.
:param ldif_path: LDIF file path.
:param subst_vars: Optional dictionary with substitution variables.
"""
+ if controls is None:
+ controls = ["relax:0"]
data = read_and_sub_file(ldif_path, subst_vars)
ldb.modify_ldif(data, controls)
def add_remove_group_members(self, groupname, members,
add_members_operation=True,
- member_types=[ 'user', 'group', 'computer' ],
+ member_types=None,
member_base_dn=None):
"""Adds or removes group members
:param add_members_operation: Defines if its an add or remove
operation
"""
+ if member_types is None:
+ member_types = ['user', 'group', 'computer']
groupfilter = "(&(sAMAccountName=%s)(objectCategory=%s,%s))" % (
ldb.binary_encode(groupname), "CN=Group,CN=Schema,CN=Configuration", self.domain_dn())
msg.add(el)
def fullname_from_names(self, given_name=None, initials=None, surname=None,
- old_attrs={}, fallback_default=""):
+ old_attrs=None, fallback_default=""):
"""Prepares new combined fullname, using the name parts.
Used for things like displayName or cn.
Use the original name values, if no new one is specified."""
+ if old_attrs is None:
+ old_attrs = {}
attrs = {"givenName": given_name,
"initials": initials,
from ldb import SCOPE_SUBTREE, SCOPE_ONELEVEL
-def get_schema_descriptor(domain_sid, name_map={}):
+def get_schema_descriptor(domain_sid, name_map=None):
+ if name_map is None:
+ name_map = {}
+
sddl = "O:SAG:SAD:AI(OA;;CR;e12b56b6-0a95-11d1-adbb-00c04fd8d5cd;;SA)" \
"(OA;;CR;1131f6aa-9c07-11d1-f79f-00c04fc2dcd2;;ED)" \
"(OA;;CR;1131f6ab-9c07-11d1-f79f-00c04fc2dcd2;;ED)" \
desc_sddl = desc_sddl + ace
self.modify_sd_on_dn(object_dn, desc_sddl, ["show_deleted:1"])
- def get_sd_as_sddl(self, object_dn, controls=[]):
+ def get_sd_as_sddl(self, object_dn, controls=None):
"""Return object nTSecutiryDescriptor in SDDL format
"""
+ if controls is None:
+ controls = []
desc = self.read_sd_on_dn(object_dn, controls + ["show_deleted:1"])
return desc.as_sddl(self.domain_sid)
self.filename = self.tempfile.name
self.ldb = samba.Ldb(self.filename)
- def set_modules(self, modules=[]):
+ def set_modules(self, modules=None):
"""Change the modules for this Ldb."""
+ if modules is None:
+ modules = []
m = ldb.Message()
m.dn = ldb.Dn(self.ldb, "@MODULES")
m["@LIST"] = ",".join(modules)
rpc_vers_minor=0,
pfc_flags=(samba.dcerpc.dcerpc.DCERPC_PFC_FLAG_FIRST |
samba.dcerpc.dcerpc.DCERPC_PFC_FLAG_LAST),
- drep=[samba.dcerpc.dcerpc.DCERPC_DREP_LE, 0, 0, 0],
+ drep=None,
ndr_print=None, hexdump=None):
+ if drep is None:
+ drep = [samba.dcerpc.dcerpc.DCERPC_DREP_LE, 0, 0, 0]
if getattr(payload, 'auth_info', None):
ai = payload.auth_info
else:
rpc_vers_minor=0,
pfc_flags=(samba.dcerpc.dcerpc.DCERPC_PFC_FLAG_FIRST |
samba.dcerpc.dcerpc.DCERPC_PFC_FLAG_LAST),
- drep=[samba.dcerpc.dcerpc.DCERPC_DREP_LE, 0, 0, 0],
+ drep=None,
auth_length=None):
+ if drep is None:
+ drep = [samba.dcerpc.dcerpc.DCERPC_DREP_LE, 0, 0, 0]
self.assertIsNotNone(p, "No valid pdu")
if getattr(p.u, 'auth_info', None):
max_xmit_frag=None,
max_recv_frag=None,
assoc_group_id=0,
- ctx_list=[],
+ ctx_list=None,
auth_info=b"",
ndr_print=None, hexdump=None):
+ if ctx_list is None:
+ ctx_list = []
if max_xmit_frag is None:
max_xmit_frag=self.max_xmit_frag
if max_recv_frag is None:
max_xmit_frag=None,
max_recv_frag=None,
assoc_group_id=0,
- ctx_list=[],
+ ctx_list=None,
auth_info=b"",
ndr_print=None, hexdump=None):
+ if ctx_list is None:
+ ctx_list = []
if max_xmit_frag is None:
max_xmit_frag=self.max_xmit_frag
if max_recv_frag is None:
Aging=int(bool(enable)),
AllowUpdate=dnsp.DNS_ZONE_UPDATE_UNSECURE)
- def test_set_aging(self, enable=True, name='agingtest', txt=['test txt']):
+ def test_set_aging(self, enable=True, name='agingtest', txt=None):
+ if txt is None:
+ txt = ['test txt']
self.set_aging(enable=True)
settings = self.ldap_get_zone_settings()
self.assertTrue(settings['aging_state'] is not None)
self.ldapcmp(self.prov_dir, self.extract_dir)
- def ldapcmp(self, prov_dir, ex_dir, args=[]):
+ def ldapcmp(self, prov_dir, ex_dir, args=None):
+ if args is None:
+ args = []
sam_fn = os.path.join("private", "sam.ldb")
url1 = "tdb://" + os.path.join(os.path.realpath(prov_dir), sam_fn)
url2 = "tdb://" + os.path.join(os.path.realpath(ex_dir), sam_fn)
self.sites[dn] = name
return dn, name.lower()
- def _add_site_link(self, name, links=[], cost=100):
+ def _add_site_link(self, name, links=None, cost=100):
+ if links is None:
+ links = []
dn = "CN={0},CN=IP,CN=Inter-Site Transports,CN=Sites,{1}".format(
name, self.samdb.get_config_basedn()
)
self.assertCmdSuccess(result, out, err,
"Failed to delete ou '%s'" % parentou["name"])
- def _randomComputer(self, base={}):
+ def _randomComputer(self, base=None):
"""create a computer with random attribute values, you can specify base
attributes"""
+ if base is None:
+ base = {}
computer = {
"name": self.randomName(),
computer.update(base)
return computer
- def _randomOU(self, base={}):
+ def _randomOU(self, base=None):
"""create an ou with random attribute values, you can specify base
attributes"""
+ if base is None:
+ base = {}
ou = {
"name": self.randomName(),
"--display-name=%s" % old_displayname)
self.assertCmdSuccess(result, out, err)
- def _randomContact(self, base={}):
+ def _randomContact(self, base=None):
"""Create a contact with random attribute values, you can specify base
attributes"""
+ if base is None:
+ base = {}
# No name attributes are given here, because the object name will
# be made from the sn, givenName and initials attributes, if no name
contact.update(base)
return contact
- def _randomOU(self, base={}):
+ def _randomOU(self, base=None):
"""Create an ou with random attribute values, you can specify base
attributes."""
+ if base is None:
+ base = {}
ou = {
"name": self.randomName(),
self.assertTrue("Total groups: {0}".format(total_groups) in out,
"Total groups not reported correctly")
- def _random_user(self, base={}):
+ def _random_user(self, base=None):
'''
create a user with random attribute values, you can specify
base attributes
'''
+ if base is None:
+ base = {}
user = {
"name": self.randomName(),
"password": self.random_password(16),
found = self.assertMatch(out, str(obj.dn),
"object '%s' not found" % obj.dn)
- def _randomOU(self, base={}):
+ def _randomOU(self, base=None):
"""create an ou with random attribute values, you can specify base
attributes"""
-
+ if base is None:
+ base = {}
ou = {
"name": self.randomName(),
"description": self.randomName(count=100),
self.assertCmdSuccess(result, out, err, "Error running user unlock")
self.assertEqual(err, "", "Shouldn't be any error messages")
- def _randomUser(self, base={}):
+ def _randomUser(self, base=None):
"""create a user with random attribute values, you can specify base attributes"""
+ if base is None:
+ base = {}
user = {
"name": self.randomName(),
"password": self.random_password(16),
user.update(base)
return user
- def _randomPosixUser(self, base={}):
+ def _randomPosixUser(self, base=None):
"""create a user with random attribute values and additional RFC2307
attributes, you can specify base attributes"""
+ if base is None:
+ base = {}
user = self._randomUser({})
user.update(base)
posixAttributes = {
user.update(base)
return user
- def _randomUnixUser(self, base={}):
+ def _randomUnixUser(self, base=None):
"""create a user with random attribute values and additional RFC2307
attributes, you can specify base attributes"""
+ if base is None:
+ base = {}
user = self._randomUser({})
user.update(base)
posixAttributes = {
good_password,
"username")
- def _randomUser(self, base={}):
+ def _randomUser(self, base=None):
"""create a user with random attribute values, you can specify base attributes"""
+ if base is None:
+ base = {}
user = {
"name": self.randomName(),
}
def script_iterator(d=BASEDIR, cache=None,
shebang_filter=None,
filename_filter=None,
- subdirs=TEST_DIRS):
+ subdirs=None):
+ if subdirs is None:
+ subdirs = TEST_DIRS
if not cache:
safename = re.compile(r'\W+').sub
for subdir in subdirs: