The branch, master has been updated
       via  bb6fda8a9a4ca85d2b56ff0b0f1d43943495ed31 (commit)
       via  b24203fcb8222154f3d64768e4637d731b57c30c (commit)
       via  5088caa69e0a5f6822bbf6184c404eaf18783ed5 (commit)
       via  a03e0c478d0c298a7aea4aac8b2f9a1ffc25fd63 (commit)
      from  c4f6fb0b2d669e9f575f1f25a651d0b7982e7db1 (commit)

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


- Log -----------------------------------------------------------------
commit bb6fda8a9a4ca85d2b56ff0b0f1d43943495ed31
Author: Kamen Mazdrashki <kamen.mazdras...@postpath.com>
Date:   Fri Sep 11 01:39:19 2009 +0300

    s4/tort: RPC-DRSUAPI test case refactored to match torture architecture

commit b24203fcb8222154f3d64768e4637d731b57c30c
Author: Kamen Mazdrashki <kamen.mazdras...@postpath.com>
Date:   Fri Sep 11 01:17:57 2009 +0300

    s4/tort: code clean up using torture_drsuapi_assert_call() macro
    
    After this change, when a test fails, it gives
    reasonable failure message.

commit 5088caa69e0a5f6822bbf6184c404eaf18783ed5
Author: Kamen Mazdrashki <kamen.mazdras...@postpath.com>
Date:   Thu Sep 10 23:44:00 2009 +0300

    s4/tort: assert macro for drsuapi dcerpc call
    
    The macro actually wraps common code pattern used in
    almost every test for DRSUAPI interface

commit a03e0c478d0c298a7aea4aac8b2f9a1ffc25fd63
Author: Kamen Mazdrashki <kamen.mazdras...@postpath.com>
Date:   Thu Sep 10 23:43:32 2009 +0300

    s4/tort: Propagate torture_context and use torture_comment
    
    NOTE: Not every place where printf is used is replaced by
    torture_comment. Future work shall "missed" printfs also.

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

Summary of changes:
 source4/torture/rpc/drsuapi.c |  405 +++++++++++++++++------------------------
 source4/torture/rpc/drsuapi.h |   26 +++
 source4/torture/rpc/rpc.c     |    2 +-
 3 files changed, 191 insertions(+), 242 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c
index 5880b16..174de5e 100644
--- a/source4/torture/rpc/drsuapi.c
+++ b/source4/torture/rpc/drsuapi.c
@@ -29,7 +29,8 @@
 
 #define TEST_MACHINE_NAME "torturetest"
 
