1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00

Fix up the libnet tests.

These tests still do not pass against windows, but at least now it
doesn't reset acct_flags to 0.

This is enough to have Samba4 pass it's own tests for the moment.

Andrew Bartlett
(This used to be commit aa3901311eb7ce6f2d2b2413323e31a5b064cfc4)
This commit is contained in:
Andrew Bartlett 2008-02-28 10:32:06 +11:00
parent 227cecadf9
commit 17207133ea
2 changed files with 13 additions and 4 deletions

View File

@ -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";
}

View File

@ -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;