summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/include/proto.h4
-rw-r--r--source/libsmb/clientgen.c7
-rw-r--r--source/smbwrapper/smbw.h1
-rw-r--r--source/smbwrapper/smbw_stat.c8
-rw-r--r--source/utils/torture.c6
5 files changed, 15 insertions, 11 deletions
diff --git a/source/include/proto.h b/source/include/proto.h
index 07392239fab..062fe352648 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -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);
diff --git a/source/libsmb/clientgen.c b/source/libsmb/clientgen.c
index 38b4b5ffeb2..657523b3beb 100644
--- a/source/libsmb/clientgen.c
+++ b/source/libsmb/clientgen.c
@@ -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);
diff --git a/source/smbwrapper/smbw.h b/source/smbwrapper/smbw.h
index 43fb14bce07..b0cf2dc2e13 100644
--- a/source/smbwrapper/smbw.h
+++ b/source/smbwrapper/smbw.h
@@ -37,6 +37,7 @@ struct smbw_server {
char *server_name;
char *share_name;
dev_t dev;
+ BOOL no_pathinfo2;
};
struct smbw_filedes {
diff --git a/source/smbwrapper/smbw_stat.c b/source/smbwrapper/smbw_stat.c
index ec920eb1768..d9e2aa250c7 100644
--- a/source/smbwrapper/smbw_stat.c
+++ b/source/smbwrapper/smbw_stat.c
@@ -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;
diff --git a/source/utils/torture.c b/source/utils/torture.c
index e7bd347993a..b49ad612637 100644
--- a/source/utils/torture.c
+++ b/source/utils/torture.c
@@ -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)