use 1 second resolution calls if possible
authorAndrew Tridgell <tridge@samba.org>
Thu, 8 Oct 1998 02:28:21 +0000 (02:28 +0000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 8 Oct 1998 02:28:21 +0000 (02:28 +0000)
(This used to be commit 349469221a84658048790d7567b4fcea43c0b759)

source3/include/proto.h
source3/libsmb/clientgen.c
source3/smbwrapper/smbw.h
source3/smbwrapper/smbw_stat.c
source3/utils/torture.c

index 07392239fab37ca835ae4e48af218d5391cb6067..062fe3526489086cb03a918caecf4577a74f82d7 100644 (file)
@@ -400,9 +400,9 @@ BOOL cli_setatr(struct cli_state *cli, char *fname, int attr, time_t t);
 BOOL cli_qpathinfo(struct cli_state *cli, const char *fname, 
                   time_t *c_time, time_t *a_time, time_t *m_time, 
                   size_t *size, uint32 *mode);
-BOOL cli_qpathinfo2(struct cli_state *cli, char *fname, 
+BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname, 
                    time_t *c_time, time_t *a_time, time_t *m_time, 
-                   time_t *w_time, uint32 *size);
+                   time_t *w_time, size_t *size, uint32 *mode);
 BOOL cli_qfileinfo(struct cli_state *cli, int fnum, 
                   uint32 *mode, size_t *size,
                   time_t *c_time, time_t *a_time, time_t *m_time);
index 38b4b5ffeb221fc0de2b66d30eaf657e5cbf4e3a..657523b3bebd067ee54eaf7a2d1093e83a5f68ab 100644 (file)
@@ -1557,9 +1557,9 @@ BOOL cli_qpathinfo(struct cli_state *cli, const char *fname,
 /****************************************************************************
 send a qpathinfo call with the SMB_QUERY_FILE_ALL_INFO info level
 ****************************************************************************/
-BOOL cli_qpathinfo2(struct cli_state *cli, char *fname, 
+BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname, 
                    time_t *c_time, time_t *a_time, time_t *m_time, 
-                   time_t *w_time, uint32 *size)
+                   time_t *w_time, size_t *size, uint32 *mode)
 {
        int data_len = 0;
        int param_len = 0;
@@ -1608,6 +1608,9 @@ BOOL cli_qpathinfo2(struct cli_state *cli, char *fname,
        if (size) {
                *size = IVAL(rdata, 40);
        }
+       if (mode) {
+               *mode = IVAL(rdata, 32);
+       }
 
        if (rdata) free(rdata);
        if (rparam) free(rparam);
index 43fb14bce07d9ab8d4e3d9efadaa6fb676757f19..b0cf2dc2e13c33e960e447b3b7323fffd8613eaa 100644 (file)
@@ -37,6 +37,7 @@ struct smbw_server {
        char *server_name;
        char *share_name;
        dev_t dev;
+       BOOL no_pathinfo2;
 };
 
 struct smbw_filedes {
index ec920eb1768e482a9f3de72ab398539742024757..d9e2aa250c7c9149f001cef6bb50c89eb11ee1fe 100644 (file)
@@ -65,16 +65,16 @@ BOOL smbw_getatr(struct smbw_server *srv, char *path,
 {
        DEBUG(5,("sending qpathinfo\n"));
 
-       if (cli_qpathinfo(&srv->cli, path, c_time, a_time, m_time,
-                         size, mode)) return True;
-
-       DEBUG(5,("qpathinfo OK\n"));
+       if (!srv->no_pathinfo2 &&
+           cli_qpathinfo2(&srv->cli, path, c_time, a_time, m_time, NULL,
+                          size, mode)) return True;
 
        /* if this is NT then don't bother with the getatr */
        if (srv->cli.capabilities & CAP_NT_SMBS) return False;
 
        if (cli_getatr(&srv->cli, path, mode, size, m_time)) {
                a_time = c_time = m_time;
+               srv->no_pathinfo2 = True;
                return True;
        }
        return False;
index e7bd347993a73881002ccb496c54ac83786ba1ff..b49ad61263796c2b8decc666d9596660fd39f8a5 100644 (file)
@@ -809,7 +809,7 @@ static void run_trans2test(void)
                        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, NULL)) {
+                           &w_time, &size, NULL, NULL)) {
                printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(&cli));
        } else {
                if (w_time < 60*60*24*2) {
@@ -828,7 +828,7 @@ static void run_trans2test(void)
        }
        sleep(3);
        if (!cli_qpathinfo2(&cli, "\\trans2\\", &c_time, &a_time, &m_time, 
-                           &w_time, &size, NULL)) {
+                           &w_time, &size, NULL, NULL)) {
                printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(&cli));
        }
 
@@ -837,7 +837,7 @@ static void run_trans2test(void)
        cli_write(&cli, fnum,  (char *)&fnum, 0, sizeof(fnum));
        cli_close(&cli, fnum);
        if (!cli_qpathinfo2(&cli, "\\trans2\\", &c_time, &a_time, &m_time2, 
-                           &w_time, &size, NULL)) {
+                           &w_time, &size, NULL, NULL)) {
                printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(&cli));
        } else {
                if (m_time2 == m_time)