added a SMB_QUERY_FILE_ALL_INFO test into smbtorture
authorAndrew Tridgell <tridge@samba.org>
Sun, 23 Nov 1997 07:26:42 +0000 (07:26 +0000)
committerAndrew Tridgell <tridge@samba.org>
Sun, 23 Nov 1997 07:26:42 +0000 (07:26 +0000)
W95 doesn't seem to support this call.
(This used to be commit 162947c6e672580216c6223a44d25b874f0487ab)

source3/libsmb/clientgen.c
source3/utils/torture.c

index 7060467aee3866db8e459073181b68e00e974230..89557905fc05cc65656491215db4180cce2ab7e1 100644 (file)
@@ -995,6 +995,62 @@ BOOL cli_qpathinfo(struct cli_state *cli, char *fname,
        return True;
 }
 
+/****************************************************************************
+send a qpathinfo call with the SMB_QUERY_FILE_ALL_INFO info level
+****************************************************************************/
+BOOL cli_qpathinfo2(struct cli_state *cli, char *fname, 
+                   time_t *c_time, time_t *a_time, time_t *m_time, 
+                   time_t *w_time, uint32 *size)
+{
+       int data_len = 0;
+       int param_len = 0;
+       uint16 setup = TRANSACT2_QPATHINFO;
+       pstring param;
+       char *rparam=NULL, *rdata=NULL;
+
+       param_len = strlen(fname) + 7;
+
+       memset(param, 0, param_len);
+       SSVAL(param, 0, SMB_QUERY_FILE_ALL_INFO);
+       pstrcpy(&param[6], fname);
+
+       if (!cli_send_trans(cli, SMBtrans2, NULL, -1, 0, 
+                           NULL, param, &setup, 
+                           data_len, param_len, 1,
+                           cli->max_xmit, 10, 0)) {
+               return False;
+       }
+
+       if (!cli_receive_trans(cli, SMBtrans2, &data_len, &param_len, 
+                              &rdata, &rparam)) {
+               return False;
+       }
+
+       if (!rdata || data_len < 22) {
+               return False;
+       }
+
+       if (c_time) {
+               *c_time = interpret_long_date(rdata+0) - cli->serverzone;
+       }
+       if (a_time) {
+               *a_time = interpret_long_date(rdata+8) - cli->serverzone;
+       }
+       if (m_time) {
+               *m_time = interpret_long_date(rdata+16) - cli->serverzone;
+       }
+       if (w_time) {
+               *w_time = interpret_long_date(rdata+24) - cli->serverzone;
+       }
+       if (size) {
+               *size = IVAL(rdata, 40);
+       }
+
+       if (rdata) free(rdata);
+       if (rparam) free(rparam);
+       return True;
+}
+
 
 /****************************************************************************
 send a qfileinfo call
index fc6d5bcc151c8da4fd1c672450272c924ca44084..d1bd6e5f00e5f027f115f646ebd12812e1a67479 100644 (file)
@@ -690,7 +690,7 @@ static void run_trans2test(void)
        static struct cli_state cli;
        int fnum;
        uint32 size;
-       time_t c_time, a_time, m_time;
+       time_t c_time, a_time, m_time, w_time;
        char *fname = "\\trans2.tst";
 
        printf("staring trans2 test\n");
@@ -732,7 +732,20 @@ static void run_trans2test(void)
                }
        }
 
+
        cli_unlink(&cli, fname);
+       fnum = cli_open(&cli, fname, 
+                       O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
+       cli_close(&cli, fnum);
+       if (!cli_qpathinfo2(&cli, fname, &c_time, &a_time, &m_time, 
+                           &w_time, &size)) {
+               printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(&cli));
+       } else {
+               if (w_time < 60*60*24*2) {
+                       printf("write time=%s", ctime(&w_time));
+                       printf("This system appears to set a initial 0 write time\n");
+               }
+       }
 
        close_connection(&cli);