summaryrefslogtreecommitdiff
path: root/source3/smbwrapper/smbw_stat.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-10-24 08:08:05 +0000
committerAndrew Tridgell <tridge@samba.org>1998-10-24 08:08:05 +0000
commitfb556e14f3b47d5a1f465589084e8b30d84af8ca (patch)
tree90efd6b2e60d40552f23b481f08e69b5e9e24178 /source3/smbwrapper/smbw_stat.c
parent4140f2bfc141ee9a91723d274344769f8b11a5f9 (diff)
downloadsamba-fb556e14f3b47d5a1f465589084e8b30d84af8ca.tar.gz
samba-fb556e14f3b47d5a1f465589084e8b30d84af8ca.tar.bz2
samba-fb556e14f3b47d5a1f465589084e8b30d84af8ca.zip
volker was concerned about unique inode numbers and smbsh. This set of
changes uses the unique index number from a SMB_QUERY_FILE_ALL_INFO to try to provide inode numbers. If it is 0 then use the hash of the filename as before. (This used to be commit 2565ccf9de9d5e80fdb5bcadbc7130faba386d95)
Diffstat (limited to 'source3/smbwrapper/smbw_stat.c')
-rw-r--r--source3/smbwrapper/smbw_stat.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/source3/smbwrapper/smbw_stat.c b/source3/smbwrapper/smbw_stat.c
index adf973667f..443c898eb5 100644
--- a/source3/smbwrapper/smbw_stat.c
+++ b/source3/smbwrapper/smbw_stat.c
@@ -31,8 +31,6 @@ setup basic info in a stat structure
*******************************************************/
void smbw_setup_stat(struct stat *st, char *fname, size_t size, int mode)
{
- ZERO_STRUCTP(st);
-
st->st_mode = 0;
if (IS_DOS_DIR(mode)) {
@@ -51,7 +49,14 @@ void smbw_setup_stat(struct stat *st, char *fname, size_t size, int mode)
st->st_blocks = (size+511)/512;
st->st_uid = getuid();
st->st_gid = getgid();
- st->st_ino = smbw_inode(fname);
+ if (IS_DOS_DIR(mode)) {
+ st->st_nlink = 2;
+ } else {
+ st->st_nlink = 1;
+ }
+ if (st->st_ino == 0) {
+ st->st_ino = smbw_inode(fname);
+ }
}
@@ -61,13 +66,14 @@ this is needed because win95 sometimes refuses the qpathinfo
*******************************************************/
BOOL smbw_getatr(struct smbw_server *srv, char *path,
uint32 *mode, size_t *size,
- time_t *c_time, time_t *a_time, time_t *m_time)
+ time_t *c_time, time_t *a_time, time_t *m_time,
+ SMB_INO_T *ino)
{
DEBUG(4,("sending qpathinfo\n"));
if (!srv->no_pathinfo2 &&
cli_qpathinfo2(&srv->cli, path, c_time, a_time, m_time, NULL,
- size, mode)) return True;
+ size, mode, ino)) return True;
/* if this is NT then don't bother with the getatr */
if (srv->cli.capabilities & CAP_NT_SMBS) return False;
@@ -125,9 +131,12 @@ int smbw_fstat(int fd, struct stat *st)
time_t c_time, a_time, m_time;
size_t size;
uint32 mode;
+ SMB_INO_T ino = 0;
smbw_busy++;
+ ZERO_STRUCTP(st);
+
file = smbw_file(fd);
if (!file) {
int ret = smbw_dir_fstat(fd, st);
@@ -135,10 +144,9 @@ int smbw_fstat(int fd, struct stat *st)
return ret;
}
- DEBUG(4,("sending qfileinfo\n"));
-
if (!cli_qfileinfo(&file->srv->cli, file->f->cli_fd,
- &mode, &size, &c_time, &a_time, &m_time) &&
+ &mode, &size, &c_time, &a_time, &m_time, NULL,
+ &ino) &&
!cli_getattrE(&file->srv->cli, file->f->cli_fd,
&mode, &size, &c_time, &a_time, &m_time)) {
errno = EINVAL;
@@ -146,6 +154,8 @@ int smbw_fstat(int fd, struct stat *st)
return -1;
}
+ st->st_ino = ino;
+
smbw_setup_stat(st, file->f->fname, size, mode);
st->st_atime = a_time;
@@ -169,6 +179,9 @@ int smbw_stat(const char *fname, struct stat *st)
time_t m_time=0, a_time=0, c_time=0;
size_t size=0;
uint32 mode=0;
+ SMB_INO_T ino = 0;
+
+ ZERO_STRUCTP(st);
if (!fname) {
errno = EINVAL;
@@ -205,12 +218,15 @@ int smbw_stat(const char *fname, struct stat *st)
}
} else {
if (!smbw_getatr(srv, path,
- &mode, &size, &c_time, &a_time, &m_time)) {
+ &mode, &size, &c_time, &a_time, &m_time,
+ &ino)) {
errno = smbw_errno(&srv->cli);
goto failed;
}
}
+ st->st_ino = ino;
+
smbw_setup_stat(st, path, size, mode);
st->st_atime = a_time;