summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/samba4-knownfail4
-rw-r--r--source4/samba4-skip12
-rwxr-xr-xsource4/selftest/test_rpc.sh19
-rw-r--r--source4/torture/rpc/drsuapi.c165
-rw-r--r--source4/torture/rpc/lsa_lookup.c83
-rw-r--r--source4/torture/rpc/rpc.c2
-rw-r--r--source4/torture/rpc/scanner.c6
7 files changed, 118 insertions, 173 deletions
diff --git a/source4/samba4-knownfail b/source4/samba4-knownfail
index 02d024726e..1f65bb631f 100644
--- a/source4/samba4-knownfail
+++ b/source4/samba4-knownfail
@@ -13,3 +13,7 @@ RPC-HANDLES.*/mixed-shared
RPC-EPMAPPER.*/Insert
RPC-EPMAPPER.*/InqObject
RPC-DFS.*
+RPC-DRSUAPI.*
+RPC-LSALOOKUP
+RPC-CRACKNAMES
+blackbox.smbclient.*USER and PASSWD
diff --git a/source4/samba4-skip b/source4/samba4-skip
index 4a09985406..d9159a4199 100644
--- a/source4/samba4-skip
+++ b/source4/samba4-skip
@@ -12,10 +12,6 @@ BASE-SCAN-MAXFID
RAW-BENCH-OPLOCK
RAW-HOLD-OPLOCK
RAW-PING-PONG
-RAW-SAMBA3HIDE
-RAW-SAMBA3CLOSEERR
-RAW-SAMBA3CHECKFSP
-RAW-SAMBA3BADPATH
RAW-SCAN-EAMAX
RAW-QFILEINFO-IPC
BASE-UTABLE
@@ -26,7 +22,6 @@ ntvfs/cifs BASE-CHARSET
ntvfs/cifs BASE-DEFER_OPEN
ntvfs/cifs BASE-DELAYWRITE
ntvfs/cifs BASE-IOMETER
-ntvfs/cifs BASE-SAMBA3ERROR
ntvfs/cifs BASE-CASETABLE
ntvfs/cifs BASE-NTTRANS
ntvfs/cifs BASE-BENCH-HOLDCON
@@ -37,14 +32,11 @@ ntvfs/cifs RAW-COMPOSITE
ntvfs/cifs RAW-OPLOCK
ntvfs/cifs RAW-NOTIFY
ntvfs/cifs RAW-BENCH-OPLOCK
-ntvfs/cifs RAW-SAMBA3HIDE
-ntvfs/cifs RAW-SAMBA3CLOSEERR
-ntvfs/cifs RAW-SAMBA3CHECKFSP
-ntvfs/cifs RAW-SAMBA3BADPATH
ntvfs/cifs RAW-SCAN-EAMAX
ntvfs/cifs RAW-CONTEXT
ntvfs/cifs RAW-QFILEINFO-IPC
RPC-DSSYNC
RPC-SAMSYNC
LDAP-UPTODATEVECTOR
-RAW-SAMBA3POSIXTIMEDLOCK
+RPC-SCANNER
+.*SAMBA3.*
diff --git a/source4/selftest/test_rpc.sh b/source4/selftest/test_rpc.sh
index adcab0af39..7400356fe4 100755
--- a/source4/selftest/test_rpc.sh
+++ b/source4/selftest/test_rpc.sh
@@ -1,10 +1,12 @@
#!/bin/sh
+
+
# add tests to this list as they start passing, so we test
# that they stay passing
-ncacn_np_tests="RPC-SPOOLSS RPC-SRVSVC RPC-UNIXINFO RPC-SCHANNEL RPC-JOIN RPC-LSA RPC-ECHO RPC-DSSETUP RPC-ALTERCONTEXT RPC-MULTIBIND RPC-NETLOGON RPC-MGMT RPC-HANDLES RPC-WINREG RPC-WKSSVC RPC-SVCCTL RPC-EPMAPPER RPC-INITSHUTDOWN RPC-EVENTLOG RPC-ATSVC RPC-SAMSYNC RPC-OXIDRESOLVE RPC-DFS"
-ncalrpc_tests="RPC-MGMT RPC-UNIXINFO RPC-SCHANNEL RPC-JOIN RPC-LSA RPC-ECHO RPC-DSSETUP RPC-ALTERCONTEXT RPC-MULTIBIND RPC-NETLOGON RPC-WINREG RPC-WKSSVC RPC-SVCCTL RPC-EPMAPPER RPC-EVENTLOG RPC-ATSVC RPC-INITSHUTDOWN RPC-OXIDRESOLVE RPC-DFS"
-ncacn_ip_tcp_tests="RPC-UNIXINFO RPC-SCHANNEL RPC-JOIN RPC-LSA RPC-ECHO RPC-DSSETUP RPC-ALTERCONTEXT RPC-MULTIBIND RPC-NETLOGON RPC-MGMT RPC-HANDLES RPC-WINREG RPC-WKSSVC RPC-SVCCTL RPC-EPMAPPER RPC-ATSVC RPC-EVENTLOG RPC-DSSYNC RPC-OXIDRESOLVE RPC-DFS"
+ncacn_np_tests="RPC-SPOOLSS RPC-SRVSVC RPC-UNIXINFO RPC-SCHANNEL RPC-JOIN RPC-LSA RPC-ECHO RPC-DSSETUP RPC-ALTERCONTEXT RPC-MULTIBIND RPC-NETLOGON RPC-MGMT RPC-HANDLES RPC-WINREG RPC-WKSSVC RPC-SVCCTL RPC-EPMAPPER RPC-INITSHUTDOWN RPC-EVENTLOG RPC-ATSVC RPC-SAMSYNC RPC-DFS RPC-OXIDRESOLVE RPC-REMACT RPC-SAMBA3SESSIONKEY RPC-SAMBA3-SRVSVC RPC-SAMBA3-SHARESEC RPC-SAMBA3-GETUSERNAME RPC-SAMBA3-LSA RPC-SAMBA3-SPOOLSS RPC-SAMBA3-WKSSVC RPC-BINDSAMBA3 RPC-NETLOGSAMBA3 RPC-SAMBA3-WINREG RPC-ASYNCBIND RPC-LSALOOKUP RPC-LSA-GETUSER RPC-SCHANNEL2 RPC-BENCH-RPC RPC-SCANNER RPC-AUTOIDL RPC-AUTHCONTEXT"
+ncalrpc_tests="RPC-MGMT RPC-UNIXINFO RPC-SCHANNEL RPC-JOIN RPC-LSA RPC-ECHO RPC-DSSETUP RPC-ALTERCONTEXT RPC-MULTIBIND RPC-NETLOGON RPC-WINREG RPC-WKSSVC RPC-SVCCTL RPC-EPMAPPER RPC-EVENTLOG RPC-ATSVC RPC-INITSHUTDOWN RPC-DFS RPC-OXIDRESOLVE RPC-REMACT RPC-DRSUAPI RPC-ASYNCBIND RPC-LSALOOKUP RPC-LSA-GETUSER RPC-SCHANNEL2 RPC-BENCH-RPC RPC-SCANNER RPC-AUTOIDL RPC-AUTHCONTEXT"
+ncacn_ip_tcp_tests="RPC-UNIXINFO RPC-SCHANNEL RPC-JOIN RPC-LSA RPC-ECHO RPC-DSSETUP RPC-ALTERCONTEXT RPC-MULTIBIND RPC-NETLOGON RPC-MGMT RPC-HANDLES RPC-WINREG RPC-WKSSVC RPC-SVCCTL RPC-EPMAPPER RPC-ATSVC RPC-EVENTLOG RPC-DSSYNC RPC-DFS RPC-OXIDRESOLVE RPC-REMACT RPC-ASYNCBIND RPC-LSALOOKUP RPC-LSA-GETUSER RPC-SCHANNEL2 RPC-BENCH-RPC RPC-SCANNER RPC-AUTOIDL RPC-AUTHCONTEXT"
slow_ncacn_np_tests="RPC-SAMLOGON RPC-SAMR RPC-SAMR-USERS RPC-SAMR-PASSWORDS RPC-COUNTCALLS"
slow_ncalrpc_tests="RPC-SAMR RPC-SAMR-PASSWORDS RPC-COUNTCALLS RPC-CRACKNAMES"
slow_ncacn_ip_tcp_tests="RPC-SAMR RPC-SAMR-PASSWORDS RPC-COUNTCALLS RPC-CRACKNAMES"
@@ -12,6 +14,17 @@ slow_ncacn_ip_tcp_tests="RPC-SAMR RPC-SAMR-PASSWORDS RPC-COUNTCALLS RPC-CRACKNAM
incdir=`dirname $0`
. $incdir/test_functions.sh
+all_tests="$ncalrpc_tests $ncacn_np_tests $ncacn_ip_tcp_tests $slow_ncalrpc_tests $slow_ncacn_np_tests $slow_ncacn_ip_tcp_tests RPC-SECRETS"
+
+# Make sure all tests get run
+for t in `bin/smbtorture --list | grep "^RPC-"`
+do
+ if ! echo $all_tests | grep $t > /dev/null
+ then
+ echo "SKIP: $t"
+ fi
+done
+
for bindoptions in seal,padcheck $VALIDATE bigendian; do
for transport in ncalrpc ncacn_np ncacn_ip_tcp; do
case $transport in
diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c
index 606240993f..509bdad353 100644
--- a/source4/torture/rpc/drsuapi.c
+++ b/source4/torture/rpc/drsuapi.c
@@ -28,12 +28,11 @@
#define TEST_MACHINE_NAME "torturetest"
-BOOL test_DsBind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+bool test_DsBind(struct dcerpc_pipe *p, struct torture_context *tctx,
struct DsPrivate *priv)
{
NTSTATUS status;
struct drsuapi_DsBind r;
- BOOL ret = True;
GUID_from_string(DRSUAPI_DS_BIND_GUID, &priv->bind_guid);
@@ -41,30 +40,27 @@ BOOL test_DsBind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r.in.bind_info = NULL;
r.out.bind_handle = &priv->bind_handle;
- printf("testing DsBind\n");
+ torture_comment(tctx, "testing DsBind\n");
- status = dcerpc_drsuapi_DsBind(p, mem_ctx, &r);
+ 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(mem_ctx, p->last_fault_code);
+ errstr = dcerpc_errstr(tctx, p->last_fault_code);
}
- printf("dcerpc_drsuapi_DsBind failed - %s\n", errstr);
- ret = False;
+ torture_fail(tctx, "dcerpc_drsuapi_DsBind failed");
} else if (!W_ERROR_IS_OK(r.out.result)) {
- printf("DsBind failed - %s\n", win_errstr(r.out.result));
- ret = False;
+ torture_fail(tctx, "DsBind failed");
}
- return ret;
+ return true;
}
-static BOOL test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture_context *torture,
struct DsPrivate *priv)
{
NTSTATUS status;
struct drsuapi_DsGetDomainControllerInfo r;
- BOOL ret = True;
BOOL found = False;
int i, j, k;
@@ -101,39 +97,26 @@ static BOOL test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, TALLOC_CTX *me
r.in.req.req1.domain_name = names[j].name;
r.in.req.req1.level = level;
- printf("testing DsGetDomainControllerInfo level %d on domainname '%s'\n",
+ torture_comment(torture,
+ "testing DsGetDomainControllerInfo level %d on domainname '%s'\n",
r.in.req.req1.level, r.in.req.req1.domain_name);
- status = dcerpc_drsuapi_DsGetDomainControllerInfo(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_DsGetDomainControllerInfo level %d\n"
- " with dns domain failed - %s\n",
- r.in.req.req1.level, errstr);
- ret = False;
- } else if (!W_ERROR_EQUAL(r.out.result, names[j].expected)) {
- printf("DsGetDomainControllerInfo level %d\n"
- " with dns domain failed - %s, expected %s\n",
- r.in.req.req1.level, win_errstr(r.out.result),
- win_errstr(names[j].expected));
- ret = False;
- }
+ status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, torture, &r);
+ torture_assert_ntstatus_ok(torture, status,
+ "dcerpc_drsuapi_DsGetDomainControllerInfo with dns domain failed");
+ torture_assert_werr_equal(torture,
+ r.out.result, names[j].expected,
+ "DsGetDomainControllerInfo level with dns domain failed");
if (!W_ERROR_IS_OK(r.out.result)) {
/* If this was an error, we can't read the result structure */
continue;
}
- if (r.in.req.req1.level != r.out.level_out) {
- printf("dcerpc_drsuapi_DsGetDomainControllerInfo level in (%d) != out (%d)\n",
- r.in.req.req1.level, r.out.level_out);
- ret = False;
- /* We can't safely read the result structure */
- continue;
- }
+ torture_assert_int_equal(torture,
+ r.in.req.req1.level, r.out.level_out,
+ "dcerpc_drsuapi_DsGetDomainControllerInfo level");
+
switch (level) {
case 1:
for (k=0; k < r.out.ctr.ctr1.count; k++) {
@@ -155,20 +138,11 @@ static BOOL test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, TALLOC_CTX *me
}
break;
}
- if (!found) {
- printf("dcerpc_drsuapi_DsGetDomainControllerInfo level %d: Failed to find the domain controller (%s) we just created during the join\n",
- r.in.req.req1.level,
- torture_join_netbios_name(priv->join));
- ret = False;
- }
+ torture_assert(torture, found,
+ "dcerpc_drsuapi_DsGetDomainControllerInfo: Failed to find the domain controller we just created during the join");
}
}
- if (lp_parm_bool(-1, "torture", "samba4", False)) {
- printf("skipping DsGetDomainControllerInfo level -1 test against Samba4\n");
- return ret;
- }
-
r.in.bind_handle = &priv->bind_handle;
r.in.level = 1;
@@ -178,25 +152,15 @@ static BOOL test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, TALLOC_CTX *me
printf("testing DsGetDomainControllerInfo level %d on domainname '%s'\n",
r.in.req.req1.level, r.in.req.req1.domain_name);
- status = dcerpc_drsuapi_DsGetDomainControllerInfo(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_DsGetDomainControllerInfo level %d\n"
- " with dns domain failed - %s\n",
- r.in.req.req1.level, errstr);
- ret = False;
- } else if (!W_ERROR_IS_OK(r.out.result)) {
- printf("DsGetDomainControllerInfo level %d\n"
- " with dns domain failed - %s\n",
- r.in.req.req1.level, win_errstr(r.out.result));
- ret = False;
- }
+ status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, torture, &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");
{
- const char *dc_account = talloc_asprintf(mem_ctx, "%s\\%s$",
+ const char *dc_account = talloc_asprintf(torture, "%s\\%s$",
torture_join_dom_netbios_name(priv->join),
priv->dcinfo.netbios_name);
for (k=0; k < r.out.ctr.ctr01.count; k++) {
@@ -206,16 +170,12 @@ static BOOL test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, TALLOC_CTX *me
break;
}
}
- if (!found) {
- printf("dcerpc_drsuapi_DsGetDomainControllerInfo level %d: Failed to find the domain controller (%s) in last logon records\n",
- r.in.req.req1.level,
- dc_account);
- ret = False;
- }
+ torture_assert(torture, found,
+ "dcerpc_drsuapi_DsGetDomainControllerInfo level: Failed to find the domain controller in last logon records");
}
- return ret;
+ return true;
}
static BOOL test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
@@ -728,25 +688,20 @@ BOOL test_DsUnbind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
-BOOL torture_rpc_drsuapi(struct torture_context *torture)
+bool torture_rpc_drsuapi(struct torture_context *torture)
{
NTSTATUS status;
struct dcerpc_pipe *p;
- TALLOC_CTX *mem_ctx;
- BOOL ret = True;
+ bool ret = true;
struct DsPrivate priv;
struct cli_credentials *machine_credentials;
- mem_ctx = talloc_init("torture_rpc_drsuapi");
-
ZERO_STRUCT(priv);
priv.join = torture_join_domain(TEST_MACHINE_NAME, ACB_SVRTRUST,
&machine_credentials);
if (!priv.join) {
- talloc_free(mem_ctx);
- printf("Failed to join as BDC\n");
- return False;
+ torture_fail(torture, "Failed to join as BDC");
}
status = torture_rpc_connection(torture,
@@ -754,31 +709,28 @@ BOOL torture_rpc_drsuapi(struct torture_context *torture)
&ndr_table_drsuapi);
if (!NT_STATUS_IS_OK(status)) {
torture_leave_domain(priv.join);
- talloc_free(mem_ctx);
- return False;
+ torture_fail(torture, "Unable to connect to DRSUAPI pipe");
}
- ret &= test_DsBind(p, mem_ctx, &priv);
+ ret &= test_DsBind(p, torture, &priv);
#if 0
- ret &= test_QuerySitesByCost(p, mem_ctx, &priv);
+ ret &= test_QuerySitesByCost(p, torture, &priv);
#endif
- ret &= test_DsGetDomainControllerInfo(p, mem_ctx, &priv);
-
- ret &= test_DsCrackNames(p, mem_ctx, &priv);
+ ret &= test_DsGetDomainControllerInfo(p, torture, &priv);
- ret &= test_DsWriteAccountSpn(p, mem_ctx, &priv);
+ ret &= test_DsCrackNames(p, torture, &priv);
- ret &= test_DsReplicaGetInfo(p, mem_ctx, &priv);
+ ret &= test_DsWriteAccountSpn(p, torture, &priv);
- ret &= test_DsReplicaSync(p, mem_ctx, &priv);
+ ret &= test_DsReplicaGetInfo(p, torture, &priv);
- ret &= test_DsReplicaUpdateRefs(p, mem_ctx, &priv);
+ ret &= test_DsReplicaSync(p, torture, &priv);
- ret &= test_DsGetNCChanges(p, mem_ctx, &priv);
+ ret &= test_DsReplicaUpdateRefs(p, torture, &priv);
- ret &= test_DsUnbind(p, mem_ctx, &priv);
+ ret &= test_DsGetNCChanges(p, torture, &priv);
- talloc_free(mem_ctx);
+ ret &= test_DsUnbind(p, torture, &priv);
torture_leave_domain(priv.join);
@@ -786,27 +738,22 @@ BOOL torture_rpc_drsuapi(struct torture_context *torture)
}
-BOOL torture_rpc_drsuapi_cracknames(struct torture_context *torture)
+bool torture_rpc_drsuapi_cracknames(struct torture_context *torture)
{
NTSTATUS status;
struct dcerpc_pipe *p;
- TALLOC_CTX *mem_ctx;
- BOOL ret = True;
+ bool ret = true;
struct DsPrivate priv;
struct cli_credentials *machine_credentials;
- mem_ctx = talloc_init("torture_rpc_drsuapi");
-
- printf("Connected to DRAUAPI pipe\n");
+ torture_comment(torture, "Connected to DRSUAPI pipe\n");
ZERO_STRUCT(priv);
priv.join = torture_join_domain(TEST_MACHINE_NAME, ACB_SVRTRUST,
&machine_credentials);
if (!priv.join) {
- talloc_free(mem_ctx);
- printf("Failed to join as BDC\n");
- return False;
+ torture_fail(torture, "Failed to join as BDC\n");
}
status = torture_rpc_connection(torture,
@@ -814,21 +761,19 @@ BOOL torture_rpc_drsuapi_cracknames(struct torture_context *torture)
&ndr_table_drsuapi);
if (!NT_STATUS_IS_OK(status)) {
torture_leave_domain(priv.join);
- talloc_free(mem_ctx);
- return False;
+ torture_fail(torture, "Unable to connect to DRSUAPI pipe");
}
- ret &= test_DsBind(p, mem_ctx, &priv);
+ ret &= test_DsBind(p, torture, &priv);
if (ret) {
/* We don't care if this fails, we just need some info from it */
- test_DsGetDomainControllerInfo(p, mem_ctx, &priv);
+ test_DsGetDomainControllerInfo(p, torture, &priv);
- ret &= test_DsCrackNames(p, mem_ctx, &priv);
+ ret &= test_DsCrackNames(p, torture, &priv);
- ret &= test_DsUnbind(p, mem_ctx, &priv);
+ ret &= test_DsUnbind(p, torture, &priv);
}
- talloc_free(mem_ctx);
torture_leave_domain(priv.join);
diff --git a/source4/torture/rpc/lsa_lookup.c b/source4/torture/rpc/lsa_lookup.c
index d90c3694a9..7cab05257d 100644
--- a/source4/torture/rpc/lsa_lookup.c
+++ b/source4/torture/rpc/lsa_lookup.c
@@ -122,6 +122,7 @@ static const char *sid_type_lookup(enum lsa_SidType r)
case SID_NAME_DELETED: return "SID_NAME_DELETED"; break;
case SID_NAME_INVALID: return "SID_NAME_INVALID"; break;
case SID_NAME_UNKNOWN: return "SID_NAME_UNKNOWN"; break;
+ case SID_NAME_COMPUTER: return "SID_NAME_COMPUTER"; break;
}
return "Invalid sid type\n";
}
@@ -164,7 +165,7 @@ static BOOL test_lookupsids(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p,
return ret;
}
-static BOOL get_downleveltrust(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p,
+static BOOL get_downleveltrust(struct torture_context *tctx, struct dcerpc_pipe *p,
struct policy_handle *handle,
struct dom_sid **sid)
{
@@ -180,16 +181,13 @@ static BOOL get_downleveltrust(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p,
r.out.domains = &domains;
r.out.resume_handle = &resume_handle;
- status = dcerpc_lsa_EnumTrustDom(p, mem_ctx, &r);
+ status = dcerpc_lsa_EnumTrustDom(p, tctx, &r);
- if (NT_STATUS_EQUAL(status, NT_STATUS_NO_MORE_ENTRIES)) {
- printf("no trusts\n");
- return False;
- }
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NO_MORE_ENTRIES))
+ torture_fail(tctx, "no trusts");
if (domains.count == 0) {
- printf("no trusts\n");
- return False;
+ torture_fail(tctx, "no trusts");
}
for (i=0; i<domains.count; i++) {
@@ -201,7 +199,7 @@ static BOOL get_downleveltrust(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p,
q.in.handle = handle;
q.in.dom_sid = domains.domains[i].sid;
q.in.level = 6;
- status = dcerpc_lsa_QueryTrustedDomainInfoBySid(p, mem_ctx, &q);
+ status = dcerpc_lsa_QueryTrustedDomainInfoBySid(p, tctx, &q);
if (!NT_STATUS_IS_OK(status)) continue;
if ((q.out.info->info_ex.trust_direction & 2) &&
@@ -211,52 +209,48 @@ static BOOL get_downleveltrust(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p,
}
}
- printf("I need a AD DC with an outgoing trust to NT4\n");
- return False;
+ torture_fail(tctx, "I need a AD DC with an outgoing trust to NT4");
}
#define NUM_SIDS 8
-BOOL torture_rpc_lsa_lookup(struct torture_context *torture)
+bool torture_rpc_lsa_lookup(struct torture_context *torture)
{
NTSTATUS status;
struct dcerpc_pipe *p;
- TALLOC_CTX *mem_ctx;
BOOL ret = True;
struct policy_handle *handle;
struct dom_sid *dom_sid;
struct dom_sid *trusted_sid;
struct dom_sid *sids[NUM_SIDS];
- mem_ctx = talloc_init("torture_rpc_lsa");
-
status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
- ret = False;
- goto done;
+ torture_fail(torture, "unable to connect to table");
}
- ret &= open_policy(mem_ctx, p, &handle);
- if (!ret) goto done;
+ ret &= open_policy(torture, p, &handle);
+ if (!ret) return false;
- ret &= get_domainsid(mem_ctx, p, handle, &dom_sid);
- if (!ret) goto done;
+ ret &= get_domainsid(torture, p, handle, &dom_sid);
+ if (!ret) return false;
- ret &= get_downleveltrust(mem_ctx, p, handle, &trusted_sid);
- if (!ret) goto done;
+ ret &= get_downleveltrust(torture, p, handle, &trusted_sid);
+ if (!ret) return false;
- printf("domain sid: %s\n", dom_sid_string(mem_ctx, dom_sid));
+ torture_comment(torture, "domain sid: %s\n",
+ dom_sid_string(torture, dom_sid));
- sids[0] = dom_sid_parse_talloc(mem_ctx, "S-1-1-0");
- sids[1] = dom_sid_parse_talloc(mem_ctx, "S-1-5-4");
- sids[2] = dom_sid_parse_talloc(mem_ctx, "S-1-5-32");
- sids[3] = dom_sid_parse_talloc(mem_ctx, "S-1-5-32-545");
- sids[4] = dom_sid_dup(mem_ctx, dom_sid);
- sids[5] = dom_sid_add_rid(mem_ctx, dom_sid, 512);
- sids[6] = dom_sid_dup(mem_ctx, trusted_sid);
- sids[7] = dom_sid_add_rid(mem_ctx, trusted_sid, 512);
+ sids[0] = dom_sid_parse_talloc(torture, "S-1-1-0");
+ sids[1] = dom_sid_parse_talloc(torture, "S-1-5-4");
+ sids[2] = dom_sid_parse_talloc(torture, "S-1-5-32");
+ sids[3] = dom_sid_parse_talloc(torture, "S-1-5-32-545");
+ sids[4] = dom_sid_dup(torture, dom_sid);
+ sids[5] = dom_sid_add_rid(torture, dom_sid, 512);
+ sids[6] = dom_sid_dup(torture, trusted_sid);
+ sids[7] = dom_sid_add_rid(torture, trusted_sid, 512);
- ret &= test_lookupsids(mem_ctx, p, handle, sids, NUM_SIDS, 0,
+ ret &= test_lookupsids(torture, p, handle, sids, NUM_SIDS, 0,
NT_STATUS_INVALID_PARAMETER, NULL);
{
@@ -265,7 +259,7 @@ BOOL torture_rpc_lsa_lookup(struct torture_context *torture)
SID_NAME_ALIAS, SID_NAME_DOMAIN, SID_NAME_DOM_GRP,
SID_NAME_DOMAIN, SID_NAME_DOM_GRP };
- ret &= test_lookupsids(mem_ctx, p, handle, sids, NUM_SIDS, 1,
+ ret &= test_lookupsids(torture, p, handle, sids, NUM_SIDS, 1,
NT_STATUS_OK, types);
}
@@ -275,7 +269,7 @@ BOOL torture_rpc_lsa_lookup(struct torture_context *torture)
SID_NAME_UNKNOWN, SID_NAME_UNKNOWN,
SID_NAME_DOMAIN, SID_NAME_DOM_GRP,
SID_NAME_DOMAIN, SID_NAME_DOM_GRP };
- ret &= test_lookupsids(mem_ctx, p, handle, sids, NUM_SIDS, 2,
+ ret &= test_lookupsids(torture, p, handle, sids, NUM_SIDS, 2,
STATUS_SOME_UNMAPPED, types);
}
@@ -285,7 +279,7 @@ BOOL torture_rpc_lsa_lookup(struct torture_context *torture)
SID_NAME_UNKNOWN, SID_NAME_UNKNOWN,
SID_NAME_DOMAIN, SID_NAME_DOM_GRP,
SID_NAME_UNKNOWN, SID_NAME_UNKNOWN };
- ret &= test_lookupsids(mem_ctx, p, handle, sids, NUM_SIDS, 3,
+ ret &= test_lookupsids(torture, p, handle, sids, NUM_SIDS, 3,
STATUS_SOME_UNMAPPED, types);
}
@@ -295,11 +289,11 @@ BOOL torture_rpc_lsa_lookup(struct torture_context *torture)
SID_NAME_UNKNOWN, SID_NAME_UNKNOWN,
SID_NAME_DOMAIN, SID_NAME_DOM_GRP,
SID_NAME_UNKNOWN, SID_NAME_UNKNOWN };
- ret &= test_lookupsids(mem_ctx, p, handle, sids, NUM_SIDS, 4,
+ ret &= test_lookupsids(torture, p, handle, sids, NUM_SIDS, 4,
STATUS_SOME_UNMAPPED, types);
}
- ret &= test_lookupsids(mem_ctx, p, handle, sids, NUM_SIDS, 5,
+ ret &= test_lookupsids(torture, p, handle, sids, NUM_SIDS, 5,
NT_STATUS_NONE_MAPPED, NULL);
{
@@ -308,21 +302,18 @@ BOOL torture_rpc_lsa_lookup(struct torture_context *torture)
SID_NAME_UNKNOWN, SID_NAME_UNKNOWN,
SID_NAME_DOMAIN, SID_NAME_DOM_GRP,
SID_NAME_UNKNOWN, SID_NAME_UNKNOWN };
- ret &= test_lookupsids(mem_ctx, p, handle, sids, NUM_SIDS, 6,
+ ret &= test_lookupsids(torture, p, handle, sids, NUM_SIDS, 6,
STATUS_SOME_UNMAPPED, types);
}
- ret &= test_lookupsids(mem_ctx, p, handle, sids, NUM_SIDS, 7,
+ ret &= test_lookupsids(torture, p, handle, sids, NUM_SIDS, 7,
NT_STATUS_INVALID_PARAMETER, NULL);
- ret &= test_lookupsids(mem_ctx, p, handle, sids, NUM_SIDS, 8,
+ ret &= test_lookupsids(torture, p, handle, sids, NUM_SIDS, 8,
NT_STATUS_INVALID_PARAMETER, NULL);
- ret &= test_lookupsids(mem_ctx, p, handle, sids, NUM_SIDS, 9,
+ ret &= test_lookupsids(torture, p, handle, sids, NUM_SIDS, 9,
NT_STATUS_INVALID_PARAMETER, NULL);
- ret &= test_lookupsids(mem_ctx, p, handle, sids, NUM_SIDS, 10,
+ ret &= test_lookupsids(torture, p, handle, sids, NUM_SIDS, 10,
NT_STATUS_INVALID_PARAMETER, NULL);
- done:
- talloc_free(mem_ctx);
-
return ret;
}
diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c
index af7e05a9f0..365f750c92 100644
--- a/source4/torture/rpc/rpc.c
+++ b/source4/torture/rpc/rpc.c
@@ -303,7 +303,7 @@ NTSTATUS torture_rpc_init(void)
torture_suite_add_simple_test(suite, "SAMBA3-LSA", torture_samba3_rpc_lsa);
torture_suite_add_simple_test(suite, "SAMBA3-SPOOLSS", torture_samba3_rpc_spoolss);
torture_suite_add_simple_test(suite, "SAMBA3-WKSSVC", torture_samba3_rpc_wkssvc);
- torture_suite_add_simple_test(suite, "RPC-SAMBA3-WINREG", torture_samba3_rpc_winreg);
+ torture_suite_add_simple_test(suite, "SAMBA3-WINREG", torture_samba3_rpc_winreg);
torture_suite_add_simple_test(suite, "DRSUAPI", torture_rpc_drsuapi);
torture_suite_add_simple_test(suite, "CRACKNAMES", torture_rpc_drsuapi_cracknames);
torture_suite_add_simple_test(suite, "DSSETUP", torture_rpc_dssetup);
diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c
index b2dd99fd66..e8203061e7 100644
--- a/source4/torture/rpc/scanner.c
+++ b/source4/torture/rpc/scanner.c
@@ -28,7 +28,7 @@
/*
work out how many calls there are for an interface
*/
-static BOOL test_num_calls(struct torture_context *tctx,
+static bool test_num_calls(struct torture_context *tctx,
const struct ndr_interface_table *iface,
TALLOC_CTX *mem_ctx,
struct ndr_syntax_id *id)
@@ -88,12 +88,12 @@ static BOOL test_num_calls(struct torture_context *tctx,
done:
talloc_free(p);
- return True;
+ return true;
}
-BOOL torture_rpc_scanner(struct torture_context *torture)
+bool torture_rpc_scanner(struct torture_context *torture)
{
NTSTATUS status;
struct dcerpc_pipe *p;