[SCM] Samba Shared Repository - branch master updated
Ralph Böhme
slow at samba.org
Wed Jul 14 08:59:01 UTC 2021
The branch, master has been updated
via e168a95c1bb s3: VFS: Update status of SMB_VFS_READ_DFS_PATHAT.
via 1538b44d942 s3: smbd: In dfs_path_lookup(), use relative dirfsp, atname lookups in SMB_VFS_READ_DFS_PATHAT() for the pathname walk fallback.
via f35c6a48fc5 s3: smbd: In dfs_path_lookup(), use relative dirfsp, atname lookups in SMB_VFS_READ_DFS_PATHAT() for the whole path optimization.
via c62807e3e1a s3: smbd: In is_msdfs_link(), change to dirfsp, atname parameters.
via 3b71ead1cc0 s3: smbd: Add dirfsp, atname parameters to check_msdfs_link().
via 88e56a71c65 s3: smbd: Pass dirfsp, atname down to mode_fn() passed to smbd_dirptr_get_entry().
via 523bc61c9d2 s3: smbd: In smbd_dirptr_get_entry(), postpone TALLOC_FREE(atname) as we're going to pass this to mode_fn().
via 165d0998c76 s3: VFS: time_audit. In smb_time_audit_read_dfs_pathat(), cope with relative pathnames.
via 84070c3e8df s3: VFS: shadow_copy2. In shadow_copy2_read_dfs_pathat(), cope with relative pathnames.
via a3664ca2e07 s3: VFS: glusterfs. In vfs_gluster_read_dfs_pathat(), cope with relative pathnames.
via 288eec969ee s3: VFS: full_audit. In smb_full_audit_read_dfs_pathat(), cope with relative pathnames.
via 43970634cff s3: VFS: ceph: In cephwrap_read_dfs_pathat(), cope with relative pathnames.
via ac0ff0e1fe9 s3: VFS: cap: Fix cap_read_dfs_pathat() to cope with relative paths.
via 4da6a9f4e66 s3: VFS: default. In vfswrap_read_dfs_pathat(), cope with relative pathnames.
via 9fa5e171b96 s3: VFS: default. In vfswrap_read_dfs_pathat() use sys_fstatat().
via 106beab5bfe s2: VFS: default. Fix vfswrap_read_dfs_pathat() to use fsp_get_pathref_fd() not fsp_get_io_fd().
via cc6e433b1be s3: VFS: default. Fix vfswrap_readdir() to use sys_fstatat().
via 8804d240fac s3: lib: Add sys_fstatat() wrapper.
via f66d3621f5e s3: expect fstatat() and dirfd()
via c7d6745858f vfs_shadow_copy2: ensure we call convert_sbuf() in shadow_copy2_*stat() on already converted paths with absolute path
via 4a7e483c516 selftest: add a test for shadow:fixinodes
via 3aabc9825ca selftest: simplify snapshot directory creation in test_shadow_copy_torture.sh
via 0a0b438b8ab selftest: enable "shadow:fixinodes" in "shadow_write" share
via 745ded9afe1 selftest: pass smbclient arg to samba3.blackbox.shadow_copy_torture test
via b32e56d6eb2 smbd: update smb_fname statinfo from fsp
via 2c9ae4b78cd smbd: put back dev/ino stat/fstat check in openat_pathref_fsp()
via 18a30d939e6 smbd: canonicalize SMB_VFS_FSTAT() stat buffer
via 40cf129abb5 s3: VFS: streams_xattr: In streams_xattr_stat() use synthetic_pathref() with basename
via 03e36502f45 s3: VFS: fruit. In ad_get_meta_fsp(), we only need a handle on the base file, not the stream.
from 0657db26447 s3: smbd: Explicitly code the semantics of "dos filemode" into the chown code.
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit e168a95c1bb1928cf206baf6d2db851c85f65fa9
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 17:58:29 2021 -0700
s3: VFS: Update status of SMB_VFS_READ_DFS_PATHAT.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Wed Jul 14 08:58:30 UTC 2021 on sn-devel-184
commit 1538b44d942091d14f6b8f554d249bf98fd06b5e
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 17:56:13 2021 -0700
s3: smbd: In dfs_path_lookup(), use relative dirfsp, atname lookups in SMB_VFS_READ_DFS_PATHAT() for the pathname walk fallback.
Note that parent_pathref() must succeed before we call SMB_VFS_READ_DFS_PATHAT().
If parent_pathref() fails, just step back a component without calling
SMB_VFS_READ_DFS_PATHAT().
There are no longer any non-relative uses of SMB_VFS_READ_DFS_PATHAT().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit f35c6a48fc5a186d477230e465a9b6f71d56e245
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 17:53:19 2021 -0700
s3: smbd: In dfs_path_lookup(), use relative dirfsp, atname lookups in SMB_VFS_READ_DFS_PATHAT() for the whole path optimization.
Note parent_pathref() must succeed before we can call SMB_VFS_READ_DFS_PATHAT().
Otherwise, just skip the whole path optimization and go onto the path walk code.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit c62807e3e1ad9635c0740ee12f3588a4ce2e9a6c
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 17:44:10 2021 -0700
s3: smbd: In is_msdfs_link(), change to dirfsp, atname parameters.
Remember to update the smb_fname->st struct inside check_msdfs_link(),
as we now pass the atname to is_msdfs_link(), not the smb_fname.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 3b71ead1cc096eaf28edfd2c30f374a89c30f7b7
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 17:35:26 2021 -0700
s3: smbd: Add dirfsp, atname parameters to check_msdfs_link().
Replace the old connection_struct *conn parameter.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 88e56a71c659d2fb51edcce335ca45acd33dbee4
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 16:40:08 2021 -0700
s3: smbd: Pass dirfsp, atname down to mode_fn() passed to smbd_dirptr_get_entry().
Not yet used.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 523bc61c9d27d395a1cceb7bcc7efc3e82fe14d0
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 16:32:23 2021 -0700
s3: smbd: In smbd_dirptr_get_entry(), postpone TALLOC_FREE(atname) as we're going to pass this to mode_fn().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 165d0998c76662b5d40d6f76a5abad850b979a4c
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 17:16:08 2021 -0700
s3: VFS: time_audit. In smb_time_audit_read_dfs_pathat(), cope with relative pathnames.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 84070c3e8dfff0c176b9c9a75a337239904a0ffa
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 17:09:51 2021 -0700
s3: VFS: shadow_copy2. In shadow_copy2_read_dfs_pathat(), cope with relative pathnames.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit a3664ca2e0707dbfcc9cf734682870cb05dc7b92
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 17:04:59 2021 -0700
s3: VFS: glusterfs. In vfs_gluster_read_dfs_pathat(), cope with relative pathnames.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 288eec969ee805298f40ab1cc27aaf04ed32f3ed
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 17:01:34 2021 -0700
s3: VFS: full_audit. In smb_full_audit_read_dfs_pathat(), cope with relative pathnames.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 43970634cff9d60ae670710951f32f27c697efc7
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 16:58:05 2021 -0700
s3: VFS: ceph: In cephwrap_read_dfs_pathat(), cope with relative pathnames.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit ac0ff0e1fe96d474ad9e5718683f068968061512
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 16:45:13 2021 -0700
s3: VFS: cap: Fix cap_read_dfs_pathat() to cope with relative paths.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 4da6a9f4e66f4222dfa819125289de0aacdfaa2d
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 17:21:03 2021 -0700
s3: VFS: default. In vfswrap_read_dfs_pathat(), cope with relative pathnames.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 9fa5e171b96de569ec46f09743f98eeb5de38dfb
Author: Jeremy Allison <jra at samba.org>
Date: Tue Jul 13 09:15:18 2021 -0700
s3: VFS: default. In vfswrap_read_dfs_pathat() use sys_fstatat().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 106beab5bfe9b82b7af69842a828a18fa0da1b71
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 15:24:30 2021 -0700
s2: VFS: default. Fix vfswrap_read_dfs_pathat() to use fsp_get_pathref_fd() not fsp_get_io_fd().
We don't need an io fd here, and we only get away
with it as we have the assert above:
SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
This will be removed next.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit cc6e433b1beb3e6a9641f28e97731d53c4ded744
Author: Jeremy Allison <jra at samba.org>
Date: Tue Jul 13 09:10:50 2021 -0700
s3: VFS: default. Fix vfswrap_readdir() to use sys_fstatat().
Change struct stat st -> SMB_STRUCT_STAT st
and just copy the struct on success, as sys_fstatat()
already does the init_stat_ex_from_stat() for us.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 8804d240fac3ffe58a5c43b23c842fa6bde61e27
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jul 12 15:37:20 2021 -0700
s3: lib: Add sys_fstatat() wrapper.
Does the usual things we need with fake_dir_create_times.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit f66d3621f5e7f9549a52b975e59a4984726ec58d
Author: Ralph Boehme <slow at samba.org>
Date: Tue Jul 13 09:03:31 2021 -0700
s3: expect fstatat() and dirfd()
FreeBSD, AIX and Solaris all have this.
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit c7d6745858f2efdd24ed6fd353ec5ece898033fa
Author: Ralph Boehme <slow at samba.org>
Date: Sat Jul 3 15:46:11 2021 +0200
vfs_shadow_copy2: ensure we call convert_sbuf() in shadow_copy2_*stat() on already converted paths with absolute path
shadow_copy2_strip_snapshot() will happily return without modifying the passed
timestamp=0 if the path is already converted and refers to an object in a
snapshot, eg (first debug line from extra debugging patch [1]):
[10 2021/07/02 08:19:28.811424 pid=738290 ../../source3/modules/vfs_shadow_copy2.c:1303 shadow_copy2_fstat]
shadow_copy2_fstat: fsp [test.txt {@GMT-2000.01.02-03.04.05}]
[10 2021/07/02 08:19:28.811449 pid=738290 ../../source3/modules/vfs_shadow_copy2.c:607 _shadow_copy2_strip_snapshot_internal]
_shadow_copy2_strip_snapshot_internal: [from shadow_copy2_fstat()] Path 'test.txt {@GMT-2000.01.02-03.04.05}'
[10 2021/07/02 08:19:28.811474 pid=738290 ../../source3/modules/vfs_shadow_copy2.c:619 _shadow_copy2_strip_snapshot_internal]
_shadow_copy2_strip_snapshot_internal: abs path '/gpfs0/smb_snapshots2/filesetone/.snapshots/@GMT-2000.01.02-03.04.05/test.txt'
[10 2021/07/02 08:19:28.811496 pid=738290 ../../source3/modules/vfs_shadow_copy2.c:1924 shadow_copy2_snapshot_to_gmt]
shadow_copy2_snapshot_to_gmt: match @GMT-%Y.%m.%d-%H.%M.%S: @GMT-2000.01.02-03.04.05
[10 2021/07/02 08:19:28.811536 pid=738290 ../../source3/modules/vfs_shadow_copy2.c:566 check_for_converted_path]
check_for_converted_path: path |/gpfs0/smb_snapshots2/filesetone/.snapshots/@GMT-2000.01.02-03.04.05/test.txt| is already converted. connect path = |/gpfs0/smb_snapshots2/filesetone/.snapshots/@GMT-2000.01.02-03.04.05|
As check_for_converted_path() detects an "already converted path",
_shadow_copy2_strip_snapshot_internal() just returns without modifying the value
of the timestamp.
By using shadow_copy2_strip_snapshot_converted() instead of
shadow_copy2_strip_snapshot() we can check if the path is in fact referring to a
VSS object by checking the "converted" bool.
An alternative way would have been directly checking fsp->fsp_name->twrp != 0,
but that would be a new semantic in the module, I'll leave this excersize for
the future when we clean up the usage of shadow_copy2_strip_snapshot() in the
whole module.
This change also switches to using the absolute paths in both place where
convert_sbuf() is called.
[1]
@@ -1309,8 +1348,16 @@ static int shadow_copy2_fstat(vfs_handle_struct *handle, files_struct *fsp,
saved_errno = errno;
}
+ DBG_DEBUG("fsp [%s]\n", fsp_str_dbg(fsp));
RN: vfs_shadow_copy2 fixinodes not correctly updating inode numbers
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 4a7e483c516cf2b9767919a764f05c43f4620cd7
Author: Ralph Boehme <slow at samba.org>
Date: Tue Jul 6 07:24:00 2021 +0200
selftest: add a test for shadow:fixinodes
This will fail with
Failed to open file \@GMT-2015.10.31-19.40.30\subdir\hardlink. NT_STATUS_ACCESS_DENIED
The open is failing in openat_pathref_fsp():
[2021/07/06 04:58:17.677104, 10, pid=95070, effective(1000, 1000), real(1000, 0)] ../../source3/smbd/files.c:541(openat_pathref_fsp)
openat_pathref_fsp: file [subdir/hardlink {@GMT-2015.10.31-19.40.30}] - dev/ino mismatch. Old (dev=64770, ino=3826943444). New (dev=64770, ino=1746568660).
[2021/07/06 04:58:17.677114, 10, pid=95070, effective(1000, 1000), real(1000, 0)] ../../source3/smbd/files.c:568(openat_pathref_fsp)
openat_pathref_fsp: Opening pathref for [subdir/hardlink {@GMT-2015.10.31-19.40.30}] failed: NT_STATUS_ACCESS_DENIED
The reason is subtle:
shadow_copy2 calculates inode numbers of snapshot files based on the path of the
file. The result of that when doing a path based stat() from filename_convert()
was
[2021/07/06 04:58:17.676159, 10, pid=95070, effective(1000, 1000), real(1000, 0)] ../../source3/smbd/filename.c:1945(filename_convert_internal)
filename_convert_internal: XXX smb_fname [subdir/hardlink {@GMT-2015.10.31-19.40.30}] (dev=64770, ino=3826943444).
which is the "Old" inode shown above.
Later in the open code called from openat_pathref_fsp() -> fd_openat() ->
non_widelink_open() since 4.14 we call SMB_VFS_FSTAT() where fsp->fsp_name will
be set to the new relative *basename* of the file:
[2021/07/06 04:58:17.676917, 10, pid=95070, effective(1000, 1000), real(1000, 0), class=vfs] ../../source3/modules/vfs_default.c:1302(vfswrap_fstat)
vfswrap_fstat: XXX fsp [hardlink {@GMT-2015.10.31-19.40.30}] (dev=64770, ino=3826943444)
So for stat() the hash function in called with the full path relative to the share
root:
subdir/hardlink
while for fstat() the hash function will used
hardlink
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 3aabc9825ca108641c2becf322fa0bd90ea18424
Author: Ralph Boehme <slow at samba.org>
Date: Tue Jul 6 07:22:40 2021 +0200
selftest: simplify snapshot directory creation in test_shadow_copy_torture.sh
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 0a0b438b8ab534eeb552a58ad72a714988e84d89
Author: Ralph Boehme <slow at samba.org>
Date: Tue Jul 6 07:20:15 2021 +0200
selftest: enable "shadow:fixinodes" in "shadow_write" share
The existing tests don't care and this will be used in a subsequent commit to
demonstrate that this option is currently broken.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 745ded9afe12fda6d45638097a32b01122748649
Author: Ralph Boehme <slow at samba.org>
Date: Tue Jul 6 07:19:36 2021 +0200
selftest: pass smbclient arg to samba3.blackbox.shadow_copy_torture test
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b32e56d6eb29bfb5f368602edbc10d4b8bc9b4f0
Author: Ralph Boehme <slow at samba.org>
Date: Wed Jul 7 12:40:05 2021 +0200
smbd: update smb_fname statinfo from fsp
fd_openat() has done an FSTAT on the handle so update the smb_fname stat info
with "truth". from the handle.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 2c9ae4b78cd0d5a3686e79a7497fd3da9f87a307
Author: Ralph Boehme <slow at samba.org>
Date: Wed Jul 7 11:48:34 2021 +0200
smbd: put back dev/ino stat/fstat check in openat_pathref_fsp()
This reverts commit a6df051dd5e8c63f2fdfdb20ee01169d2bdb97dd:
"s3: smbd: In openat_pathref_fsp(), just check we're opening the same file type, not dev and inode."
The prior changes mean we can go back to checking dev/ino
matches.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 18a30d939e6f7d49300f235385953412f9e971b9
Author: Ralph Boehme <slow at samba.org>
Date: Tue Jul 6 09:04:26 2021 +0200
smbd: canonicalize SMB_VFS_FSTAT() stat buffer
This helps code inside any module implementing fstat() looking at
fsp->fsp_name->st instead of the passed in stat buf.
I only ran afoul of this in a DEBUG message I added while debugging some inode
related problem.
No change in behaviour.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 40cf129abb51fa18a3bb6553da9c544f4d2d1f14
Author: Jeremy Allison <jra at samba.org>
Date: Tue Jul 13 11:41:05 2021 -0700
s3: VFS: streams_xattr: In streams_xattr_stat() use synthetic_pathref() with basename
Remove my poor imitation of synthetic_pathref(), just call the real thing.
We need to go through the full VFS stack here to get
the ino correct to get the fsp handle.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 03e36502f450d14656a824b36c33607ff418f0bf
Author: Jeremy Allison <jra at samba.org>
Date: Tue Jul 13 11:40:09 2021 -0700
s3: VFS: fruit. In ad_get_meta_fsp(), we only need a handle on the base file, not the stream.
We'll be calling SMB_VFS_FGETXATTR() on the base fsp anyway.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
-----------------------------------------------------------------------
Summary of changes:
selftest/target/Samba3.pm | 1 +
source3/include/proto.h | 5 +
source3/lib/system.c | 26 +++
source3/modules/The_New_VFS.org | 2 +-
source3/modules/The_New_VFS.txt | 2 +-
source3/modules/vfs_cap.c | 15 +-
source3/modules/vfs_ceph.c | 23 ++-
source3/modules/vfs_default.c | 33 ++--
source3/modules/vfs_fruit.c | 1 +
source3/modules/vfs_full_audit.c | 11 +-
source3/modules/vfs_glusterfs.c | 23 ++-
source3/modules/vfs_gpfs.c | 4 -
source3/modules/vfs_shadow_copy2.c | 199 ++++++++++++++++++-----
source3/modules/vfs_streams_xattr.c | 49 ++----
source3/modules/vfs_time_audit.c | 13 +-
source3/script/tests/test_shadow_copy_torture.sh | 32 +++-
source3/selftest/tests.py | 2 +-
source3/smbd/dir.c | 18 +-
source3/smbd/files.c | 25 +--
source3/smbd/globals.h | 2 +
source3/smbd/msdfs.c | 128 +++++++++------
source3/smbd/open.c | 4 +-
source3/smbd/proto.h | 4 +-
source3/smbd/trans2.c | 20 ++-
source3/wscript | 2 -
25 files changed, 441 insertions(+), 203 deletions(-)
Changeset truncated at 500 lines:
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index f958c49c716..054ceb38a09 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -3060,6 +3060,7 @@ sub provision($$)
aio write size = 0
error_inject:pwrite = EBADF
shadow:mountpoint = $shadow_tstdir
+ shadow:fixinodes = yes
[dfq]
path = $shrdir/dfree
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 4485cb43419..938a71e8083 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -214,6 +214,11 @@ int sys_fstat(int fd, SMB_STRUCT_STAT *sbuf,
bool fake_dir_create_times);
int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf,
bool fake_dir_create_times);
+int sys_fstatat(int fd,
+ const char *pathname,
+ SMB_STRUCT_STAT *sbuf,
+ int flags,
+ bool fake_dir_create_times);
int sys_posix_fallocate(int fd, off_t offset, off_t len);
int sys_fallocate(int fd, uint32_t mode, off_t offset, off_t len);
void kernel_flock(int fd, uint32_t share_access, uint32_t access_mask);
diff --git a/source3/lib/system.c b/source3/lib/system.c
index ad525737c5b..5d57ffadda1 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -369,6 +369,32 @@ int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf,
return ret;
}
+/*******************************************************************
+ An fstatat() wrapper.
+********************************************************************/
+
+int sys_fstatat(int fd,
+ const char *pathname,
+ SMB_STRUCT_STAT *sbuf,
+ int flags,
+ bool fake_dir_create_times)
+{
+ int ret;
+ struct stat statbuf;
+
+ ret = fstatat(fd, pathname, &statbuf, flags);
+ if (ret != 0) {
+ return -1;
+ }
+
+ /* we always want directories to appear zero size */
+ if (S_ISDIR(statbuf.st_mode)) {
+ statbuf.st_size = 0;
+ }
+ init_stat_ex_from_stat(sbuf, &statbuf, fake_dir_create_times);
+ return 0;
+}
+
/*******************************************************************
An posix_fallocate() wrapper.
********************************************************************/
diff --git a/source3/modules/The_New_VFS.org b/source3/modules/The_New_VFS.org
index cf8d21a38eb..8ad842d113f 100644
--- a/source3/modules/The_New_VFS.org
+++ b/source3/modules/The_New_VFS.org
@@ -270,7 +270,7 @@ whenever VFS access is done in a piecemeal fashion.
| SMB_VFS_PREAD_SEND() | [[fsp][fsp]] | - |
| SMB_VFS_PWRITE() | [[fsp][fsp]] | - |
| SMB_VFS_PWRITE_SEND() | [[fsp][fsp]] | - |
-| SMB_VFS_READ_DFS_PATHAT() | [[Symlink][Symlink]] | Todo |
+| SMB_VFS_READ_DFS_PATHAT() | [[Symlink][Symlink]] | - |
| SMB_VFS_READDIR() | [[fsp][fsp]] | - |
| SMB_VFS_READDIR_ATTR() | [[Path][Path]] | - |
| SMB_VFS_READLINKAT() | [[Symlink][Symlink]] | - |
diff --git a/source3/modules/The_New_VFS.txt b/source3/modules/The_New_VFS.txt
index 2acad5382db..4680a3f8055 100644
--- a/source3/modules/The_New_VFS.txt
+++ b/source3/modules/The_New_VFS.txt
@@ -338,7 +338,7 @@ Table of Contents
SMB_VFS_PREAD_SEND() [fsp] -
SMB_VFS_PWRITE() [fsp] -
SMB_VFS_PWRITE_SEND() [fsp] -
- SMB_VFS_READ_DFS_PATHAT() [Symlink] Todo
+ SMB_VFS_READ_DFS_PATHAT() [Symlink] -
SMB_VFS_READDIR() [fsp] -
SMB_VFS_READDIR_ATTR() [Path] -
SMB_VFS_READLINKAT() [Symlink] -
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index fb7f3028507..4a47b26c7b9 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -823,11 +823,20 @@ static NTSTATUS cap_read_dfs_pathat(struct vfs_handle_struct *handle,
struct referral **ppreflist,
size_t *preferral_count)
{
- char *cappath = capencode(talloc_tos(), smb_fname->base_name);
+ struct smb_filename *full_fname = NULL;
struct smb_filename *cap_smb_fname = NULL;
+ char *cappath = NULL;
NTSTATUS status;
+ full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+ dirfsp,
+ smb_fname);
+ if (full_fname == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ cappath = capencode(talloc_tos(), full_fname->base_name);
if (cappath == NULL) {
+ TALLOC_FREE(full_fname);
return NT_STATUS_NO_MEMORY;
}
cap_smb_fname = synthetic_smb_fname(talloc_tos(),
@@ -837,13 +846,14 @@ static NTSTATUS cap_read_dfs_pathat(struct vfs_handle_struct *handle,
smb_fname->twrp,
smb_fname->flags);
if (cap_smb_fname == NULL) {
+ TALLOC_FREE(full_fname);
TALLOC_FREE(cappath);
return NT_STATUS_NO_MEMORY;
}
status = SMB_VFS_NEXT_READ_DFS_PATHAT(handle,
mem_ctx,
- dirfsp,
+ handle->conn->cwd_fsp,
cap_smb_fname,
ppreflist,
preferral_count);
@@ -853,6 +863,7 @@ static NTSTATUS cap_read_dfs_pathat(struct vfs_handle_struct *handle,
smb_fname->st = cap_smb_fname->st;
}
+ TALLOC_FREE(full_fname);
TALLOC_FREE(cappath);
TALLOC_FREE(cap_smb_fname);
return status;
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index f3efd28107c..594ebce4b9a 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -1466,10 +1466,9 @@ static NTSTATUS cephwrap_read_dfs_pathat(struct vfs_handle_struct *handle,
char link_target_buf[7];
#endif
struct ceph_statx stx;
+ struct smb_filename *full_fname = NULL;
int ret;
- SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
-
if (is_named_stream(smb_fname)) {
status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
goto err;
@@ -1490,8 +1489,16 @@ static NTSTATUS cephwrap_read_dfs_pathat(struct vfs_handle_struct *handle,
}
}
+ full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+ dirfsp,
+ smb_fname);
+ if (full_fname == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto err;
+ }
+
ret = ceph_statx(handle->data,
- smb_fname->base_name,
+ full_fname->base_name,
&stx,
SAMBA_STATX_ATTR_MASK,
AT_SYMLINK_NOFOLLOW);
@@ -1501,20 +1508,20 @@ static NTSTATUS cephwrap_read_dfs_pathat(struct vfs_handle_struct *handle,
}
referral_len = ceph_readlink(handle->data,
- smb_fname->base_name,
+ full_fname->base_name,
link_target,
bufsize - 1);
if (referral_len < 0) {
/* ceph errors are -errno. */
if (-referral_len == EINVAL) {
DBG_INFO("%s is not a link.\n",
- smb_fname->base_name);
+ full_fname->base_name);
status = NT_STATUS_OBJECT_TYPE_MISMATCH;
} else {
status = map_nt_error_from_unix(-referral_len);
DBG_ERR("Error reading "
"msdfs link %s: %s\n",
- smb_fname->base_name,
+ full_fname->base_name,
strerror(errno));
}
goto err;
@@ -1522,7 +1529,7 @@ static NTSTATUS cephwrap_read_dfs_pathat(struct vfs_handle_struct *handle,
link_target[referral_len] = '\0';
DBG_INFO("%s -> %s\n",
- smb_fname->base_name,
+ full_fname->base_name,
link_target);
if (!strnequal(link_target, "msdfs:", 6)) {
@@ -1532,6 +1539,7 @@ static NTSTATUS cephwrap_read_dfs_pathat(struct vfs_handle_struct *handle,
if (ppreflist == NULL && preferral_count == NULL) {
/* Early return for checking if this is a DFS link. */
+ TALLOC_FREE(full_fname);
init_stat_ex_from_ceph_statx(&smb_fname->st, &stx);
return NT_STATUS_OK;
}
@@ -1554,6 +1562,7 @@ static NTSTATUS cephwrap_read_dfs_pathat(struct vfs_handle_struct *handle,
if (link_target != link_target_buf) {
TALLOC_FREE(link_target);
}
+ TALLOC_FREE(full_fname);
return status;
}
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index e4f6510ec0b..102938e332e 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -437,8 +437,6 @@ static NTSTATUS vfswrap_read_dfs_pathat(struct vfs_handle_struct *handle,
#endif
int ret;
- SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
-
if (is_named_stream(smb_fname)) {
status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
goto err;
@@ -459,7 +457,7 @@ static NTSTATUS vfswrap_read_dfs_pathat(struct vfs_handle_struct *handle,
}
}
- referral_len = readlinkat(fsp_get_io_fd(dirfsp),
+ referral_len = readlinkat(fsp_get_pathref_fd(dirfsp),
smb_fname->base_name,
link_target,
bufsize - 1);
@@ -499,9 +497,11 @@ static NTSTATUS vfswrap_read_dfs_pathat(struct vfs_handle_struct *handle,
goto err;
}
- ret = sys_lstat(smb_fname->base_name,
- &smb_fname->st,
- lp_fake_directory_create_times(SNUM(handle->conn)));
+ ret = sys_fstatat(fsp_get_pathref_fd(dirfsp),
+ smb_fname->base_name,
+ &smb_fname->st,
+ AT_SYMLINK_NOFOLLOW,
+ lp_fake_directory_create_times(SNUM(handle->conn)));
if (ret < 0) {
status = map_nt_error_from_unix(errno);
goto err;
@@ -581,18 +581,13 @@ static struct dirent *vfswrap_readdir(vfs_handle_struct *handle,
SMB_STRUCT_STAT *sbuf)
{
struct dirent *result;
- bool do_stat = false;
bool fake_ctime = lp_fake_directory_create_times(SNUM(handle->conn));
int flags = AT_SYMLINK_NOFOLLOW;
- struct stat st;
+ SMB_STRUCT_STAT st;
int ret;
START_PROFILE(syscall_readdir);
-#if defined(HAVE_DIRFD) && defined(HAVE_FSTATAT)
- do_stat = true;
-#endif
-
result = readdir(dirp);
END_PROFILE(syscall_readdir);
@@ -609,15 +604,11 @@ static struct dirent *vfswrap_readdir(vfs_handle_struct *handle,
*/
SET_STAT_INVALID(*sbuf);
- /* See if we can efficiently return this. */
- if (!do_stat) {
- return result;
- }
-
- ret = fstatat(dirfd(dirp),
+ ret = sys_fstatat(dirfd(dirp),
result->d_name,
&st,
- flags);
+ flags,
+ fake_ctime);
if (ret != 0) {
return result;
}
@@ -628,12 +619,12 @@ static struct dirent *vfswrap_readdir(vfs_handle_struct *handle,
* as we don't know if they wanted the link info, or its
* target info.
*/
- if (S_ISLNK(st.st_mode) &&
+ if (S_ISLNK(st.st_ex_mode) &&
!(dirfsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH))
{
return result;
}
- init_stat_ex_from_stat(sbuf, &st, fake_ctime);
+ *sbuf = st;
return result;
}
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 46614939a06..ce42202b4a3 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -231,6 +231,7 @@ static struct adouble *ad_get_meta_fsp(TALLOC_CTX *ctx,
if (smb_fname_cp == NULL) {
return NULL;
}
+ TALLOC_FREE(smb_fname_cp->stream_name);
config->in_openat_pathref_fsp = true;
status = openat_pathref_fsp(handle->conn->cwd_fsp,
smb_fname_cp);
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 5dbfb19f4c0..ceda99d4568 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -919,8 +919,16 @@ static NTSTATUS smb_full_audit_read_dfs_pathat(struct vfs_handle_struct *handle,
struct referral **ppreflist,
size_t *preferral_count)
{
+ struct smb_filename *full_fname = NULL;
NTSTATUS status;
+ full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+ dirfsp,
+ smb_fname);
+ if (full_fname == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
status = SMB_VFS_NEXT_READ_DFS_PATHAT(handle,
mem_ctx,
dirfsp,
@@ -932,8 +940,9 @@ static NTSTATUS smb_full_audit_read_dfs_pathat(struct vfs_handle_struct *handle,
NT_STATUS_IS_OK(status),
handle,
"%s",
- smb_fname_str_do_log(handle->conn, smb_fname));
+ smb_fname_str_do_log(handle->conn, full_fname));
+ TALLOC_FREE(full_fname);
return status;
}
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index c3d1c61f020..c9736459cf5 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -2211,10 +2211,9 @@ static NTSTATUS vfs_gluster_read_dfs_pathat(struct vfs_handle_struct *handle,
char link_target_buf[7];
#endif
struct stat st;
+ struct smb_filename *full_fname = NULL;
int ret;
- SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
-
if (is_named_stream(smb_fname)) {
status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
goto err;
@@ -2235,25 +2234,33 @@ static NTSTATUS vfs_gluster_read_dfs_pathat(struct vfs_handle_struct *handle,
}
}
- ret = glfs_lstat(handle->data, smb_fname->base_name, &st);
+ full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+ dirfsp,
+ smb_fname);
+ if (full_fname == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto err;
+ }
+
+ ret = glfs_lstat(handle->data, full_fname->base_name, &st);
if (ret < 0) {
status = map_nt_error_from_unix(errno);
goto err;
}
referral_len = glfs_readlink(handle->data,
- smb_fname->base_name,
+ full_fname->base_name,
link_target,
bufsize - 1);
if (referral_len < 0) {
if (errno == EINVAL) {
- DBG_INFO("%s is not a link.\n", smb_fname->base_name);
+ DBG_INFO("%s is not a link.\n", full_fname->base_name);
status = NT_STATUS_OBJECT_TYPE_MISMATCH;
} else {
status = map_nt_error_from_unix(errno);
DBG_ERR("Error reading "
"msdfs link %s: %s\n",
- smb_fname->base_name,
+ full_fname->base_name,
strerror(errno));
}
goto err;
@@ -2261,7 +2268,7 @@ static NTSTATUS vfs_gluster_read_dfs_pathat(struct vfs_handle_struct *handle,
link_target[referral_len] = '\0';
DBG_INFO("%s -> %s\n",
- smb_fname->base_name,
+ full_fname->base_name,
link_target);
if (!strnequal(link_target, "msdfs:", 6)) {
@@ -2271,6 +2278,7 @@ static NTSTATUS vfs_gluster_read_dfs_pathat(struct vfs_handle_struct *handle,
if (ppreflist == NULL && preferral_count == NULL) {
/* Early return for checking if this is a DFS link. */
+ TALLOC_FREE(full_fname);
smb_stat_ex_from_stat(&smb_fname->st, &st);
return NT_STATUS_OK;
}
@@ -2293,6 +2301,7 @@ static NTSTATUS vfs_gluster_read_dfs_pathat(struct vfs_handle_struct *handle,
if (link_target != link_target_buf) {
TALLOC_FREE(link_target);
}
+ TALLOC_FREE(full_fname);
return status;
}
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 6acdc9129b7..d74bc43db0e 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -1573,7 +1573,6 @@ static NTSTATUS vfs_gpfs_fset_dos_attributes(struct vfs_handle_struct *handle,
static int stat_with_capability(struct vfs_handle_struct *handle,
struct smb_filename *smb_fname, int flag)
{
-#if defined(HAVE_FSTATAT)
int fd = -1;
NTSTATUS status;
struct smb_filename *dir_name = NULL;
@@ -1611,9 +1610,6 @@ static int stat_with_capability(struct vfs_handle_struct *handle,
}
return ret;
-#else
- return -1;
-#endif
}
static int vfs_gpfs_stat(struct vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index 31709a31a1a..d61b3eac4b9 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -1168,19 +1168,45 @@ static int shadow_copy2_linkat(vfs_handle_struct *handle,
static int shadow_copy2_stat(vfs_handle_struct *handle,
struct smb_filename *smb_fname)
{
+ struct shadow_copy2_private *priv = NULL;
time_t timestamp = 0;
char *stripped = NULL;
+ bool converted = false;
+ char *abspath = NULL;
char *tmp;
- int saved_errno = 0;
- int ret;
+ int ret = 0;
- if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
- smb_fname,
- ×tamp, &stripped)) {
+ SMB_VFS_HANDLE_GET_DATA(handle, priv, struct shadow_copy2_private,
+ return -1);
+
+ if (!shadow_copy2_strip_snapshot_converted(talloc_tos(),
+ handle,
+ smb_fname,
+ ×tamp,
+ &stripped,
+ &converted)) {
return -1;
}
if (timestamp == 0) {
- return SMB_VFS_NEXT_STAT(handle, smb_fname);
+ TALLOC_FREE(stripped);
+ ret = SMB_VFS_NEXT_STAT(handle, smb_fname);
+ if (ret != 0) {
+ return ret;
+ }
+ if (!converted) {
--
Samba Shared Repository
More information about the samba-cvs
mailing list