The branch, master has been updated
       via  098fc8c... s4:torture: refactor querying of domain info out into 
test_QueryDomainInfo2_level()
       via  0a33b20... s4:torture: create new test_SetDomainInfo_ntstatus()
       via  c1d157a... s4:torture: refactor setting of domain inf out into 
test_SetDomainInfo()
       via  50a46cf... s4:torture: refactor setting account flags out into 
test_SetUserInfo_acct_flags()
      from  899bd00... Fix bug #7067 - Linux asynchronous IO (aio) can cause 
smbd to fail to respond to a read or write.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 098fc8c09c64c9fa37ae70638e3b30340a7ae183
Author: Michael Adam <ob...@samba.org>
Date:   Fri Jan 22 00:47:42 2010 +0100

    s4:torture: refactor querying of domain info out into 
test_QueryDomainInfo2_level()
    
    Used in several places.
    
    (Note: The _level suffix in the function name is just because
    test_QueryDomainInfo2() already exists as an overall test for all levels.)
    
    Michael
    
    Signed-off-by: Günther Deschner <g...@samba.org>

commit 0a33b20f70506d0a01b4c543ab57ca2488187ee9
Author: Michael Adam <ob...@samba.org>
Date:   Fri Jan 22 00:46:19 2010 +0100

    s4:torture: create new test_SetDomainInfo_ntstatus()
    
    for checking for SetDomainInfo giving a desired return code.
    
    Michael
    
    Signed-off-by: Günther Deschner <g...@samba.org>

commit c1d157a48102c50c72a85b60fba5237436377ffd
Author: Michael Adam <ob...@samba.org>
Date:   Fri Jan 22 00:21:29 2010 +0100

    s4:torture: refactor setting of domain inf out into test_SetDomainInfo()
    
    and use it in several places.
    
    Michael
    
    Signed-off-by: Günther Deschner <g...@samba.org>

commit 50a46cff76e33dc8828c49bf0665afeeb2b7c1eb
Author: Michael Adam <ob...@samba.org>
Date:   Thu Jan 21 23:55:51 2010 +0100

    s4:torture: refactor setting account flags out into 
test_SetUserInfo_acct_flags()
    
    and use this in four places (enabling/disabling accounts).
    
    Michael
    
    Signed-off-by: Günther Deschner <g...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source4/torture/rpc/samr.c |  383 +++++++++++++++++++-------------------------
 1 files changed, 168 insertions(+), 215 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index c2b973e..4ab4a2c 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -3403,33 +3403,106 @@ static bool test_QueryUserInfo_badpwdcount(struct 
dcerpc_pipe *p,
        return true;
 }
 
-static bool test_reset_badpwdcount(struct dcerpc_pipe *p,
-                                  struct torture_context *tctx,
-                                  struct policy_handle *user_handle,
-                                  uint32_t acct_flags,
-                                  char **password)
+static bool test_SetUserInfo_acct_flags(struct dcerpc_pipe *p,
+                                       struct torture_context *tctx,
+                                       struct policy_handle *user_handle,
+                                       uint32_t acct_flags)
 {
        struct samr_SetUserInfo r;
        union samr_UserInfo user_info;
 
-       torture_assert(tctx, test_SetUserPass(p, tctx, user_handle, password),
-               "failed to set password");
-
-       torture_comment(tctx, "Testing SetUserInfo level 16 (enable 
account)\n");
+       torture_comment(tctx, "Testing SetUserInfo level 16\n");
 
        user_info.info16.acct_flags = acct_flags;
-       user_info.info16.acct_flags &= ~ACB_DISABLED;
 
        r.in.user_handle = user_handle;
        r.in.level = 16;
        r.in.info = &user_info;
 
        torture_assert_ntstatus_ok(tctx, dcerpc_samr_SetUserInfo(p, tctx, &r),
-               "failed to enable user");
+               "failed to set account flags");
 
