HACK CHAIN3
authorStefan Metzmacher <metze@samba.org>
Wed, 28 Apr 2010 15:46:28 +0000 (17:46 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 29 Apr 2010 13:53:16 +0000 (15:53 +0200)
source3/torture/torture.c

index b454a7d46dd34d7fa5bf98321fb52c56e6f98709..51816f6f1a6efb38676d3e2ecee86eca3c030dce 100644 (file)
@@ -5513,6 +5513,75 @@ static bool run_chain2(int dummy)
        return True;
 }
 
+static bool run_chain3(int dummy)
+{
+       struct cli_state *cli1;
+       struct event_context *evt = event_context_init(NULL);
+       struct tevent_req *reqs[2], *smbreqs[2];
+       bool done = false;
+       NTSTATUS status;
+       uint16_t fnum;
+       const uint8_t bind_pdu[] = {
+               0x05, 0x00, 0x0b, 0x03, 0x10, 0x00, 0x00, 0x00,
+               0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+               0xd0, 0x16, 0xd0, 0x16, 0x00, 0x00, 0x00, 0x00,
+               0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
+               0xc5, 0x5e, 0xa1, 0x60, 0xe8, 0x4d, 0xd7, 0x11,
+               0xa6, 0x37, 0x00, 0x50, 0x56, 0xa2, 0x01, 0x82,
+               0x01, 0x00, 0x00, 0x00, 0x04, 0x5d, 0x88, 0x8a,
+               0xeb, 0x1c, 0xc9, 0x11, 0x9f, 0xe8, 0x08, 0x00,
+               0x2b, 0x10, 0x48, 0x60, 0x02, 0x00, 0x00, 0x00
+       };
+
+       printf("starting chain3 test\n");
+       status = cli_start_connection(&cli1, global_myname(), host, NULL,
+                                     port_to_use, Undefined, 0, NULL);
+       if (!NT_STATUS_IS_OK(status)) {
+               return False;
+       }
+
+       cli_sockopt(cli1, sockops);
+
+       status = cli_session_setup(cli1, NULL, NULL, 0, NULL, 0, lp_workgroup());
+
+       status = cli_tcon_andx(cli1, "IPC$", "?????", NULL, 0);
+
+       status = cli_ntcreate(cli1,
+                       "\\rpcecho", //const char *fname,
+                     0, // CreatFlags,
+                     0x00020113, //uint32_t DesiredAccess,
+                     0, //uint32_t FileAttributes,
+                     3, //uint32_t ShareAccess,
+                     1, //uint32_t CreateDisposition,
+                     0, //uint32_t CreateOptions,
+                     2, //uint8_t SecurityFlags,
+                     &fnum);
+
+       cli_write(cli1, fnum, 0, bind_pdu, 0, sizeof(bind_pdu));
+
+       reqs[0] = cli_read_andx_create(talloc_tos(), evt, cli1,
+                                      fnum, 0, 5,
+                                      &smbreqs[0]);
+       if (reqs[0] == NULL) return false;
+
+       reqs[1] = cli_read_andx_create(talloc_tos(), evt, cli1,
+                                      fnum, 0, 5000,
+                                      &smbreqs[1]);
+       if (reqs[1] == NULL) return false;
+
+       status = cli_smb_chain_send(smbreqs, ARRAY_SIZE(smbreqs));
+       if (!NT_STATUS_IS_OK(status)) {
+               return false;
+       }
+
+       while (!done) {
+               event_loop_once(evt);
+       }
+
+       torture_close_connection(cli1);
+       return True;
+}
+
 
 struct torture_createdel_state {
        struct tevent_context *ev;
@@ -7495,6 +7564,7 @@ static struct {
        { "SESSSETUP_BENCH", run_sesssetup_bench, 0},
        { "CHAIN1", run_chain1, 0},
        { "CHAIN2", run_chain2, 0},
+       { "CHAIN3", run_chain3, 0},
        { "WINDOWS-WRITE", run_windows_write, 0},
        { "CLI_ECHO", run_cli_echo, 0},
        { "GETADDRINFO", run_getaddrinfo_send, 0},