From: Ralph Boehme Date: Mon, 1 Feb 2021 11:37:10 +0000 (+0100) Subject: smbd: don't overwrite _mode if neither a msdfs symlink nor get_dosmode is requested X-Git-Tag: tevent-0.11.0~1831 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d78964c40b5ca5ee0658c46d492b3dcd6f6b4b94;p=thirdparty%2Fsamba.git smbd: don't overwrite _mode if neither a msdfs symlink nor get_dosmode is requested BUG: https://bugzilla.samba.org/show_bug.cgi?id=14629 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/selftest/knownfail.d/samba3.smbtorture_s3 b/selftest/knownfail.d/samba3.smbtorture_s3 deleted file mode 100644 index 2b9c93ab2c7..00000000000 --- a/selftest/knownfail.d/samba3.smbtorture_s3 +++ /dev/null @@ -1,4 +0,0 @@ -^samba3.smbtorture_s3.plain.POSIX-LS-WILDCARD.smbtorture.* -^samba3.smbtorture_s3.crypt.POSIX-LS-WILDCARD.smbtorture.* -^samba3.smbtorture_s3.plain.POSIX-LS-SINGLE.smbtorture.* -^samba3.smbtorture_s3.crypt.POSIX-LS-SINGLE.smbtorture.* diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 6dbbe9cd7f1..a2eb6546474 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -1755,7 +1755,6 @@ static bool smbd_dirptr_lanman2_mode_fn(TALLOC_CTX *ctx, struct smbd_dirptr_lanman2_state *state = (struct smbd_dirptr_lanman2_state *)private_data; bool ms_dfs_link = false; - uint32_t mode = 0; if (smb_fname->flags & SMB_FILENAME_POSIX_PATH) { if (SMB_VFS_LSTAT(state->conn, smb_fname) != 0) { @@ -1765,6 +1764,7 @@ static bool smbd_dirptr_lanman2_mode_fn(TALLOC_CTX *ctx, strerror(errno))); return false; } + return true; } else if (!VALID_STAT(smb_fname->st) && SMB_VFS_STAT(state->conn, smb_fname) != 0) { /* Needed to show the msdfs symlinks as @@ -1779,16 +1779,18 @@ static bool smbd_dirptr_lanman2_mode_fn(TALLOC_CTX *ctx, strerror(errno))); return false; } + + *_mode = dos_mode_msdfs(state->conn, smb_fname); + return true; } - if (ms_dfs_link) { - mode = dos_mode_msdfs(state->conn, smb_fname); - } else if (get_dosmode) { - mode = fdos_mode(smb_fname->fsp); - smb_fname->st = smb_fname->fsp->fsp_name->st; + if (!get_dosmode) { + return true; } - *_mode = mode; + *_mode = fdos_mode(smb_fname->fsp); + smb_fname->st = smb_fname->fsp->fsp_name->st; + return true; }