diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/libnet/libnet_user.c | 15 | ||||
-rw-r--r-- | source4/torture/libnet/userman.c | 2 |
2 files changed, 13 insertions, 4 deletions
diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c index 94711c1dea..31300a7937 100644 --- a/source4/torture/libnet/libnet_user.c +++ b/source4/torture/libnet/libnet_user.c @@ -339,6 +339,9 @@ static void set_test_changes(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r, const char* logon_scripts[] = { "start_login.cmd", "login.bat", "start.cmd" }; const char* home_dirs[] = { "\\\\srv\\home", "\\\\homesrv\\home\\user", "\\\\pdcsrv\\domain" }; const char* home_drives[] = { "H:", "z:", "I:", "J:", "n:" }; + const uint32_t flags[] = { (ACB_DISABLED | ACB_NORMAL), + (ACB_NORMAL | ACB_PWNOEXP), + (ACB_NORMAL) }; const char *homedir, *homedrive, *logonscript; struct timeval now; int i, testfld; @@ -380,14 +383,14 @@ static void set_test_changes(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r, case home_directory: continue_if_field_set(r->in.home_directory); - homedir = home_dirs[random() % (sizeof(home_dirs)/sizeof(char*))]; + homedir = home_dirs[random() % ARRAY_SIZE(home_dirs)]; r->in.home_directory = talloc_strdup(mem_ctx, homedir); fldname = "home_dir"; break; case home_drive: continue_if_field_set(r->in.home_drive); - homedrive = home_drives[random() % (sizeof(home_drives)/sizeof(char*))]; + homedrive = home_drives[random() % ARRAY_SIZE(home_drives)]; r->in.home_drive = talloc_strdup(mem_ctx, homedrive); fldname = "home_drive"; break; @@ -401,7 +404,7 @@ static void set_test_changes(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r, case logon_script: continue_if_field_set(r->in.logon_script); - logonscript = logon_scripts[random() % (sizeof(logon_scripts)/sizeof(char*))]; + logonscript = logon_scripts[random() % ARRAY_SIZE(logon_scripts)]; r->in.logon_script = talloc_strdup(mem_ctx, logonscript); fldname = "logon_script"; break; @@ -420,6 +423,12 @@ static void set_test_changes(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r, fldname = "acct_expiry"; break; + case acct_flags: + continue_if_field_set(r->in.acct_flags); + r->in.acct_flags = flags[random() % ARRAY_SIZE(flags)]; + fldname = "acct_flags"; + break; + default: fldname = "unknown_field"; } diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c index 0d08284a9f..1d630e5ecd 100644 --- a/source4/torture/libnet/userman.c +++ b/source4/torture/libnet/userman.c @@ -189,7 +189,7 @@ static bool test_usermod(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, case acct_flags: continue_if_field_set(mod->in.change.acct_flags); - mod->in.change.acct_flags = flags[random() % (sizeof(flags)/sizeof(uint32_t))]; + mod->in.change.acct_flags = flags[random() % ARRAY_SIZE(flags)]; mod->in.change.fields |= USERMOD_FIELD_ACCT_FLAGS; fldname = "acct_flags"; break; |