-bool test_DsBind(struct dcerpc_pipe *p, struct torture_context *tctx,
+bool test_DsBind(struct dcerpc_pipe *p,
+                struct torture_context *tctx,
                 struct DsPrivate *priv)
 {
        NTSTATUS status;
@@ -44,23 +45,16 @@ bool test_DsBind(struct dcerpc_pipe *p, struct 
torture_context *tctx,
        torture_comment(tctx, "testing DsBind\n");
 
        status = dcerpc_drsuapi_DsBind(p, tctx, &r);
-       if (!NT_STATUS_IS_OK(status)) {
-               const char *errstr = nt_errstr(status);
-               if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
-                       errstr = dcerpc_errstr(tctx, p->last_fault_code);
-               }
-               torture_fail(tctx, "dcerpc_drsuapi_DsBind failed");
-       } else if (!W_ERROR_IS_OK(r.out.result)) {
-               torture_fail(tctx, "DsBind failed");
-       }
+       torture_drsuapi_assert_call(tctx, p, status, &r, 
"dcerpc_drsuapi_DsBind");
 
        return true;
 }
 
-static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct 
torture_context *torture,
-                     struct DsPrivate *priv)
+static bool test_DsGetDomainControllerInfo(struct torture_context *tctx,
+                                          struct DsPrivate *priv)
 {
        NTSTATUS status;
+       struct dcerpc_pipe *p = priv->pipe;
        struct drsuapi_DsGetDomainControllerInfo r;
        union drsuapi_DsGetDCInfoCtr ctr;
        int32_t level_out = 0;
@@ -105,14 +99,14 @@ static bool test_DsGetDomainControllerInfo(struct 
dcerpc_pipe *p, struct torture
                        r.out.ctr = &ctr;
                        r.out.level_out = &level_out;
                        
-                       torture_comment(torture,
+                       torture_comment(tctx,
                                   "testing DsGetDomainControllerInfo level %d 
on domainname '%s'\n",
                               r.in.req->req1.level, 
r.in.req->req1.domain_name);
                
-                       status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, 
torture, &r);
-                       torture_assert_ntstatus_ok(torture, status,
+                       status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, 
tctx, &r);
+                       torture_assert_ntstatus_ok(tctx, status,
                                   "dcerpc_drsuapi_DsGetDomainControllerInfo 
with dns domain failed");
-                       torture_assert_werr_equal(torture, 
+                       torture_assert_werr_equal(tctx,
                                                                          
r.out.result, names[j].expected, 
                                           "DsGetDomainControllerInfo level 
with dns domain failed");
                
@@ -121,9 +115,9 @@ static bool test_DsGetDomainControllerInfo(struct 
dcerpc_pipe *p, struct torture
                                continue;
                        }
 
-                       torture_assert_int_equal(torture, 
-                                                                        
r.in.req->req1.level, *r.out.level_out,
-                                                                        
"dcerpc_drsuapi_DsGetDomainControllerInfo level"); 
+                       torture_assert_int_equal(tctx,
+                                                r.in.req->req1.level, 
*r.out.level_out,
+                                                
"dcerpc_drsuapi_DsGetDomainControllerInfo in/out level differs");
 
                        switch (level) {
                        case 1:
@@ -146,7 +140,7 @@ static bool test_DsGetDomainControllerInfo(struct 
dcerpc_pipe *p, struct torture
                                }
                                break;
                        }
-                       torture_assert(torture, found,
+                       torture_assert(tctx, found,
                                 "dcerpc_drsuapi_DsGetDomainControllerInfo: 
Failed to find the domain controller we just created during the join");
                }
        }
@@ -160,20 +154,21 @@ static bool test_DsGetDomainControllerInfo(struct 
dcerpc_pipe *p, struct torture
        r.in.req->req1.domain_name = "__UNKNOWN_DOMAIN__"; /* This is clearly 
ignored for this level */
        r.in.req->req1.level = -1;
        
-       printf("testing DsGetDomainControllerInfo level %d on domainname 
'%s'\n",
-              r.in.req->req1.level, r.in.req->req1.domain_name);
+       torture_comment(tctx, "testing DsGetDomainControllerInfo level %d on 
domainname '%s'\n",
+                       r.in.req->req1.level, r.in.req->req1.domain_name);
        
-       status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, torture, &r);
+       status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, tctx, &r);
 
-       torture_assert_ntstatus_ok(torture, status, 
-                       "dcerpc_drsuapi_DsGetDomainControllerInfo with dns 
domain failed");
-       torture_assert_werr_ok(torture, r.out.result, 
-                          "DsGetDomainControllerInfo with dns domain failed");
+       torture_assert_ntstatus_ok(tctx, status,
+                                  "dcerpc_drsuapi_DsGetDomainControllerInfo 
with dns domain failed");
+       torture_assert_werr_ok(tctx, r.out.result,
+                               "DsGetDomainControllerInfo with dns domain 
failed");
        
        {
-               const char *dc_account = talloc_asprintf(torture, "%s\\%s$",
+               const char *dc_account = talloc_asprintf(tctx, "%s\\%s$",
                                                         
torture_join_dom_netbios_name(priv->join), 
                                                         
priv->dcinfo.netbios_name);
+               torture_comment(tctx, "%s: Enum active LDAP sessions searching 
for %s\n", __func__, dc_account);
                for (k=0; k < r.out.ctr->ctr01.count; k++) {
                        if 
(strcasecmp_m(r.out.ctr->ctr01.array[k].client_account,
                                         dc_account)) {
@@ -181,7 +176,7 @@ static bool test_DsGetDomainControllerInfo(struct 
dcerpc_pipe *p, struct torture
                                break;
                        }
                }
-               torture_assert(torture, found,
+               torture_assert(tctx, found,
                        "dcerpc_drsuapi_DsGetDomainControllerInfo level: Failed 
to find the domain controller in last logon records");
        }
 
@@ -189,75 +184,55 @@ static bool test_DsGetDomainControllerInfo(struct 
dcerpc_pipe *p, struct torture
        return true;
 }
 
-static bool test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
+static bool test_DsWriteAccountSpn(struct torture_context *tctx,
                                   struct DsPrivate *priv)
 {
        NTSTATUS status;
+       struct dcerpc_pipe *p = priv->pipe;
        struct drsuapi_DsWriteAccountSpn r;
        union drsuapi_DsWriteAccountSpnRequest req;
        struct drsuapi_DsNameString names[2];
        union drsuapi_DsWriteAccountSpnResult res;
        int32_t level_out;
-       bool ret = true;
 
        r.in.bind_handle                = &priv->bind_handle;
        r.in.level                      = 1;
        r.in.req                        = &req;
 
-       printf("testing DsWriteAccountSpn\n");
+       torture_comment(tctx, "testing DsWriteAccountSpn\n");
 
        r.in.req->req1.operation        = DRSUAPI_DS_SPN_OPERATION_ADD;
        r.in.req->req1.unknown1 = 0;
        r.in.req->req1.object_dn        = priv->dcinfo.computer_dn;
        r.in.req->req1.count            = 2;
        r.in.req->req1.spn_names        = names;
-       names[0].str = talloc_asprintf(mem_ctx, 
"smbtortureSPN/%s",priv->dcinfo.netbios_name);
-       names[1].str = talloc_asprintf(mem_ctx, 
"smbtortureSPN/%s",priv->dcinfo.dns_name);
+       names[0].str = talloc_asprintf(tctx, 
"smbtortureSPN/%s",priv->dcinfo.netbios_name);
+       names[1].str = talloc_asprintf(tctx, 
"smbtortureSPN/%s",priv->dcinfo.dns_name);
 
        r.out.res                       = &res;
        r.out.level_out                 = &level_out;
 
-       status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r);
-       if (!NT_STATUS_IS_OK(status)) {
-               const char *errstr = nt_errstr(status);
-               if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
-                       errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
-               }
-               printf("dcerpc_drsuapi_DsWriteAccountSpn failed - %s\n", 
errstr);
-               ret = false;
-       } else if (!W_ERROR_IS_OK(r.out.result)) {
-               printf("DsWriteAccountSpn failed - %s\n", 
win_errstr(r.out.result));
-               ret = false;
-       }
+       status = dcerpc_drsuapi_DsWriteAccountSpn(p, tctx, &r);
+       torture_drsuapi_assert_call(tctx, p, status, &r, 
"dcerpc_drsuapi_DsWriteAccountSpn");
 
        r.in.req->req1.operation        = DRSUAPI_DS_SPN_OPERATION_DELETE;
        r.in.req->req1.unknown1         = 0;
 
-       status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r);
-       if (!NT_STATUS_IS_OK(status)) {
-               const char *errstr = nt_errstr(status);
-               if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
-                       errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
-               }
-               printf("dcerpc_drsuapi_DsWriteAccountSpn failed - %s\n", 
errstr);
-               ret = false;
-       } else if (!W_ERROR_IS_OK(r.out.result)) {
-               printf("DsWriteAccountSpn failed - %s\n", 
win_errstr(r.out.result));
-               ret = false;
-       }
+       status = dcerpc_drsuapi_DsWriteAccountSpn(p, tctx, &r);
+       torture_drsuapi_assert_call(tctx, p, status, &r, 
"dcerpc_drsuapi_DsWriteAccountSpn");
 
-       return ret;
+       return true;
 }
 
-static bool test_DsReplicaGetInfo(struct dcerpc_pipe *p, struct 
torture_context *tctx,
-                       struct DsPrivate *priv)
+static bool test_DsReplicaGetInfo(struct torture_context *tctx,
+                                 struct DsPrivate *priv)
 {
        NTSTATUS status;
+       struct dcerpc_pipe *p = priv->pipe;
        struct drsuapi_DsReplicaGetInfo r;
        union drsuapi_DsReplicaGetInfoRequest req;
        union drsuapi_DsReplicaInfo info;
        enum drsuapi_DsReplicaInfoType info_type;
-       bool ret = true;
        int i;
        struct {
                int32_t level;
@@ -328,7 +303,7 @@ static bool test_DsReplicaGetInfo(struct dcerpc_pipe *p, 
struct torture_context
        };
 
        if (torture_setting_bool(tctx, "samba4", false)) {
-               printf("skipping DsReplicaGetInfo test against Samba4\n");
+               torture_comment(tctx, "skipping DsReplicaGetInfo test against 
Samba4\n");
                return true;
        }
 
@@ -338,8 +313,8 @@ static bool test_DsReplicaGetInfo(struct dcerpc_pipe *p, 
struct torture_context
        for (i=0; i < ARRAY_SIZE(array); i++) {
                const char *object_dn;
 
-               printf("testing DsReplicaGetInfo level %d infotype %d\n",
-                       array[i].level, array[i].infotype);
+               torture_comment(tctx, "testing DsReplicaGetInfo level %d 
infotype %d\n",
+                               array[i].level, array[i].infotype);
 
                object_dn = (array[i].obj_dn ? array[i].obj_dn : 
priv->domain_obj_dn);
 
@@ -365,32 +340,24 @@ static bool test_DsReplicaGetInfo(struct dcerpc_pipe *p, 
struct torture_context
                r.out.info_type         = &info_type;
 
                status = dcerpc_drsuapi_DsReplicaGetInfo(p, tctx, &r);
-               if (!NT_STATUS_IS_OK(status)) {
-                       const char *errstr = nt_errstr(status);
-                       if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) 
{
-                               errstr = dcerpc_errstr(tctx, 
p->last_fault_code);
-                       }
-                       if (p->last_fault_code != DCERPC_FAULT_INVALID_TAG) {
-                               printf("dcerpc_drsuapi_DsReplicaGetInfo failed 
- %s\n", errstr);
-                               ret = false;
-                       } else {
-                               printf("DsReplicaGetInfo level %d and/or 
infotype %d not supported by server\n",
+               torture_drsuapi_assert_call(tctx, p, status, &r, 
"dcerpc_drsuapi_DsReplicaGetInfo");
+               if (!NT_STATUS_IS_OK(status) && p->last_fault_code == 
DCERPC_FAULT_INVALID_TAG) {
+                       torture_comment(tctx,
+                                       "DsReplicaGetInfo level %d and/or 
infotype %d not supported by server\n",
                                        array[i].level, array[i].infotype);
-                       }
-               } else if (!W_ERROR_IS_OK(r.out.result)) {
-                       printf("DsReplicaGetInfo failed - %s\n", 
win_errstr(r.out.result));
-                       ret = false;
+               } else {
+                       torture_drsuapi_assert_call(tctx, p, status, &r, 
"dcerpc_drsuapi_DsReplicaGetInfo");
                }
        }
 
-       return ret;
+       return true;
 }
 
-static bool test_DsReplicaSync(struct dcerpc_pipe *p, struct torture_context 
*tctx,
-                       struct DsPrivate *priv)
+static bool test_DsReplicaSync(struct torture_context *tctx,
+                               struct DsPrivate *priv)
 {
        NTSTATUS status;
-       bool ret = true;
+       struct dcerpc_pipe *p = priv->pipe;
        int i;
        struct drsuapi_DsReplicaSync r;
        struct drsuapi_DsReplicaObjectIdentifier nc;
@@ -405,12 +372,12 @@ static bool test_DsReplicaSync(struct dcerpc_pipe *p, 
struct torture_context *tc
        };
 
        if (!torture_setting_bool(tctx, "dangerous", false)) {
-               printf("DsReplicaSync disabled - enable dangerous tests to 
use\n");
+               torture_comment(tctx, "DsReplicaSync disabled - enable 
dangerous tests to use\n");
                return true;
        }
 
        if (torture_setting_bool(tctx, "samba4", false)) {
-               printf("skipping DsReplicaSync test against Samba4\n");
+               torture_comment(tctx, "skipping DsReplicaSync test against 
Samba4\n");
                return true;
        }
 
@@ -420,8 +387,8 @@ static bool test_DsReplicaSync(struct dcerpc_pipe *p, 
struct torture_context *tc
        r.in.bind_handle        = &priv->bind_handle;
 
        for (i=0; i < ARRAY_SIZE(array); i++) {
-               printf("testing DsReplicaSync level %d\n",
-                       array[i].level);
+               torture_comment(tctx, "testing DsReplicaSync level %d\n",
+                               array[i].level);
 
                r.in.level = array[i].level;
                switch(r.in.level) {
@@ -438,27 +405,17 @@ static bool test_DsReplicaSync(struct dcerpc_pipe *p, 
struct torture_context *tc
                }
 
                status = dcerpc_drsuapi_DsReplicaSync(p, tctx, &r);
-               if (!NT_STATUS_IS_OK(status)) {
-                       const char *errstr = nt_errstr(status);
-                       if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) 
{
-                               errstr = dcerpc_errstr(tctx, 
p->last_fault_code);
-                       }
-                       printf("dcerpc_drsuapi_DsReplicaSync failed - %s\n", 
errstr);
-                       ret = false;
-               } else if (!W_ERROR_IS_OK(r.out.result)) {
-                       printf("DsReplicaSync failed - %s\n", 
win_errstr(r.out.result));
-                       ret = false;
-               }
+               torture_drsuapi_assert_call(tctx, p, status, &r, 
"dcerpc_drsuapi_DsReplicaSync");
        }
 
-       return ret;
+       return true;
 }
 
-static bool test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, struct 
torture_context *tctx,
-                       struct DsPrivate *priv)
+static bool test_DsReplicaUpdateRefs(struct torture_context *tctx,
+                                    struct DsPrivate *priv)
 {
        NTSTATUS status;
-       bool ret = true;
+       struct dcerpc_pipe *p = priv->pipe;
        int i;
        struct drsuapi_DsReplicaUpdateRefs r;
        struct drsuapi_DsReplicaObjectIdentifier nc;
@@ -473,7 +430,7 @@ static bool test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, 
struct torture_conte
        };
 
        if (torture_setting_bool(tctx, "samba4", false)) {
-               printf("skipping DsReplicaUpdateRefs test against Samba4\n");
+               torture_comment(tctx, "skipping DsReplicaUpdateRefs test 
against Samba4\n");
                return true;
        }
 
@@ -483,15 +440,15 @@ static bool test_DsReplicaUpdateRefs(struct dcerpc_pipe 
*p, struct torture_conte
        r.in.bind_handle        = &priv->bind_handle;
 
        for (i=0; i < ARRAY_SIZE(array); i++) {
-               printf("testing DsReplicaUpdateRefs level %d\n",
-                       array[i].level);
+               torture_comment(tctx, "testing DsReplicaUpdateRefs level %d\n",
+                               array[i].level);
 
                r.in.level = array[i].level;
                switch(r.in.level) {
                case 1:
                        nc.guid                         = null_guid;
                        nc.sid                          = null_sid;
-                       nc.dn                           = 
priv->domain_obj_dn?priv->domain_obj_dn:"";
+                       nc.dn                           = priv->domain_obj_dn ? 
priv->domain_obj_dn : "";
 
                        r.in.req.req1.naming_context    = &nc;
                        r.in.req.req1.dest_dsa_dns_name = talloc_asprintf(tctx, 
"__some_dest_dsa_guid_string._msdn.%s",
@@ -502,27 +459,17 @@ static bool test_DsReplicaUpdateRefs(struct dcerpc_pipe 
*p, struct torture_conte
                }
 
                status = dcerpc_drsuapi_DsReplicaUpdateRefs(p, tctx, &r);
-               if (!NT_STATUS_IS_OK(status)) {
-                       const char *errstr = nt_errstr(status);
-                       if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) 
{
-                               errstr = dcerpc_errstr(tctx, 
p->last_fault_code);
-                       }
-                       printf("dcerpc_drsuapi_DsReplicaUpdateRefs failed - 
%s\n", errstr);
-                       ret = false;
-               } else if (!W_ERROR_IS_OK(r.out.result)) {
-                       printf("DsReplicaUpdateRefs failed - %s\n", 
win_errstr(r.out.result));
-                       ret = false;
-               }
+               torture_drsuapi_assert_call(tctx, p, status, &r, 
"dcerpc_drsuapi_DsReplicaUpdateRefs");
        }
 
-       return ret;
+       return true;
 }
 
-static bool test_DsGetNCChanges(struct dcerpc_pipe *p, struct torture_context 
*tctx, 
-                       struct DsPrivate *priv)
+static bool test_DsGetNCChanges(struct torture_context *tctx,
+                               struct DsPrivate *priv)
 {
        NTSTATUS status;
-       bool ret = true;
+       struct dcerpc_pipe *p = priv->pipe;
        int i;
        struct drsuapi_DsGetNCChanges r;
        union drsuapi_DsGetNCChangesRequest req;
@@ -543,7 +490,7 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, 
struct torture_context *t
        };
 
        if (torture_setting_bool(tctx, "samba4", false)) {
-               printf("skipping DsGetNCChanges test against Samba4\n");
+               torture_comment(tctx, "skipping DsGetNCChanges test against 
Samba4\n");
                return true;
        }
 
@@ -551,8 +498,9 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, 
struct torture_context *t
        ZERO_STRUCT(null_sid);
 
        for (i=0; i < ARRAY_SIZE(array); i++) {
-               printf("testing DsGetNCChanges level %d\n",
-                       array[i].level);
+               torture_comment(tctx,
+                               "testing DsGetNCChanges level %d\n",
+                               array[i].level);
 
                r.in.bind_handle        = &priv->bind_handle;
                r.in.level              = array[i].level;
@@ -563,7 +511,7 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, 
struct torture_context *t
                case 5:
                        nc.guid = null_guid;
                        nc.sid  = null_sid;
-                       nc.dn   = priv->domain_obj_dn?priv->domain_obj_dn:"";
+                       nc.dn   = priv->domain_obj_dn ? priv->domain_obj_dn : 
"";
 
                        r.in.req                                        = &req;
                        r.in.req->req5.destination_dsa_guid             = 
GUID_random();
@@ -574,7 +522,7 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, 
struct torture_context *t
                        r.in.req->req5.highwatermark.highest_usn        = 0;
                        r.in.req->req5.uptodateness_vector              = NULL;
                        r.in.req->req5.replica_flags                    = 0;
-                       if (lp_parm_bool(tctx->lp_ctx, NULL, 
"drsuapi","compression", false)) {
+                       if (lp_parm_bool(tctx->lp_ctx, NULL, "drsuapi", 
"compression", false)) {
                                r.in.req->req5.replica_flags            |= 
DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
                        }
                        r.in.req->req5.max_object_count                 = 0;
@@ -586,7 +534,7 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, 
struct torture_context *t
                case 8:
                        nc.guid = null_guid;
                        nc.sid  = null_sid;
-                       nc.dn   = priv->domain_obj_dn?priv->domain_obj_dn:"";
+                       nc.dn   = priv->domain_obj_dn ? priv->domain_obj_dn : 
"";
 
                        r.in.req                                        = &req;
                        r.in.req->req8.destination_dsa_guid             = 
GUID_random();
@@ -621,161 +569,77 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, 
struct torture_context *t
                }
 
                status = dcerpc_drsuapi_DsGetNCChanges(p, tctx, &r);
-               if (!NT_STATUS_IS_OK(status)) {
-                       const char *errstr = nt_errstr(status);
-                       if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) 
{
-                               errstr = dcerpc_errstr(tctx, 
p->last_fault_code);
-                       }
-                       printf("dcerpc_drsuapi_DsGetNCChanges failed - %s\n", 
errstr);
-                       ret = false;
-               } else if (!W_ERROR_IS_OK(r.out.result)) {
-                       printf("DsGetNCChanges failed - %s\n", 
win_errstr(r.out.result));
-                       ret = false;
-               }
+               torture_drsuapi_assert_call(tctx, p, status, &r, 
"dcerpc_drsuapi_DsGetNCChanges");
        }
 
-       return ret;
+       return true;
 }
 
-bool test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+bool test_QuerySitesByCost(struct torture_context *tctx,
                           struct DsPrivate *priv)
 {
        NTSTATUS status;
+       struct dcerpc_pipe *p = priv->pipe;
        struct drsuapi_QuerySitesByCost r;
        union drsuapi_QuerySitesByCostRequest req;
-       bool ret = true;
 
        const char *my_site = "Default-First-Site-Name";
        const char *remote_site1 = "smbtorture-nonexisting-site1";
        const char *remote_site2 = "smbtorture-nonexisting-site2";
 
-       req.req1.site_from = talloc_strdup(mem_ctx, my_site);
+       req.req1.site_from = talloc_strdup(tctx, my_site);
        req.req1.num_req = 2;
-       req.req1.site_to = talloc_zero_array(mem_ctx, const char *, 2);
-       req.req1.site_to[0] = talloc_strdup(mem_ctx, remote_site1);
-       req.req1.site_to[1] = talloc_strdup(mem_ctx, remote_site2);
+       req.req1.site_to = talloc_zero_array(tctx, const char *, 2);
+       req.req1.site_to[0] = talloc_strdup(tctx, remote_site1);
+       req.req1.site_to[1] = talloc_strdup(tctx, remote_site2);
        req.req1.flags = 0;
 
        r.in.bind_handle = &priv->bind_handle;
        r.in.level = 1;
        r.in.req = &req;
 
-       status = dcerpc_drsuapi_QuerySitesByCost(p, mem_ctx, &r);
-       if (!NT_STATUS_IS_OK(status)) {
-               const char *errstr = nt_errstr(status);
-               if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
-                       errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
-               }
-               printf("drsuapi_QuerySitesByCost - %s\n", errstr);


-- 
Samba Shared Repository

Reply via email to