New info level tester.
authorJeremy Allison <jra@samba.org>
Mon, 18 Jun 2001 23:31:22 +0000 (23:31 +0000)
committerJeremy Allison <jra@samba.org>
Mon, 18 Jun 2001 23:31:22 +0000 (23:31 +0000)
Jeremy.

source/libsmb/clirap.c
source/utils/torture.c

index 561d717e730346aafa3e41230b9218d0aba0d87e..5d41af13f90ebd32374ba33431cfc4fc479c5638 100644 (file)
@@ -593,3 +593,46 @@ BOOL cli_qfileinfo(struct cli_state *cli, int fnum,
        return True;
 }
 
+/****************************************************************************
+send a qfileinfo call
+****************************************************************************/
+BOOL cli_qfileinfo_test(struct cli_state *cli, int fnum, int level, char *outdata)
+{
+       int data_len = 0;
+       int param_len = 0;
+       uint16 setup = TRANSACT2_QFILEINFO;
+       pstring param;
+       char *rparam=NULL, *rdata=NULL;
+
+       /* if its a win95 server then fail this - win95 totally screws it
+          up */
+       if (cli->win95) return False;
+
+       param_len = 4;
+
+       memset(param, 0, param_len);
+       SSVAL(param, 0, fnum);
+       SSVAL(param, 2, level);
+
+       if (!cli_send_trans(cli, SMBtrans2, 
+                            NULL,                           /* name */
+                            -1, 0,                          /* fid, flags */
+                            &setup, 1, 0,                   /* setup, length, max */
+                            param, param_len, 2,            /* param, length, max */
+                            NULL, data_len, cli->max_xmit   /* data, length, max */
+                           )) {
+               return False;
+       }
+
+       if (!cli_receive_trans(cli, SMBtrans2,
+                               &rparam, &param_len,
+                               &rdata, &data_len)) {
+               return False;
+       }
+
+       memcpy(outdata, rdata, data_len);
+
+       if (rdata) free(rdata);
+       if (rparam) free(rparam);
+       return True;
+}
index 5f08887a607e5131a4370dc3f7a19326ab72069b..6f4076cecba8e09abf084feb6891d6a1d690041d 100644 (file)
@@ -1929,6 +1929,52 @@ static void run_trans2test(int dummy)
        printf("trans2 test finished\n");
 }
 
+/*
+  This checks new W2K calls.
+*/
+
+void new_trans(struct cli_state *pcli, int fnum, int level)
+{
+       char buf[4096];
+
+       memset(buf, 0xff, sizeof(buf));
+
+       if (!cli_qfileinfo_test(pcli, fnum, level, buf)) {
+               printf("ERROR: qfileinfo (%d) failed (%s)\n", level, cli_errstr(pcli));
+       } else {
+               printf("qfileinfo: level %d\n", level);
+               dump_data(0, buf, 256);
+               printf("\n");
+       }
+}
+
+static void run_w2ktest(int dummy)
+{
+       static struct cli_state cli;
+       int fnum;
+       char *fname = "\\w2ktest\\w2k.tst";
+       int level;
+
+       printf("starting w2k test\n");
+
+       if (!open_connection(&cli)) {
+               return;
+       }
+
+       fnum = cli_open(&cli, fname, 
+                       O_RDWR | O_CREAT , DENY_NONE);
+
+       for (level = 1004; level < 1040; level++)
+               new_trans(&cli, fnum, level);
+
+       cli_close(&cli, fnum);
+
+
+       close_connection(&cli);
+
+       printf("w2k test finished\n");
+}
+
 
 /*
   this is a harness for some oplock tests
@@ -2817,6 +2863,7 @@ static struct {
        {"RW3",  run_readwritelarge, 0},
        {"OPEN", run_opentest, 0},
        {"DELETE", run_deletetest, 0},
+       {"W2K", run_w2ktest, 0},
        {NULL, NULL, 0}};