From: Ralph Boehme Date: Sat, 3 Oct 2020 15:41:17 +0000 (+0200) Subject: smbd: use fsp_get_pathref_fd() as part of DEBUG and syslog messages X-Git-Tag: samba-4.14.0rc1~416 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f5632b43337c04e4c51c952326324fb475646ec3;p=thirdparty%2Fsamba.git smbd: use fsp_get_pathref_fd() as part of DEBUG and syslog messages Nothing really dangerous is done with the fds here, so we can safely use fsp_get_pathref_fd() in these cases. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/locking/posix.c b/source3/locking/posix.c index 625c5cbee89..a233f74d593 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -551,7 +551,7 @@ static void add_fd_to_close_entry(const files_struct *fsp) SMB_ASSERT(NT_STATUS_IS_OK(status)); DBG_DEBUG("added fd %d file %s\n", - fsp->fh->fd, + fsp_get_pathref_fd(fsp), fsp_str_dbg(fsp)); } diff --git a/source3/modules/vfs_audit.c b/source3/modules/vfs_audit.c index ce7eb7a46fb..bf0e043f505 100644 --- a/source3/modules/vfs_audit.c +++ b/source3/modules/vfs_audit.c @@ -225,7 +225,7 @@ static int audit_close(vfs_handle_struct *handle, files_struct *fsp) result = SMB_VFS_NEXT_CLOSE(handle, fsp); syslog(audit_syslog_priority(handle), "close fd %d %s%s\n", - fsp->fh->fd, + fsp_get_pathref_fd(fsp), (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : ""); diff --git a/source3/modules/vfs_extd_audit.c b/source3/modules/vfs_extd_audit.c index 4eaaf1f6ce0..9b231d76ed9 100644 --- a/source3/modules/vfs_extd_audit.c +++ b/source3/modules/vfs_extd_audit.c @@ -252,12 +252,12 @@ static int audit_close(vfs_handle_struct *handle, files_struct *fsp) if (lp_syslog() > 0) { syslog(audit_syslog_priority(handle), "close fd %d %s%s\n", - fsp->fh->fd, + fsp_get_pathref_fd(fsp), (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : ""); } DEBUG(2, ("vfs_extd_audit: close fd %d %s %s\n", - fsp->fh->fd, + fsp_get_pathref_fd(fsp), (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : "")); diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 919db9c4d80..28bf97b4775 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -1269,7 +1269,7 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp, if (!NT_STATUS_IS_OK(status1)) { DEBUG(0, ("Could not close dir! fname=%s, fd=%d, err=%d=%s\n", - fsp_str_dbg(fsp), fsp->fh->fd, errno, + fsp_str_dbg(fsp), fsp_get_pathref_fd(fsp), errno, strerror(errno))); } diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 88a0ed8805f..0c6778bda76 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -5991,7 +5991,7 @@ void reply_close(struct smb_request *smb1req) DBG_NOTICE("Close %s fd=%d %s (numopen=%d)\n", fsp->fsp_flags.is_directory ? "directory" : "file", - fsp->fh->fd, fsp_fnum_dbg(fsp), + fsp_get_pathref_fd(fsp), fsp_fnum_dbg(fsp), conn->num_files_open); if (!fsp->fsp_flags.is_directory) { diff --git a/source3/smbd/smb1_utils.c b/source3/smbd/smb1_utils.c index 6f587dfa60b..25a178007dc 100644 --- a/source3/smbd/smb1_utils.c +++ b/source3/smbd/smb1_utils.c @@ -23,6 +23,7 @@ #include "smb1_utils.h" #include "libcli/security/security.h" #include "lib/util/sys_rw_data.h" +#include "smbd/fd_handle.h" /**************************************************************************** Special FCB or DOS processing in the case of a sharing violation. @@ -57,7 +58,7 @@ struct files_struct *fcb_or_dos_open( "private_options = 0x%"PRIx32", " "access_mask = 0x%"PRIx32"\n", fsp_str_dbg(fsp), - fsp->fh->fd, + fsp_get_pathref_fd(fsp), fsp->vuid, fsp->file_pid, fsp->fh->private_options,