The branch, master has been updated
       via  d6a16ad00e4 s3:modules:vfs_virusfilter: Recent New_VFS changes 
break vfs_virusfilter_openat.
       via  4af98681425 s3: VFS: default: vfswrap_create_dfs_pathat() isn't 
restricted to dirfsp->conn->cwd_fsp anymore.
       via  8f38f886ffa s3: VFS: time_audit: Log full pathname as 
smb_time_audit_create_dfs_pathat() isn't restricted to dirfsp->conn->cwd_fsp 
anymore.
       via  49bcb913398 s3: VFS: full_audit: Log full pathname as 
smb_full_audit_create_dfs_pathat() isn't restricted to dirfsp->conn->cwd_fsp 
anymore.
       via  ea5c15358f1 s3: VFS: gluster: vfs_gluster_create_dfs_pathat() isn't 
restricted to dirfsp->conn->cwd_fsp anymore.
       via  c344ade7178 s3: VFS: ceph: cephwrap_create_dfs_pathat() isn't 
restricted to dirfsp->conn->cwd_fsp anymore.
      from  ec4794b5d9e s3:param: Fix segfault trying to add pcap printer 
without a [printers] share

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d6a16ad00e426a6f815215af71c071dd8e85a50a
Author: Trever L. Adams <trever.ad...@gmail.com>
Date:   Sat Mar 13 12:47:21 2021 -0700

    s3:modules:vfs_virusfilter: Recent New_VFS changes break 
vfs_virusfilter_openat.
    
    The_New_VFS introduces several changes that broke vfs_virusfilter_openat. 
The assert to make sure certain checks would work broke.
    
    This patch fixes those breaks and converts to the SMB_VFS_FSTAT_NEXT 
instead of SMB_VFS_STAT_NEXT.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14671
    RN: vfs_virusfilter_openat support New_VFS FSTAT, avoid 
SMB_ASSERT(fsp_get_pathref_fd(dirfsp) == AT_FDCWD); problem.
    
    Signed-off-by: Trever L. Adams" <trever.ad...@gmail.com>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power <npo...@samba.org>
    
    Autobuild-User(master): Noel Power <npo...@samba.org>
    Autobuild-Date(master): Mon Mar 22 19:44:30 UTC 2021 on sn-devel-184

commit 4af9868142529187a87b30cd522a144ead76cc8c
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Mar 16 18:26:43 2021 -0700

    s3: VFS: default: vfswrap_create_dfs_pathat() isn't restricted to 
dirfsp->conn->cwd_fsp anymore.
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power<npo...@samba.org>

commit 8f38f886ffa0845626de4d94e45685376f790d46
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Mar 16 21:50:08 2021 -0700

    s3: VFS: time_audit: Log full pathname as 
smb_time_audit_create_dfs_pathat() isn't restricted to dirfsp->conn->cwd_fsp 
anymore.
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power<npo...@samba.org>

commit 49bcb913398492f08a3d6d9b1ac36ff0563f71d7
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Mar 16 21:49:14 2021 -0700

    s3: VFS: full_audit: Log full pathname as 
smb_full_audit_create_dfs_pathat() isn't restricted to dirfsp->conn->cwd_fsp 
anymore.
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power<npo...@samba.org>

commit ea5c15358f12a6cd584b52039411e0feb526f380
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Mar 16 21:48:42 2021 -0700

    s3: VFS: gluster: vfs_gluster_create_dfs_pathat() isn't restricted to 
dirfsp->conn->cwd_fsp anymore.
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power <npo...@samba.org>

commit c344ade717853b2622602d2f1fa38d073ffc2810
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Mar 16 21:48:07 2021 -0700

    s3: VFS: ceph: cephwrap_create_dfs_pathat() isn't restricted to 
