summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-11-09 19:24:51 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:45:02 +0100
commit529763a9aa192a6785ba878aceeb1683c2510913 (patch)
tree5fc843ffa644969ecd967d8b4133fc19333c33b5 /source4/torture
parentb2ddeeb79d2622b3fd216465716dfa6b8c3e0b86 (diff)
downloadsamba-529763a9aa192a6785ba878aceeb1683c2510913.tar.gz
samba-529763a9aa192a6785ba878aceeb1683c2510913.tar.bz2
samba-529763a9aa192a6785ba878aceeb1683c2510913.zip
r25920: ndr: change NTSTAUS into enum ndr_err_code (samba4 callers)
lib/messaging/ lib/registry/ lib/ldb-samba/ librpc/rpc/ auth/auth_winbind.c auth/gensec/ auth/kerberos/ dsdb/repl/ dsdb/samdb/ dsdb/schema/ torture/ cluster/ctdb/ kdc/ ntvfs/ipc/ torture/rap/ ntvfs/ utils/getntacl.c ntptr/ smb_server/ libcli/wrepl/ wrepl_server/ libcli/cldap/ libcli/dgram/ libcli/ldap/ libcli/raw/ libcli/nbt/ libnet/ winbind/ rpc_server/ metze (This used to be commit 6223c7fddc972687eb577e04fc1c8e0604c35435)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/auth/pac.c11
-rw-r--r--source4/torture/ldap/uptodatevector.c14
-rw-r--r--source4/torture/ndr/ndr.c19
-rw-r--r--source4/torture/rap/rap.c99
-rw-r--r--source4/torture/rpc/eventlog.c4
-rw-r--r--source4/torture/rpc/samsync.c5
-rw-r--r--source4/torture/rpc/spoolss_notify.c12
-rw-r--r--source4/torture/rpc/winreg.c6
-rw-r--r--source4/torture/ui.h10
9 files changed, 108 insertions, 72 deletions
diff --git a/source4/torture/auth/pac.c b/source4/torture/auth/pac.c
index 30bb53587d..baa3bdf39a 100644
--- a/source4/torture/auth/pac.c
+++ b/source4/torture/auth/pac.c
@@ -262,6 +262,7 @@ static const uint8_t saved_pac[] = {
static bool torture_pac_saved_check(struct torture_context *tctx)
{
NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
DATA_BLOB tmp_blob, validate_blob;
struct PAC_DATA *pac_data, pac_data2;
struct PAC_LOGON_INFO *logon_info;
@@ -514,8 +515,9 @@ static bool torture_pac_saved_check(struct torture_context *tctx)
* pointer, padding etc algorithms as win2k3.
*/
if (tmp_blob.length != validate_blob.length) {
- nt_status = ndr_pull_struct_blob(&validate_blob, mem_ctx, &pac_data2,
- (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
+ ndr_err = ndr_pull_struct_blob(&validate_blob, mem_ctx, &pac_data2,
+ (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
+ nt_status = ndr_map_error2ntstatus(ndr_err);
torture_assert_ntstatus_ok(tctx, nt_status, "can't parse the PAC");
NDR_PRINT_DEBUG(PAC_DATA, pac_data);
@@ -534,8 +536,9 @@ static bool torture_pac_saved_check(struct torture_context *tctx)
}
if (memcmp(tmp_blob.data, validate_blob.data, tmp_blob.length) != 0) {
- nt_status = ndr_pull_struct_blob(&validate_blob, mem_ctx, &pac_data2,
- (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
+ ndr_err = ndr_pull_struct_blob(&validate_blob, mem_ctx, &pac_data2,
+ (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
+ nt_status = ndr_map_error2ntstatus(ndr_err);
torture_assert_ntstatus_ok(tctx, nt_status, "can't parse the PAC");
NDR_PRINT_DEBUG(PAC_DATA, pac_data);
diff --git a/source4/torture/ldap/uptodatevector.c b/source4/torture/ldap/uptodatevector.c
index b3c6e8d555..7b1614af52 100644
--- a/source4/torture/ldap/uptodatevector.c
+++ b/source4/torture/ldap/uptodatevector.c
@@ -43,7 +43,7 @@ static bool test_check_uptodatevector(struct torture_context *torture,
bool ok = true;
uint32_t i;
int ret;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
struct ldb_result *r;
const struct ldb_val *utdv_val1;
struct replUpToDateVectorBlob utdv1;
@@ -70,9 +70,9 @@ static bool test_check_uptodatevector(struct torture_context *torture,
ZERO_STRUCT(utdv1);
utdv_val1 = ldb_msg_find_ldb_val(r->msgs[0], "replUpToDateVector");
if (utdv_val1) {
- status = ndr_pull_struct_blob_all(utdv_val1, torture, &utdv1,
- (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob_all(utdv_val1, torture, &utdv1,
+ (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return false;
}
}
@@ -116,9 +116,9 @@ static bool test_check_uptodatevector(struct torture_context *torture,
ZERO_STRUCT(utdv);
utdv_val = ldb_msg_find_ldb_val(r->msgs[0], "replUpToDateVector");
if (utdv_val) {
- status = ndr_pull_struct_blob_all(utdv_val, torture, &utdv,
- (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob_all(utdv_val, torture, &utdv,
+ (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return false;
}
}
diff --git a/source4/torture/ndr/ndr.c b/source4/torture/ndr/ndr.c
index 18ede54867..e1e2918cba 100644
--- a/source4/torture/ndr/ndr.c
+++ b/source4/torture/ndr/ndr.c
@@ -42,8 +42,8 @@ static bool wrap_ndr_pull_test(struct torture_context *tctx,
ndr->flags |= LIBNDR_FLAG_REF_ALLOC;
- torture_assert_ntstatus_ok(tctx, data->pull_fn(ndr, data->ndr_flags, ds),
- "pulling");
+ torture_assert_ndr_success(tctx, data->pull_fn(ndr, data->ndr_flags, ds),
+ "pulling");
torture_assert(tctx, ndr->offset == ndr->data_size,
talloc_asprintf(tctx,
@@ -99,13 +99,13 @@ static bool test_check_string_terminator(struct torture_context *tctx)
ndr = ndr_pull_init_blob(&blob, mem_ctx);
- torture_assert_ntstatus_ok(tctx, ndr_check_string_terminator(ndr, 1, 2),
- "simple check_string_terminator test failed");
+ torture_assert_ndr_success(tctx, ndr_check_string_terminator(ndr, 1, 2),
+ "simple check_string_terminator test failed");
torture_assert(tctx, ndr->offset == 0,
"check_string_terminator did not reset offset");
- if (NT_STATUS_IS_OK(ndr_check_string_terminator(ndr, 1, 3))) {
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_check_string_terminator(ndr, 1, 3))) {
torture_fail(tctx, "check_string_terminator checked beyond string boundaries");
}
@@ -117,17 +117,16 @@ static bool test_check_string_terminator(struct torture_context *tctx)
blob = strhex_to_data_blob("11220000");
ndr = ndr_pull_init_blob(&blob, mem_ctx);
- torture_assert_ntstatus_ok(tctx,
+ torture_assert_ndr_success(tctx,
ndr_check_string_terminator(ndr, 4, 1),
"check_string_terminator failed to recognize terminator");
- torture_assert_ntstatus_ok(tctx,
+ torture_assert_ndr_success(tctx,
ndr_check_string_terminator(ndr, 3, 1),
"check_string_terminator failed to recognize terminator");
- if (NT_STATUS_IS_OK(ndr_check_string_terminator(ndr, 2, 1))) {
- torture_fail(tctx,
- "check_string_terminator erroneously reported terminator");
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_check_string_terminator(ndr, 2, 1))) {
+ torture_fail(tctx, "check_string_terminator erroneously reported terminator");
}
torture_assert(tctx, ndr->offset == 0,
diff --git a/source4/torture/rap/rap.c b/source4/torture/rap/rap.c
index 483b33dc11..9289577269 100644
--- a/source4/torture/rap/rap.c
+++ b/source4/torture/rap/rap.c
@@ -27,6 +27,32 @@
#include "libcli/libcli.h"
#include "librpc/ndr/libndr.h"
+#define RAP_GOTO(call) do { \
+ NTSTATUS _status; \
+ _status = call; \
+ if (!NT_STATUS_IS_OK(_status)) { \
+ result = _status; \
+ goto done; \
+ } \
+} while (0)
+
+#define NDR_GOTO(call) do { \
+ enum ndr_err_code _ndr_err; \
+ _ndr_err = call; \
+ if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
+ result = ndr_map_error2ntstatus(_ndr_err); \
+ goto done; \
+ } \
+} while (0)
+
+#define NDR_RETURN(call) do { \
+ enum ndr_err_code _ndr_err; \
+ _ndr_err = call; \
+ if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
+ return ndr_map_error2ntstatus(_ndr_err); \
+ } \
+} while (0)
+
struct rap_call {
uint16_t callno;
char *paramdesc;
@@ -141,8 +167,8 @@ static NTSTATUS rap_pull_string(TALLOC_CTX *mem_ctx, struct ndr_pull *ndr,
const char *p;
size_t len;
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &string_offset));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &ignore));
+ NDR_RETURN(ndr_pull_uint16(ndr, NDR_SCALARS, &string_offset));
+ NDR_RETURN(ndr_pull_uint16(ndr, NDR_SCALARS, &ignore));
string_offset -= convert;
@@ -184,14 +210,14 @@ static NTSTATUS rap_cli_do_call(struct smbcli_tree *tree, struct rap_call *call)
trans.in.setup = NULL;
trans.in.trans_name = "\\PIPE\\LANMAN";
- NDR_CHECK(ndr_push_uint16(params, NDR_SCALARS, call->callno));
+ NDR_RETURN(ndr_push_uint16(params, NDR_SCALARS, call->callno));
if (call->paramdesc)
- NDR_CHECK(ndr_push_string(params, NDR_SCALARS, call->paramdesc));
+ NDR_RETURN(ndr_push_string(params, NDR_SCALARS, call->paramdesc));
if (call->datadesc)
- NDR_CHECK(ndr_push_string(params, NDR_SCALARS, call->datadesc));
+ NDR_RETURN(ndr_push_string(params, NDR_SCALARS, call->datadesc));
param_blob = ndr_push_blob(call->ndr_push_param);
- NDR_CHECK(ndr_push_bytes(params, param_blob.data,
+ NDR_RETURN(ndr_push_bytes(params, param_blob.data,
param_blob.length));
trans.in.params = ndr_push_blob(params);
@@ -211,11 +237,6 @@ static NTSTATUS rap_cli_do_call(struct smbcli_tree *tree, struct rap_call *call)
return result;
}
-#define NDR_OK(call) do { NTSTATUS _status; \
- _status = call; \
- if (!NT_STATUS_IS_OK(_status)) \
- goto done; \
- } while (0)
static NTSTATUS smbcli_rap_netshareenum(struct smbcli_tree *tree,
TALLOC_CTX *mem_ctx,
@@ -248,10 +269,10 @@ static NTSTATUS smbcli_rap_netshareenum(struct smbcli_tree *tree,
if (!NT_STATUS_IS_OK(result))
goto done;
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.status));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.count));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.status));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.count));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available));
r->out.info = talloc_array(mem_ctx, union rap_shareenum_info, r->out.count);
@@ -263,17 +284,17 @@ static NTSTATUS smbcli_rap_netshareenum(struct smbcli_tree *tree,
for (i=0; i<r->out.count; i++) {
switch(r->in.level) {
case 0:
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
(uint8_t *)r->out.info[i].info0.name, 13));
break;
case 1:
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
(uint8_t *)r->out.info[i].info1.name, 13));
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
(uint8_t *)&r->out.info[i].info1.pad, 1));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_data,
NDR_SCALARS, &r->out.info[i].info1.type));
- NDR_OK(rap_pull_string(mem_ctx, call->ndr_pull_data,
+ RAP_GOTO(rap_pull_string(mem_ctx, call->ndr_pull_data,
r->out.convert,
&r->out.info[i].info1.comment));
break;
@@ -345,10 +366,10 @@ static NTSTATUS smbcli_rap_netserverenum2(struct smbcli_tree *tree,
result = NT_STATUS_INVALID_PARAMETER;
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.status));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.count));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.status));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.count));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available));
r->out.info = talloc_array(mem_ctx, union rap_server_info, r->out.count);
@@ -360,19 +381,19 @@ static NTSTATUS smbcli_rap_netserverenum2(struct smbcli_tree *tree,
for (i=0; i<r->out.count; i++) {
switch(r->in.level) {
case 0:
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
(uint8_t *)r->out.info[i].info0.name, 16));
break;
case 1:
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
(uint8_t *)r->out.info[i].info1.name, 16));
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
&r->out.info[i].info1.version_major, 1));
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
&r->out.info[i].info1.version_minor, 1));
- NDR_OK(ndr_pull_uint32(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_uint32(call->ndr_pull_data,
NDR_SCALARS, &r->out.info[i].info1.servertype));
- NDR_OK(rap_pull_string(mem_ctx, call->ndr_pull_data,
+ RAP_GOTO(rap_pull_string(mem_ctx, call->ndr_pull_data,
r->out.convert,
&r->out.info[i].info1.comment));
}
@@ -450,25 +471,25 @@ _PUBLIC_ NTSTATUS smbcli_rap_netservergetinfo(struct smbcli_tree *tree,
if (!NT_STATUS_IS_OK(result))
goto done;
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.status));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.status));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available));
switch(r->in.level) {
case 0:
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
(uint8_t *)r->out.info.info0.name, 16));
break;
case 1:
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
(uint8_t *)r->out.info.info1.name, 16));
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
&r->out.info.info1.version_major, 1));
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
&r->out.info.info1.version_minor, 1));
- NDR_OK(ndr_pull_uint32(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_uint32(call->ndr_pull_data,
NDR_SCALARS, &r->out.info.info1.servertype));
- NDR_OK(rap_pull_string(mem_ctx, call->ndr_pull_data,
+ RAP_GOTO(rap_pull_string(mem_ctx, call->ndr_pull_data,
r->out.convert,
&r->out.info.info1.comment));
}
diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c
index c1d863454c..64b012fba6 100644
--- a/source4/torture/rpc/eventlog.c
+++ b/source4/torture/rpc/eventlog.c
@@ -105,6 +105,7 @@ static bool test_ReadEventLog(struct torture_context *tctx,
DATA_BLOB blob;
struct eventlog_Record rec;
struct ndr_pull *ndr;
+ enum ndr_err_code ndr_err;
/* Read first for number of bytes in record */
@@ -138,8 +139,9 @@ static bool test_ReadEventLog(struct torture_context *tctx,
ndr = ndr_pull_init_blob(&blob, tctx);
- status = ndr_pull_eventlog_Record(
+ ndr_err = ndr_pull_eventlog_Record(
ndr, NDR_SCALARS|NDR_BUFFERS, &rec);
+ status = ndr_map_error2ntstatus(ndr_err);
NDR_PRINT_DEBUG(eventlog_Record, &rec);
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index 6f76e3b58b..a7cde8af4f 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -544,11 +544,12 @@ static bool samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy
if (user->user_private_info.SensitiveData) {
DATA_BLOB data;
struct netr_USER_KEYS keys;
+ enum ndr_err_code ndr_err;
data.data = user->user_private_info.SensitiveData;
data.length = user->user_private_info.DataLength;
creds_arcfour_crypt(samsync_state->creds, data.data, data.length);
- nt_status = ndr_pull_struct_blob(&data, mem_ctx, &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS);
- if (NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_pull_struct_blob(&data, mem_ctx, &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS);
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
if (keys.keys.keys2.lmpassword.length == 16) {
sam_rid_crypt(rid, keys.keys.keys2.lmpassword.pwd.hash, lm_hash.hash, 0);
lm_hash_p = &lm_hash;
diff --git a/source4/torture/rpc/spoolss_notify.c b/source4/torture/rpc/spoolss_notify.c
index e44c2a874b..bffbd1108c 100644
--- a/source4/torture/rpc/spoolss_notify.c
+++ b/source4/torture/rpc/spoolss_notify.c
@@ -44,7 +44,7 @@ static void spoolss__op_unbind(struct dcesrv_connection_context *context, const
static NTSTATUS spoolss__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
{
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
uint16_t opnum = dce_call->pkt.u.request.opnum;
dce_call->fault_code = 0;
@@ -58,8 +58,8 @@ static NTSTATUS spoolss__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_
NT_STATUS_HAVE_NO_MEMORY(*r);
/* unravel the NDR for the packet */
- status = ndr_table_spoolss.calls[opnum].ndr_pull(pull, NDR_IN, *r);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_table_spoolss.calls[opnum].ndr_pull(pull, NDR_IN, *r);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
dcerpc_log_packet(&ndr_table_spoolss, opnum, NDR_IN,
&dce_call->pkt.u.request.stub_and_verifier);
dce_call->fault_code = DCERPC_FAULT_NDR;
@@ -117,11 +117,11 @@ static NTSTATUS spoolss__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX
static NTSTATUS spoolss__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
{
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
uint16_t opnum = dce_call->pkt.u.request.opnum;
- status = ndr_table_spoolss.calls[opnum].ndr_push(push, NDR_OUT, r);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_table_spoolss.calls[opnum].ndr_push(push, NDR_OUT, r);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
dce_call->fault_code = DCERPC_FAULT_NDR;
return NT_STATUS_NET_WRITE_FAULT;
}
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 2ce1fa768c..45954f2c71 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -155,7 +155,7 @@ static bool test_CreateKey_sd(struct dcerpc_pipe *p,
SEC_ACE_FLAG_CONTAINER_INHERIT,
NULL);
- torture_assert_ntstatus_ok(tctx,
+ torture_assert_ndr_success(tctx,
ndr_push_struct_blob(&sdblob, tctx, sd,
(ndr_push_flags_fn_t)ndr_push_security_descriptor),
"Failed to push security_descriptor ?!\n");
@@ -220,7 +220,7 @@ static bool _test_GetKeySecurity(struct dcerpc_pipe *p,
sd = talloc_zero(tctx, struct security_descriptor);
- torture_assert_ntstatus_ok(tctx,
+ torture_assert_ndr_success(tctx,
ndr_pull_struct_blob(&sdblob, tctx, sd,
(ndr_pull_flags_fn_t)ndr_pull_security_descriptor),
"pull_security_descriptor failed");
@@ -264,7 +264,7 @@ static bool _test_SetKeySecurity(struct dcerpc_pipe *p,
NDR_PRINT_DEBUG(security_descriptor, sd);
}
- torture_assert_ntstatus_ok(tctx,
+ torture_assert_ndr_success(tctx,
ndr_push_struct_blob(&sdblob, tctx, sd,
(ndr_push_flags_fn_t)ndr_push_security_descriptor),
"push_security_descriptor failed");
diff --git a/source4/torture/ui.h b/source4/torture/ui.h
index 71c2122315..ebf7844ae2 100644
--- a/source4/torture/ui.h
+++ b/source4/torture/ui.h
@@ -223,6 +223,13 @@ void torture_result(struct torture_context *test,
}\
} while(0)
+#define torture_assert_ndr_err_equal(torture_ctx,got,expected,cmt) \
+ do { enum ndr_err_code __got = got, __expected = expected; \
+ if (__got != __expected) { \
+ torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %d, expected %d (%s): %s", __got, __expected, __STRING(expected), cmt); \
+ return false; \
+ }\
+ } while(0)
#define torture_assert_casestr_equal(torture_ctx,got,expected,cmt) \
do { const char *__got = (got), *__expected = (expected); \
@@ -334,6 +341,9 @@ void torture_result(struct torture_context *test,
#define torture_assert_werr_ok(torture_ctx,expr,cmt) \
torture_assert_werr_equal(torture_ctx,expr,WERR_OK,cmt)
+#define torture_assert_ndr_success(torture_ctx,expr,cmt) \
+ torture_assert_ndr_err_equal(torture_ctx,expr,NDR_ERR_SUCCESS,cmt)
+
/* Getting settings */
const char *torture_setting_string(struct torture_context *test, \
const char *name,