+       return true;
+}
+
+static bool test_reset_badpwdcount(struct dcerpc_pipe *p,
+                                  struct torture_context *tctx,
+                                  struct policy_handle *user_handle,
+                                  uint32_t acct_flags,
+                                  char **password)
+{
        torture_assert(tctx, test_SetUserPass(p, tctx, user_handle, password),
                "failed to set password");
 
+       torture_comment(tctx, "Testing SetUserInfo level 16 (enable 
account)\n");
+
+       torture_assert(tctx,
+                      test_SetUserInfo_acct_flags(p, tctx, user_handle,
+                                                  acct_flags & ~ACB_DISABLED),
+                      "failed to enable user");
+
+       torture_assert(tctx, test_SetUserPass(p, tctx, user_handle, password),
+               "failed to set password");
+
+       return true;
+}
+
+static bool test_SetDomainInfo(struct dcerpc_pipe *p,
+                              struct torture_context *tctx,
+                              struct policy_handle *domain_handle,
+                              enum samr_DomainInfoClass level,
+                              union samr_DomainInfo *info)
+{
+       struct samr_SetDomainInfo r;
+
+       r.in.domain_handle = domain_handle;
+       r.in.level = level;
+       r.in.info = info;
+
+       torture_assert_ntstatus_ok(tctx,
+                                  dcerpc_samr_SetDomainInfo(p, tctx, &r),
+                                  "failed to set domain info");
+
+       return true;
+}
+
+static bool test_SetDomainInfo_ntstatus(struct dcerpc_pipe *p,
+                                       struct torture_context *tctx,
+                                       struct policy_handle *domain_handle,
+                                       enum samr_DomainInfoClass level,
+                                       union samr_DomainInfo *info,
+                                       NTSTATUS expected)
+{
+       struct samr_SetDomainInfo r;
+
+       r.in.domain_handle = domain_handle;
+       r.in.level = level;
+       r.in.info = info;
+
+       torture_assert_ntstatus_equal(tctx,
+                                     dcerpc_samr_SetDomainInfo(p, tctx, &r),
+                                     expected,
+                                     "");
+
+       return true;
+}
+
+static bool test_QueryDomainInfo2_level(struct dcerpc_pipe *p,
+                                       struct torture_context *tctx,
+                                       struct policy_handle *domain_handle,
+                                       enum samr_DomainInfoClass level,
+                                       union samr_DomainInfo **q_info)
+{
+       struct samr_QueryDomainInfo2 r;
+
+       r.in.domain_handle = domain_handle;
+       r.in.level = level;
+       r.out.info = q_info;
+
+       torture_assert_ntstatus_ok(tctx,
+               dcerpc_samr_QueryDomainInfo2(p, tctx, &r),
+               "failed to query domain info");
+
        return true;
 }
 
