Don't do the get_real_filename() retry if we're in posix context of if
the connection is case sensitive.
The whole concept of case sensivity blows my brain. In SMB1 without
posix extensions it's a per-request thing. In SMB2 without posix
extensions this should just depend on "case sensitive = yes/no", and
in future SMB2 posix extensions this will become a per-request thing
again, depending on the existence of the posix create context.
Then there are other semantics that are attached to posix-ness, which
have nothing to do with case sensivity. See for example merge request
2819 and bug 8776, or commit
f0e1137425f. Also see
check_path_syntax_internal().
This patch uses the same flags as openat_pathref_fsp_case_insensitive()
does, but I am 100% certain this is wrong in a subtle way.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Dec 15 11:30:04 UTC 2022 on sn-devel-184
+++ /dev/null
-samba.tests.smb1posix
conn,
dirname,
0,
+ posix,
&smb_dirname,
&unparsed,
&substitute);
struct connection_struct *conn,
const char *path_in,
NTTIME twrp,
+ bool posix,
struct smb_filename **_smb_fname,
size_t *unparsed,
char **substitute)
struct smb_filename full_fname = {
.base_name = NULL,
.twrp = twrp,
+ .flags = posix ? SMB_FILENAME_POSIX_PATH : 0,
};
struct smb_filename rel_fname = {
.base_name = NULL,
.twrp = twrp,
+ .flags = full_fname.flags,
};
struct smb_filename *result = NULL;
struct files_struct *fsp = NULL;
char *path = NULL, *next = NULL;
+ bool case_sensitive;
int fd;
NTSTATUS status;
struct vfs_open_how how = {
fsp,
&how);
- if ((fd == -1) && (errno == ENOENT)) {
+ case_sensitive = (posix || conn->case_sensitive);
+
+ if ((fd == -1) && (errno == ENOENT) && !case_sensitive) {
const char *orig_base_name = rel_fname.base_name;
status = get_real_filename_at(
struct connection_struct *conn,
const char *path_in,
NTTIME twrp,
+ bool posix,
struct smb_filename **_smb_fname,
size_t *unparsed,
char **substitute);