dirfsp->conn->cwd_fsp anymore.
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power<npo...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/modules/vfs_ceph.c        | 12 +++++++++---
 source3/modules/vfs_default.c     |  4 +---
 source3/modules/vfs_full_audit.c  | 11 ++++++++++-
 source3/modules/vfs_glusterfs.c   | 10 ++++++++--
 source3/modules/vfs_time_audit.c  | 14 ++++++++++++--
 source3/modules/vfs_virusfilter.c |  8 ++------
 6 files changed, 42 insertions(+), 17 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index e2f3691bc4f..e371090c95d 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -1379,8 +1379,14 @@ static NTSTATUS cephwrap_create_dfs_pathat(struct 
vfs_handle_struct *handle,
        NTSTATUS status = NT_STATUS_NO_MEMORY;
        int ret;
        char *msdfs_link = NULL;
+       struct smb_filename *full_fname = NULL;
 
-       SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                               dirfsp,
+                                               smb_fname);
+       if (full_fname == NULL) {
+               goto out;
+       }
 
        /* Form the msdfs_link contents */
        msdfs_link = msdfs_link_string(frame,
@@ -1392,7 +1398,7 @@ static NTSTATUS cephwrap_create_dfs_pathat(struct 
vfs_handle_struct *handle,
 
        ret = ceph_symlink(handle->data,
                        msdfs_link,
-                       smb_fname->base_name);
+                       full_fname->base_name);
        if (ret == 0) {
                status = NT_STATUS_OK;
        } else {
@@ -1402,7 +1408,7 @@ static NTSTATUS cephwrap_create_dfs_pathat(struct 
vfs_handle_struct *handle,
   out:
 
        DBG_DEBUG("[CEPH] create_dfs_pathat(%s) = %s\n",
-                       smb_fname->base_name,
+                       full_fname->base_name,
                        nt_errstr(status));
 
        TALLOC_FREE(frame);
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index e48deb022a7..9a2c13d743b 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -386,8 +386,6 @@ static NTSTATUS vfswrap_create_dfs_pathat(struct 
vfs_handle_struct *handle,
        int ret;
        char *msdfs_link = NULL;
 
-       SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
-
        /* Form the msdfs_link contents */
        msdfs_link = msdfs_link_string(frame,
                                        reflist,
@@ -397,7 +395,7 @@ static NTSTATUS vfswrap_create_dfs_pathat(struct 
vfs_handle_struct *handle,
        }
 
        ret = symlinkat(msdfs_link,
-                       fsp_get_io_fd(dirfsp),
+                       fsp_get_pathref_fd(dirfsp),
                        smb_fname->base_name);
        if (ret == 0) {
                status = NT_STATUS_OK;
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index e89307ce6a1..ee26c6a5bfa 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -895,6 +895,14 @@ static NTSTATUS smb_full_audit_create_dfs_pathat(struct 
vfs_handle_struct *handl
                                size_t referral_count)
 {
        NTSTATUS status;
+       struct smb_filename *full_fname = NULL;
+
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                                 dirfsp,
+                                                 smb_fname);
+       if (full_fname == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
 
        status = SMB_VFS_NEXT_CREATE_DFS_PATHAT(handle,
                        dirfsp,
@@ -906,8 +914,9 @@ static NTSTATUS smb_full_audit_create_dfs_pathat(struct 
vfs_handle_struct *handl
                NT_STATUS_IS_OK(status),
                handle,
                "%s",
-               smb_fname_str_do_log(handle->conn, smb_fname));
+               smb_fname_str_do_log(handle->conn, full_fname));
 
+       TALLOC_FREE(full_fname);
        return status;
 }
 
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 38c8a48c378..cb83e012424 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -2130,8 +2130,14 @@ static NTSTATUS vfs_gluster_create_dfs_pathat(struct 
vfs_handle_struct *handle,
        NTSTATUS status = NT_STATUS_NO_MEMORY;
        int ret;
        char *msdfs_link = NULL;
+       struct smb_filename *full_fname = NULL;
 
-       SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                                 dirfsp,
+                                                 smb_fname);
+       if (full_fname == NULL) {
+               goto out;
+       }
 
        /* Form the msdfs_link contents */
        msdfs_link = msdfs_link_string(frame,
@@ -2143,7 +2149,7 @@ static NTSTATUS vfs_gluster_create_dfs_pathat(struct 
vfs_handle_struct *handle,
 
        ret = glfs_symlink(handle->data,
                        msdfs_link,
-                       smb_fname->base_name);
+                       full_fname->base_name);
        if (ret == 0) {
                status = NT_STATUS_OK;
        } else {
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index 4c7f65020b1..175da80ff84 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -332,6 +332,14 @@ static NTSTATUS smb_time_audit_create_dfs_pathat(struct 
vfs_handle_struct *handl
        NTSTATUS result;
        struct timespec ts1,ts2;
        double timediff;
+       struct smb_filename *full_fname = NULL;
+
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                                 dirfsp,
+                                                 smb_fname);
+       if (full_fname == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
 
        clock_gettime_mono(&ts1);
        result = SMB_VFS_NEXT_CREATE_DFS_PATHAT(handle,
@@ -343,9 +351,11 @@ static NTSTATUS smb_time_audit_create_dfs_pathat(struct 
vfs_handle_struct *handl
        timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
 
        if (timediff > audit_timeout) {
-               smb_time_audit_log("get_dfs_referrals", timediff);
+               smb_time_audit_log_smb_fname("create_dfs_pathat",
+                       timediff,
+                       full_fname);
        }
-
+       TALLOC_FREE(full_fname);
        return result;
 }
 
diff --git a/source3/modules/vfs_virusfilter.c 
b/source3/modules/vfs_virusfilter.c
index e7017ee1c7a..25ef4b32490 100644
--- a/source3/modules/vfs_virusfilter.c
+++ b/source3/modules/vfs_virusfilter.c
@@ -1243,11 +1243,7 @@ static int virusfilter_vfs_openat(struct 
vfs_handle_struct *handle,
        bool ok1;
        char *sret = NULL;
        struct smb_filename *smb_fname = NULL;
-
-       /*
-        * For now assert this, so SMB_VFS_NEXT_STAT() below works.
-        */
-       SMB_ASSERT(fsp_get_pathref_fd(dirfsp) == AT_FDCWD);
+       SMB_STRUCT_STAT sbuf = smb_fname_in->st;
 
        SMB_VFS_HANDLE_GET_DATA(handle, config,
                                struct virusfilter_config, return -1);
@@ -1289,7 +1285,7 @@ static int virusfilter_vfs_openat(struct 
vfs_handle_struct *handle,
                goto virusfilter_vfs_open_next;
        }
 
-       ret = SMB_VFS_NEXT_STAT(handle, smb_fname);
+       ret = SMB_VFS_NEXT_FSTAT(handle, fsp, &sbuf);
        if (ret != 0) {
 
                /*


-- 
Samba Shared Repository

Reply via email to