]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: use fsp_get_pathref_fd() as part of DEBUG and syslog messages
authorRalph Boehme <slow@samba.org>
Sat, 3 Oct 2020 15:41:17 +0000 (17:41 +0200)
committerRalph Boehme <slow@samba.org>
Wed, 16 Dec 2020 09:08:30 +0000 (09:08 +0000)
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 <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/locking/posix.c
source3/modules/vfs_audit.c
source3/modules/vfs_extd_audit.c
source3/smbd/close.c
source3/smbd/reply.c
source3/smbd/smb1_utils.c

index 625c5cbee89967d21e9f62cf70f44042a1dd767c..a233f74d5934843377289d00b31a6ef6183d0d51 100644 (file)
@@ -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));
 }
 
index ce7eb7a46fbd65805e4511ac523e0681351fb725..bf0e043f505b4797da194ed56c947843682ec10a 100644 (file)
@@ -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) : "");
 
index 4eaaf1f6ce0641aad45e1297602cbef482854488..9b231d76ed9bd8bfc782bd69757e6b730479c9a6 100644 (file)
@@ -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) : ""));
 
index 919db9c4d809efcb0b45c8be71431cdd8227a176..28bf97b4775b008473241d6e3ec6a7d932b3e539 100644 (file)
@@ -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)));
        }
 
index 88a0ed8805ff047c47cb49aff3685e6a88c13cea..0c6778bda766377a05be376578673c50e303d0d6 100644 (file)
@@ -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) {
index 6f587dfa60b9cbaa39e6554ea59314eca59b259c..25a178007dce039ea615e36876924529bf9c34dc 100644 (file)
@@ -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,