diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2010-05-22 05:03:16 +0300 |
---|---|---|
committer | Kamen Mazdrashki <kamenim@samba.org> | 2010-05-26 14:36:12 +0300 |
commit | 644593d30ecddec27f0a48340d74db7cf164bfc3 (patch) | |
tree | 2f165413b55db30421b617570398744cfbb02e66 /source4/torture/libnet | |
parent | 2bca048367456b09d16f51405373fa33be6eeca3 (diff) | |
download | samba-644593d30ecddec27f0a48340d74db7cf164bfc3.tar.gz samba-644593d30ecddec27f0a48340d74db7cf164bfc3.tar.bz2 samba-644593d30ecddec27f0a48340d74db7cf164bfc3.zip |
s4/test: Replace hand-made field count to test
This patch replaces hand-make count of fields to be tested
with defines for FIRST-LAST value for corresponding fields
to test with.
As a side-effect, 'acct_flags' is now included in tests.
Diffstat (limited to 'source4/torture/libnet')
-rw-r--r-- | source4/torture/libnet/libnet_user.c | 6 | ||||
-rw-r--r-- | source4/torture/libnet/userman.c | 6 | ||||
-rw-r--r-- | source4/torture/libnet/usertest.h | 7 |
3 files changed, 11 insertions, 8 deletions
diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c index 140282bd2b..03e460fcf5 100644 --- a/source4/torture/libnet/libnet_user.c +++ b/source4/torture/libnet/libnet_user.c @@ -356,10 +356,10 @@ static void set_test_changes(struct torture_context *tctx, torture_comment(tctx, "Fields to change: ["); - for (i = 0; i < num_changes && i < FIELDS_NUM; i++) { + for (i = 0; i < num_changes && i <= USER_FIELD_LAST; i++) { const char *fldname; - testfld = (req_change == none) ? (random() % FIELDS_NUM) : req_change; + testfld = (req_change == none) ? (random() % USER_FIELD_LAST) + 1 : req_change; /* get one in case we hit time field this time */ gettimeofday(&now, NULL); @@ -524,7 +524,7 @@ bool torture_modifyuser(struct torture_context *torture) torture_comment(torture, "Testing change of all fields - each single one in turn\n"); - for (fld = 1; fld < FIELDS_NUM - 1; fld++) { + for (fld = USER_FIELD_FIRST; fld <= USER_FIELD_LAST; fld++) { ZERO_STRUCT(req); req.in.domain_name = lp_workgroup(torture->lp_ctx); req.in.user_name = name; diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c index c1d67fb8b6..c67f133356 100644 --- a/source4/torture/libnet/userman.c +++ b/source4/torture/libnet/userman.c @@ -110,10 +110,10 @@ static bool test_usermod(struct torture_context *tctx, struct dcerpc_pipe *p, torture_comment(tctx, "fields to change: ["); - for (i = 0; i < num_changes && i < FIELDS_NUM - 1; i++) { + for (i = 0; i < num_changes && i <= USER_FIELD_LAST; i++) { const char *fldname; - testfld = (random() % (FIELDS_NUM - 1)) + 1; + testfld = (random() % USER_FIELD_LAST) + 1; gettimeofday(&now, NULL); @@ -444,7 +444,7 @@ bool torture_usermod(struct torture_context *torture) goto done; } - for (i = 1; i < FIELDS_NUM; i++) { + for (i = USER_FIELD_FIRST; i <= USER_FIELD_LAST; i++) { struct libnet_rpc_usermod m; if (!test_usermod(torture, p, mem_ctx, &h, i, &m, &name)) { diff --git a/source4/torture/libnet/usertest.h b/source4/torture/libnet/usertest.h index 19d56415b3..aecec538dd 100644 --- a/source4/torture/libnet/usertest.h +++ b/source4/torture/libnet/usertest.h @@ -26,8 +26,11 @@ } -#define FIELDS_NUM 11 -enum test_fields { none = 0, account_name, full_name, description, home_directory, home_drive, +#define USER_FIELD_FIRST account_name +#define USER_FIELD_LAST acct_flags + +enum test_fields { none = 0, + account_name, full_name, description, home_directory, home_drive, comment, logon_script, profile_path, acct_expiry, acct_flags }; |