selftest: remove error_inject from shadow_write share
commitb6c2c26e9ba02b6b7b0843e8a01344c774974dee
authorRalph Boehme <slow@samba.org>
Thu, 21 Dec 2023 18:40:21 +0000 (21 19:40 +0100)
committerJule Anger <janger@samba.org>
Tue, 9 Jan 2024 12:13:13 +0000 (9 12:13 +0000)
tree28cf09fae2c0da2ca520f794fbda12e79264f311
parentb9f60718ccd11510ce877e5286a1a35e844207b6
selftest: remove error_inject from shadow_write share

Frankly, I can't remember why I added this as part of bug 13688. The
goal of the corresponding test is to verify a write on a read-only
file handle fails. As the file is opened O_RDONLY, the write will fail
anyway and there's no need to inject the error.

To make things worse, having the error injected meant we didn't notice
when the underlying logic of forcing the open to be done with O_RDONLY
was done as O_RDWR, resulting in the write on the handle to succeed.

This happened when we introduced reopen_from_fsp(): the initial
pathref open of a path with a twrp value was correctly detected and
handled by shadow_copy2_openat(). However, when converting the pathref
open to a real one via reopen_from_fsp(), shadow_copy2_openat() only
sees the magic /proc/fd path and has no way of inferring that this was
originating from a prevous version open with a twrp value.

Tl;dr: we can just remove this error injection, it is not needed, the
correct fix is to implement this in the SMB layer which is done in the
subsequent commits.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13688

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 78119edba013583555069271bb61134c12c2c135)
selftest/knownfail.d/samba3.blackbox.shadow_copy_torture [new file with mode: 0644]
selftest/target/Samba3.pm