#include "librpc/gen_ndr/drsuapi.h"
+/**
+ * Data structure common for most of DRSUAPI tests
+ */
struct DsPrivate {
struct dcerpc_pipe *pipe;
struct policy_handle bind_handle;
struct test_join *join;
};
+
+/**
+ * Custom torture macro to check dcerpc_drsuapi_ call
+ * return values printing more friendly messages
+ * \param _tctx torture context
+ * \param _p DCERPC pipe handle
+ * \param _ntstatus NTSTATUS for dcerpc_drsuapi_ call
+ * \param _pr in/out DCEPRC request structure
+ * \param _msg error message prefix
+ */
+#define torture_drsuapi_assert_call(_tctx, _p, _ntstat, _pr, _msg) \
+ do { \
+ NTSTATUS __nt = _ntstat; \
+ if (!NT_STATUS_IS_OK(__nt)) { \
+ const char *errstr = nt_errstr(__nt); \
+ if (NT_STATUS_EQUAL(__nt, NT_STATUS_NET_WRITE_FAULT)) { \
+ errstr = dcerpc_errstr(_tctx, _p->last_fault_code); \
+ } \
+ torture_fail(tctx, talloc_asprintf(_tctx, "%s failed - %s", _msg, errstr)); \
+ } \
+ torture_assert_werr_ok(_tctx, (_pr)->out.result, _msg); \
+ } while(0)
+