testprogs/win32/midltests: add support for DCERPC fault for midltests_tcp
authorStefan Metzmacher <metze@samba.org>
Wed, 6 Nov 2013 16:33:45 +0000 (17:33 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 4 Jun 2019 11:15:20 +0000 (13:15 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
testprogs/win32/midltests/midltests.idl
testprogs/win32/midltests/midltests_tcp.c

index 0c0bbf8d3d3f58fa0414a3d1516f91a69abcd9e8..14b53febdb7f9d2a5fc2278008e84e48ccb8e370 100644 (file)
@@ -36,9 +36,21 @@ interface midltests
 
 #elif MIDLTESTS_C_CODE
 
+#define MIDLTEST_RPCCALL_EX(x, f) do { \
+       printf("LINE[%d] before\n", __LINE__); \
+       RpcTryExcept { \
+               x; \
+       } RpcExcept(((f) == -1) || (((f) != 0) && (RpcExceptionCode() == (f)))) { \
+               printf("LINE[%d] RpcExceptionCode(0x%x)\n", \
+                       __LINE__, RpcExceptionCode()); \
+       } RpcEndExcept; \
+       printf("LINE[%d] after\n\n", __LINE__); \
+} while (0)
+#define MIDLTEST_RPCCALL(x) MIDLTEST_RPCCALL_EX(x, 0)
+
 static void midltests(void)
 {
-       cli_midltests_fn();
+       MIDLTEST_RPCCALL(cli_midltests_fn());
 }
 
 long srv_midltests_fn(void)
index 3046f6debc6db97e6ef8252c202bd4ce584bc298..c332c98c9d8270d8d579a7713cdc0681faec0abf 100644 (file)
@@ -101,8 +101,8 @@ static void dump_packet(const char *ctx, const char *direction,
 
        switch (hdr->ptype) {
        case 0: /* request */
-               printf("%s:%s: ptype[request] flen[%d] plen[%d] ahint[%d]\n\n",
-                     ctx, direction, hdr->frag_length,
+               printf("%s:%s: ptype[request] flen[%d] call[%d] plen[%d] ahint[%d]\n\n",
+                     ctx, direction, hdr->frag_length, hdr->call_id,
                      len - 24, *(DWORD *)(&buf[0x10]));
                dump_data(buf + 24, len - 24);
                printf("\n");
@@ -110,14 +110,23 @@ static void dump_packet(const char *ctx, const char *direction,
                break;
 
        case 2: /* response */
-               printf("\n%s:%s: ptype[response] flen[%d] plen[%d] ahint[%d]\n\n",
-                      ctx, direction, hdr->frag_length,
+               printf("\n%s:%s: ptype[response] flen[%d] call[%d] plen[%d] ahint[%d]\n\n",
+                      ctx, direction, hdr->frag_length, hdr->call_id,
                       len - 24, *(DWORD *)(&buf[0x10]));
                dump_data(buf + 24, len - 24);
                printf("\n");
                fflush(stdout);
                break;
 
+       case 3: /* fault */
+               printf("%s:%s: ptype[fault] flen[%d] call[%d] plen[%d]\n\n",
+                      ctx, direction, hdr->ptype, hdr->frag_length, hdr->call_id,
+                      len - 24);
+               dump_data(buf + 24, len - 24);
+               printf("\n");
+               fflush(stdout);
+               break;
+
        case 11: /* bind */
 #if 0
                printf("%s:%s: ptype[bind] flen[%d] call[%d] contexts[%d]\n\n"