mirror of
https://github.com/samba-team/samba.git
synced 2025-07-29 15:42:04 +03:00
traffic_replay: Move 'traffic account' flag up a level
We create machine accounts for 2 different purposes:
1). For traffic generation, i.e. testing realistic network packets.
2). For generating a realistic large DB.
Unfortunately, we want to use different userAccountControl flags for
the 2 different cases. Commit 3338a3e257
changed the flags used
for case #2, but this breaks case #1.
The problem is generate_users_and_groups() is called in both cases,
so we want the 'traffic account' flag passed into that function.
This ensures that the machine accounts get created with the appropriate
userAccountControl flags for the particular case you want to test.
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
committed by
Andrew Bartlett
parent
85b6d88989
commit
51917fc07f
@ -1747,7 +1747,8 @@ def generate_users(ldb, instance_id, number, password):
|
||||
return users
|
||||
|
||||
|
||||
def generate_machine_accounts(ldb, instance_id, number, password):
|
||||
def generate_machine_accounts(ldb, instance_id, number, password,
|
||||
traffic_account=True):
|
||||
"""Add machine accounts to the server"""
|
||||
existing_objects = search_objectclass(ldb, objectclass='computer')
|
||||
added = 0
|
||||
@ -1756,7 +1757,7 @@ def generate_machine_accounts(ldb, instance_id, number, password):
|
||||
if name not in existing_objects:
|
||||
name = "STGM-%d-%d" % (instance_id, i)
|
||||
create_machine_account(ldb, instance_id, name, password,
|
||||
traffic_account=False)
|
||||
traffic_account)
|
||||
added += 1
|
||||
if added % 50 == 0:
|
||||
LOGGER.info("Created %u/%u machine accounts" % (added, number))
|
||||
@ -1798,7 +1799,8 @@ def clean_up_accounts(ldb, instance_id):
|
||||
|
||||
def generate_users_and_groups(ldb, instance_id, password,
|
||||
number_of_users, number_of_groups,
|
||||
group_memberships, machine_accounts=0):
|
||||
group_memberships, machine_accounts=0,
|
||||
traffic_accounts=True):
|
||||
"""Generate the required users and groups, allocating the users to
|
||||
those groups."""
|
||||
memberships_added = 0
|
||||
@ -1813,7 +1815,8 @@ def generate_users_and_groups(ldb, instance_id, password,
|
||||
if machine_accounts > 0:
|
||||
LOGGER.info("Generating dummy machine accounts")
|
||||
computers_added = generate_machine_accounts(ldb, instance_id,
|
||||
machine_accounts, password)
|
||||
machine_accounts, password,
|
||||
traffic_accounts)
|
||||
|
||||
if number_of_groups > 0:
|
||||
LOGGER.info("Generating dummy groups")
|
||||
|
Reference in New Issue
Block a user