s3: Replace cli_negprot_sendsync() by cli_negprot_send()
authorVolker Lendecke <vl@samba.org>
Sun, 27 Mar 2011 15:34:36 +0000 (17:34 +0200)
committerVolker Lendecke <vl@samba.org>
Sun, 27 Mar 2011 17:04:11 +0000 (19:04 +0200)
source3/include/proto.h
source3/libsmb/cliconnect.c
source3/torture/torture.c

index b5b1c860fc3589bb8ea90db2fe499f87d3495866..14ec2d68534aba5e725b3d464b77755f7ddbbe55 100644 (file)
@@ -1546,7 +1546,6 @@ struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
                                  struct cli_state *cli);
 NTSTATUS cli_tdis_recv(struct tevent_req *req);
 NTSTATUS cli_tdis(struct cli_state *cli);
-void cli_negprot_sendsync(struct cli_state *cli);
 NTSTATUS cli_negprot(struct cli_state *cli);
 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
                                    struct event_context *ev,
index 819d83570da043caa1c8a2d5deb19254e2fbb786..6334f6b5873f0fe67eb24d5e5c08b5e10b515058 100644 (file)
@@ -1913,41 +1913,6 @@ fail:
  Send a negprot command.
 ****************************************************************************/
 
-void cli_negprot_sendsync(struct cli_state *cli)
-{
-       char *p;
-       int numprots;
-
-       if (cli->protocol < PROTOCOL_NT1)
-               cli->use_spnego = False;
-
-       memset(cli->outbuf,'\0',smb_size);
-
-       /* setup the protocol strings */
-       cli_set_message(cli->outbuf,0,0,True);
-
-       p = smb_buf(cli->outbuf);
-       for (numprots=0; numprots < ARRAY_SIZE(prots); numprots++) {
-               if (prots[numprots].prot > cli->protocol) {
-                       break;
-               }
-               *p++ = 2;
-               p += clistr_push(cli, p, prots[numprots].name, -1, STR_TERMINATE);
-       }
-
-       SCVAL(cli->outbuf,smb_com,SMBnegprot);
-       cli_setup_bcc(cli, p);
-       cli_setup_packet(cli);
-
-       SCVAL(smb_buf(cli->outbuf),0,2);
-
-       cli_send_smb(cli);
-}
-
-/****************************************************************************
- Send a negprot command.
-****************************************************************************/
-
 struct cli_negprot_state {
        struct cli_state *cli;
 };
index ebb305fbe1dffe6b33136ce8345b54e889887ca4..fcd0e5726d25ab92b9cd119450fde3f9fd0f83f8 100644 (file)
@@ -2776,21 +2776,41 @@ static void rand_buf(char *buf, int len)
 /* send smb negprot commands, not reading the response */
 static bool run_negprot_nowait(int dummy)
 {
+       struct tevent_context *ev;
        int i;
        struct cli_state *cli;
        bool correct = True;
 
        printf("starting negprot nowait test\n");
 
+       ev = tevent_context_init(talloc_tos());
+       if (ev == NULL) {
+               return false;
+       }
+
        if (!(cli = open_nbt_connection())) {
+               TALLOC_FREE(ev);
                return False;
        }
 
        for (i=0;i<50000;i++) {
-               cli_negprot_sendsync(cli);
+               struct tevent_req *req;
+
+               req = cli_negprot_send(ev, ev, cli);
+               if (req == NULL) {
+                       TALLOC_FREE(ev);
+                       return false;
+               }
+               if (!tevent_req_poll(req, ev)) {
+                       d_fprintf(stderr, "tevent_req_poll failed: %s\n",
+                                 strerror(errno));
+                       TALLOC_FREE(ev);
+                       return false;
+               }
+               TALLOC_FREE(req);
        }
 
-       if (!torture_close_connection(cli)) {
+       if (torture_close_connection(cli)) {
                correct = False;
        }