mirror of
https://github.com/samba-team/samba.git
synced 2024-12-27 03:21:53 +03:00
r18658: make the test change fields sequentially each one in turn.
now to multiple changes... rafal
This commit is contained in:
parent
69c379cc63
commit
6df2c04e03
@ -330,6 +330,7 @@ done:
|
|||||||
continue; \
|
continue; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int fields_num = 15;
|
||||||
enum test_fields { none = 0, account_name, full_name, description, home_directory, home_drive,
|
enum test_fields { none = 0, account_name, full_name, description, home_directory, home_drive,
|
||||||
comment, logon_script, profile_path, acct_expiry, allow_password_change,
|
comment, logon_script, profile_path, acct_expiry, allow_password_change,
|
||||||
force_password_change, last_logon, last_logoff, last_password_change };
|
force_password_change, last_logon, last_logoff, last_password_change };
|
||||||
@ -337,7 +338,6 @@ enum test_fields { none = 0, account_name, full_name, description, home_director
|
|||||||
static void set_test_changes(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r, int num_changes,
|
static void set_test_changes(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r, int num_changes,
|
||||||
char **user_name, enum test_fields req_change)
|
char **user_name, enum test_fields req_change)
|
||||||
{
|
{
|
||||||
const int num_fields = 14;
|
|
||||||
const char* logon_scripts[] = { "start_login.cmd", "login.bat", "start.cmd" };
|
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_dirs[] = { "\\\\srv\\home", "\\\\homesrv\\home\\user", "\\\\pdcsrv\\domain" };
|
||||||
const char* home_drives[] = { "H:", "z:", "I:", "J:", "n:" };
|
const char* home_drives[] = { "H:", "z:", "I:", "J:", "n:" };
|
||||||
@ -349,10 +349,10 @@ static void set_test_changes(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r, i
|
|||||||
|
|
||||||
printf("Fields to change: [");
|
printf("Fields to change: [");
|
||||||
|
|
||||||
for (i = 0; i < num_changes && i < num_fields; i++) {
|
for (i = 0; i < num_changes && i < fields_num; i++) {
|
||||||
const char *fldname;
|
const char *fldname;
|
||||||
|
|
||||||
testfld = (req_change == none) ? (random() % num_fields) : req_change;
|
testfld = (req_change == none) ? (random() % fields_num) : req_change;
|
||||||
|
|
||||||
/* get one in case we hit time field this time */
|
/* get one in case we hit time field this time */
|
||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
@ -485,6 +485,7 @@ BOOL torture_modifyuser(struct torture_context *torture)
|
|||||||
char *name;
|
char *name;
|
||||||
struct libnet_context *ctx;
|
struct libnet_context *ctx;
|
||||||
struct libnet_ModifyUser req;
|
struct libnet_ModifyUser req;
|
||||||
|
int fld;
|
||||||
BOOL ret = True;
|
BOOL ret = True;
|
||||||
|
|
||||||
prep_mem_ctx = talloc_init("prepare test_deleteuser");
|
prep_mem_ctx = talloc_init("prepare test_deleteuser");
|
||||||
@ -522,19 +523,41 @@ BOOL torture_modifyuser(struct torture_context *torture)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZERO_STRUCT(req);
|
printf("Testing change of all fields - each single one in turn\n");
|
||||||
req.in.domain_name = lp_workgroup();
|
|
||||||
req.in.user_name = name;
|
for (fld = 1; fld < fields_num; fld++) {
|
||||||
|
ZERO_STRUCT(req);
|
||||||
printf("Testing change of a single field\n");
|
req.in.domain_name = lp_workgroup();
|
||||||
set_test_changes(mem_ctx, &req, 1, &name, none);
|
req.in.user_name = name;
|
||||||
|
|
||||||
status = libnet_ModifyUser(ctx, mem_ctx, &req);
|
set_test_changes(mem_ctx, &req, 1, &name, fld);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
|
||||||
printf("libnet_ModifyUser call failed: %s\n", nt_errstr(status));
|
status = libnet_ModifyUser(ctx, mem_ctx, &req);
|
||||||
talloc_free(mem_ctx);
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
ret = False;
|
printf("libnet_ModifyUser call failed: %s\n", nt_errstr(status));
|
||||||
goto done;
|
talloc_free(mem_ctx);
|
||||||
|
ret = False;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fld == account_name) {
|
||||||
|
/* restore original testing username - it's useful when test fails
|
||||||
|
because it prevents from problems with recreating account */
|
||||||
|
ZERO_STRUCT(req);
|
||||||
|
req.in.domain_name = lp_workgroup();
|
||||||
|
req.in.user_name = name;
|
||||||
|
req.in.account_name = TEST_USERNAME;
|
||||||
|
|
||||||
|
status = libnet_ModifyUser(ctx, mem_ctx, &req);
|
||||||
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
|
printf("libnet_ModifyUser call failed: %s\n", nt_errstr(status));
|
||||||
|
talloc_free(mem_ctx);
|
||||||
|
ret = False;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
name = TEST_USERNAME;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!test_cleanup(ctx->samr.pipe, mem_ctx, &ctx->samr.handle, name)) {
|
if (!test_cleanup(ctx->samr.pipe, mem_ctx, &ctx->samr.handle, name)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user