@@ -3465,36 +3538,20 @@ static bool test_Password_badpwdcount(struct 
dcerpc_pipe *p,
        /* set policies */
 
        info.info1 = *info1;
-
        info.info1.password_history_length = password_history_length;
 
-       {
-               struct samr_SetDomainInfo r;
-
-               r.in.domain_handle = domain_handle;
-               r.in.level = DomainPasswordInformation;
-               r.in.info = &info;
-
-               torture_assert_ntstatus_ok(tctx,
-                       dcerpc_samr_SetDomainInfo(p, tctx, &r),
-                       "failed to set domain info level 1");
-       }
+       torture_assert(tctx,
+                      test_SetDomainInfo(p, tctx, domain_handle,
+                                         DomainPasswordInformation, &info),
+                      "failed to set password history length");
 
        info.info12 = *info12;
-
        info.info12.lockout_threshold = lockout_threshold;
 
-       {
-               struct samr_SetDomainInfo r;
-
-               r.in.domain_handle = domain_handle;
-               r.in.level = DomainLockoutInformation;
-               r.in.info = &info;
-
-               torture_assert_ntstatus_ok(tctx,
-                       dcerpc_samr_SetDomainInfo(p, tctx, &r),
-                       "failed to set domain info level 12");
-       }
+       torture_assert(tctx,
+                      test_SetDomainInfo(p, tctx, domain_handle,
+                                         DomainLockoutInformation, &info),
+                      "failed to set lockout threshold");
 
        /* reset bad pwd count */
 
@@ -3503,26 +3560,16 @@ static bool test_Password_badpwdcount(struct 
dcerpc_pipe *p,
 
 
        /* enable or disable account */
-       {
-               struct samr_SetUserInfo r;
-               union samr_UserInfo user_info;
-
-               torture_comment(tctx, "Testing SetUserInfo level 16 (%s 
account)\n",
-                       disable ? "disable" : "enable");
-
-               user_info.info16.acct_flags = acct_flags;
-               if (disable) {
-                       user_info.info16.acct_flags |= ACB_DISABLED;
-               } else {
-                       user_info.info16.acct_flags &= ~ACB_DISABLED;
-               }
-
-               r.in.user_handle = user_handle;
-               r.in.level = 16;
-               r.in.info = &user_info;
-
-               torture_assert_ntstatus_ok(tctx, dcerpc_samr_SetUserInfo(p, 
tctx, &r),
-                       "failed to enable user");
+       if (disable) {
+               torture_assert(tctx,
+                              test_SetUserInfo_acct_flags(p, tctx, user_handle,
+                                               acct_flags | ACB_DISABLED),
+                              "failed to disable user");
+       } else {
+               torture_assert(tctx,
+                              test_SetUserInfo_acct_flags(p, tctx, user_handle,
+                                               acct_flags & ~ACB_DISABLED),
+                              "failed to enable user");
        }
 
 
@@ -3701,35 +3748,20 @@ static bool test_Password_badpwdcount_wrap(struct 
dcerpc_pipe *p,
 
        /* backup old policies */
 
-       {
-               struct samr_QueryDomainInfo2 r;
-
-               r.in.domain_handle = domain_handle;
-               r.in.level = DomainPasswordInformation;
-               r.out.info = &q_info;
-
-               torture_assert_ntstatus_ok(tctx,
-                       dcerpc_samr_QueryDomainInfo2(p, tctx, &r),
-                       "failed to query domain info level 1");
-
-               info1 = q_info->info1;
-       }
-
-       {
-               struct samr_QueryDomainInfo2 r;
-
-               r.in.domain_handle = domain_handle;
-               r.in.level = DomainLockoutInformation;
-               r.out.info = &q_info;
+       torture_assert(tctx,
+               test_QueryDomainInfo2_level(p, tctx, domain_handle,
+                                           DomainPasswordInformation, &q_info),
+               "failed to query domain info level 1");
 
-               torture_assert_ntstatus_ok(tctx,
-                       dcerpc_samr_QueryDomainInfo2(p, tctx, &r),
-                       "failed to query domain info level 12");
+       info1 = q_info->info1;
+       _info1 = info1;
 
-               info12 = q_info->info12;
-       }
+       torture_assert(tctx,
+               test_QueryDomainInfo2_level(p, tctx, domain_handle,
+                                           DomainLockoutInformation, &q_info),
+               "failed to query domain info level 12");
 
-       _info1 = info1;
+       info12 = q_info->info12;
        _info12 = info12;
 
        /* run tests */
@@ -3762,31 +3794,17 @@ static bool test_Password_badpwdcount_wrap(struct 
dcerpc_pipe *p,
 
        s_info.info1 = info1;
 
-       {
-               struct samr_SetDomainInfo r;
-
-               r.in.domain_handle = domain_handle;
-               r.in.level = DomainPasswordInformation;
-               r.in.info = &s_info;
-
-               torture_assert_ntstatus_ok(tctx,
-                       dcerpc_samr_SetDomainInfo(p, tctx, &r),
-                       "failed to set domain info level 1");
-       }
+       torture_assert(tctx,
+                      test_SetDomainInfo(p, tctx, domain_handle,
+                                         DomainPasswordInformation, &s_info),
+                      "failed to set password information");
 
        s_info.info12 = info12;
 
-       {
-               struct samr_SetDomainInfo r;
-
-               r.in.domain_handle = domain_handle;
-               r.in.level = DomainLockoutInformation;
-               r.in.info = &s_info;
-
-               torture_assert_ntstatus_ok(tctx,
-                       dcerpc_samr_SetDomainInfo(p, tctx, &r),
-                       "failed to set domain info level 12");
-       }
+       torture_assert(tctx,
+                      test_SetDomainInfo(p, tctx, domain_handle,
+                                         DomainLockoutInformation, &s_info),
+                      "failed to set lockout information");
 
        return ret;
 }
@@ -3847,69 +3865,41 @@ static bool test_Password_lockout(struct dcerpc_pipe *p,
        torture_comment(tctx, "setting password history lenght.\n");
        info.info1.password_history_length = password_history_length;
 
-       {
-               struct samr_SetDomainInfo r;
-
-               r.in.domain_handle = domain_handle;
-               r.in.level = DomainPasswordInformation;
-               r.in.info = &info;
-
-               torture_assert_ntstatus_ok(tctx,
-                       dcerpc_samr_SetDomainInfo(p, tctx, &r),
-                       "failed to set domain info level 1");
-       }
+       torture_assert(tctx,
+                      test_SetDomainInfo(p, tctx, domain_handle,
+                                         DomainPasswordInformation, &info),
+                      "failed to set password history length");
 
        info.info12 = *info12;
-
        info.info12.lockout_threshold = lockout_threshold;
 
        /* set lockout duration < lockout window: should fail */
        info.info12.lockout_duration = ~(lockout_seconds * delta_time_factor);
        info.info12.lockout_window = ~((lockout_seconds + 1) * 
delta_time_factor);
 
-       {
-               struct samr_SetDomainInfo r;
-
-               r.in.domain_handle = domain_handle;
-               r.in.level = DomainLockoutInformation;
-               r.in.info = &info;
-
-               torture_assert_ntstatus_equal(tctx,
-                       dcerpc_samr_SetDomainInfo(p, tctx, &r),
-                       NT_STATUS_INVALID_PARAMETER,
-                       "succeeded setting lockout duration < lockout window");
-       }
+       torture_assert(tctx,
+               test_SetDomainInfo_ntstatus(p, tctx, domain_handle,
+                                           DomainLockoutInformation, &info,
+                                           NT_STATUS_INVALID_PARAMETER),
+               "setting lockout duration < lockout window gave unexpected 
result");
 
        info.info12.lockout_duration = 0;
        info.info12.lockout_window = 0;
 
-       {
-               struct samr_SetDomainInfo r;
-
-               r.in.domain_handle = domain_handle;
-               r.in.level = DomainLockoutInformation;
-               r.in.info = &info;
+       torture_assert(tctx,
+                      test_SetDomainInfo(p, tctx, domain_handle,
+                                         DomainLockoutInformation, &info),
+                      "failed to set lockout window and duration to 0");
 
-               torture_assert_ntstatus_ok(tctx,
-                       dcerpc_samr_SetDomainInfo(p, tctx, &r),
-                       "failed to set lockout window and duration to 0");
-       }
 
        /* set lockout duration of 5 seconds */
        info.info12.lockout_duration = ~(lockout_seconds * delta_time_factor);
        info.info12.lockout_window = ~(lockout_seconds * delta_time_factor);
 
-       {
-               struct samr_SetDomainInfo r;
-
-               r.in.domain_handle = domain_handle;
-               r.in.level = DomainLockoutInformation;
-               r.in.info = &info;
-
-               torture_assert_ntstatus_ok(tctx,
-                       dcerpc_samr_SetDomainInfo(p, tctx, &r),
-                       "failed to set domain info level 12");
-       }
+       torture_assert(tctx,
+                      test_SetDomainInfo(p, tctx, domain_handle,
+                                         DomainLockoutInformation, &info),
+                      "failed to set lockout window and duration to 5 
seconds");
 
        /* reset bad pwd count */
 
@@ -3918,28 +3908,20 @@ static bool test_Password_lockout(struct dcerpc_pipe *p,
 
 
        /* enable or disable account */
-       {
-               struct samr_SetUserInfo r;
-               union samr_UserInfo user_info;
-
-               torture_comment(tctx, "Testing SetUserInfo level 16 (%s 
account)\n",
-                       disable ? "disable" : "enable");
 
-               user_info.info16.acct_flags = acct_flags;
-               if (disable) {
-                       user_info.info16.acct_flags |= ACB_DISABLED;
-               } else {
-                       user_info.info16.acct_flags &= ~ACB_DISABLED;
-               }
-
-               r.in.user_handle = user_handle;
-               r.in.level = 16;
-               r.in.info = &user_info;
-
-               torture_assert_ntstatus_ok(tctx, dcerpc_samr_SetUserInfo(p, 
tctx, &r),
-                       "failed to enable user");
+       if (disable) {
+               torture_assert(tctx,
+                              test_SetUserInfo_acct_flags(p, tctx, user_handle,
+                                               acct_flags | ACB_DISABLED),
+                              "failed to disable user");
+       } else {
+               torture_assert(tctx,
+                              test_SetUserInfo_acct_flags(p, tctx, user_handle,
+                                               acct_flags & ~ACB_DISABLED),
+                              "failed to enable user");
        }
 
+
        /* test logon with right password */
 
        if (!test_SamLogon_with_creds(tctx, np, machine_credentials,
@@ -4085,35 +4067,20 @@ static bool test_Password_lockout_wrap(struct 
dcerpc_pipe *p,
 
        /* backup old policies */
 
-       {
-               struct samr_QueryDomainInfo2 r;
-
-               r.in.domain_handle = domain_handle;
-               r.in.level = DomainPasswordInformation;
-               r.out.info = &q_info;
-
-               torture_assert_ntstatus_ok(tctx,
-                       dcerpc_samr_QueryDomainInfo2(p, tctx, &r),
-                       "failed to query domain info level 1");
-
-               info1 = q_info->info1;
-       }
-
-       {
-               struct samr_QueryDomainInfo2 r;
-
-               r.in.domain_handle = domain_handle;
-               r.in.level = DomainLockoutInformation;
-               r.out.info = &q_info;
+       torture_assert(tctx,
+               test_QueryDomainInfo2_level(p, tctx, domain_handle,
+                                           DomainPasswordInformation, &q_info),
+               "failed to query domain info level 1");
 
-               torture_assert_ntstatus_ok(tctx,
-                       dcerpc_samr_QueryDomainInfo2(p, tctx, &r),
-                       "failed to query domain info level 12");
+       info1 = q_info->info1;
+       _info1 = info1;
 
-               info12 = q_info->info12;
-       }
+       torture_assert(tctx,
+               test_QueryDomainInfo2_level(p, tctx, domain_handle,
+                                           DomainLockoutInformation, &q_info),
+               "failed to query domain info level 12");
 
-       _info1 = info1;
+       info12 = q_info->info12;
        _info12 = info12;
 
        /* run tests */
@@ -4146,31 +4113,17 @@ static bool test_Password_lockout_wrap(struct 
dcerpc_pipe *p,
 
        s_info.info1 = info1;
 
-       {
-               struct samr_SetDomainInfo r;
-
-               r.in.domain_handle = domain_handle;
-               r.in.level = DomainPasswordInformation;
-               r.in.info = &s_info;
-
-               torture_assert_ntstatus_ok(tctx,
-                       dcerpc_samr_SetDomainInfo(p, tctx, &r),
-                       "failed to set domain info level 1");
-       }
+       torture_assert(tctx,
+                      test_SetDomainInfo(p, tctx, domain_handle,
+                                         DomainPasswordInformation, &s_info),
+                      "failed to set password information");
 
        s_info.info12 = info12;
 
-       {
-               struct samr_SetDomainInfo r;
-
-               r.in.domain_handle = domain_handle;
-               r.in.level = DomainLockoutInformation;
-               r.in.info = &s_info;
-
-               torture_assert_ntstatus_ok(tctx,
-                       dcerpc_samr_SetDomainInfo(p, tctx, &r),
-                       "failed to set domain info level 12");
-       }
+       torture_assert(tctx,
+                      test_SetDomainInfo(p, tctx, domain_handle,


-- 
Samba Shared Repository

Reply via email to