The Samba-Bugzilla – Attachment 15848 Details for
Bug 14293
Missing check for DMAPI offline status in async DOS attributes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am fix for 4.12.next, 4.11.next.
bug-14293-4.x (text/plain), 9.12 KB, created by
Jeremy Allison
on 2020-03-06 19:29:25 UTC
(
hide
)
Description:
git-am fix for 4.12.next, 4.11.next.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2020-03-06 19:29:25 UTC
Size:
9.12 KB
patch
obsolete
>From a9784537d72869768e1dbea7df20d304039aa29a Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Mon, 24 Feb 2020 14:24:12 +0100 >Subject: [PATCH 1/5] VFS: default: let vfswrap_is_offline() take conn, not > handle > >vfswrap_is_offline() has been converted to a "helper" function some time ago, it >had been a VFS interface function before. To make this change more obvious let >it take a struct connection_struct instead of a struct vfs_handle_struct which >is the canonical first parameter to VFS functions. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14293 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit d4c69d82bdc0fa029609032a9d32f32fa1708beb) >--- > source3/modules/vfs_default.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > >diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c >index 37b59d8c3c0..209db91381e 100644 >--- a/source3/modules/vfs_default.c >+++ b/source3/modules/vfs_default.c >@@ -1638,7 +1638,7 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle, > return NT_STATUS_NOT_SUPPORTED; > } > >-static bool vfswrap_is_offline(struct vfs_handle_struct *handle, >+static bool vfswrap_is_offline(struct connection_struct *conn, > const struct smb_filename *fname, > SMB_STRUCT_STAT *sbuf); > >@@ -1648,7 +1648,7 @@ static NTSTATUS vfswrap_get_dos_attributes(struct vfs_handle_struct *handle, > { > bool offline; > >- offline = vfswrap_is_offline(handle, smb_fname, &smb_fname->st); >+ offline = vfswrap_is_offline(handle->conn, smb_fname, &smb_fname->st); > if (offline) { > *dosmode |= FILE_ATTRIBUTE_OFFLINE; > } >@@ -1798,7 +1798,9 @@ static NTSTATUS vfswrap_fget_dos_attributes(struct vfs_handle_struct *handle, > { > bool offline; > >- offline = vfswrap_is_offline(handle, fsp->fsp_name, &fsp->fsp_name->st); >+ offline = vfswrap_is_offline(handle->conn, >+ fsp->fsp_name, >+ &fsp->fsp_name->st); > if (offline) { > *dosmode |= FILE_ATTRIBUTE_OFFLINE; > } >@@ -3543,7 +3545,7 @@ static bool vfswrap_aio_force(struct vfs_handle_struct *handle, struct files_str > return false; > } > >-static bool vfswrap_is_offline(struct vfs_handle_struct *handle, >+static bool vfswrap_is_offline(struct connection_struct *conn, > const struct smb_filename *fname, > SMB_STRUCT_STAT *sbuf) > { >@@ -3555,7 +3557,7 @@ static bool vfswrap_is_offline(struct vfs_handle_struct *handle, > return false; > } > >- if (!lp_dmapi_support(SNUM(handle->conn)) || !dmapi_have_session()) { >+ if (!lp_dmapi_support(SNUM(conn)) || !dmapi_have_session()) { > #if defined(ENOTSUP) > errno = ENOTSUP; > #endif >-- >2.25.0.265.gbab2e86ba0-goog > > >From fcbd9f1f94fc0ee2ad1dc1855907b623ee212457 Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Mon, 24 Feb 2020 14:28:19 +0100 >Subject: [PATCH 2/5] VFS: default: remove unused arg from vfswrap_is_offline() > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14293 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit 99873724cd493366c9957fd9fe230d52a6f02691) >--- > source3/modules/vfs_default.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > >diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c >index 209db91381e..b64071d6870 100644 >--- a/source3/modules/vfs_default.c >+++ b/source3/modules/vfs_default.c >@@ -1639,8 +1639,7 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle, > } > > static bool vfswrap_is_offline(struct connection_struct *conn, >- const struct smb_filename *fname, >- SMB_STRUCT_STAT *sbuf); >+ const struct smb_filename *fname); > > static NTSTATUS vfswrap_get_dos_attributes(struct vfs_handle_struct *handle, > struct smb_filename *smb_fname, >@@ -1648,7 +1647,7 @@ static NTSTATUS vfswrap_get_dos_attributes(struct vfs_handle_struct *handle, > { > bool offline; > >- offline = vfswrap_is_offline(handle->conn, smb_fname, &smb_fname->st); >+ offline = vfswrap_is_offline(handle->conn, smb_fname); > if (offline) { > *dosmode |= FILE_ATTRIBUTE_OFFLINE; > } >@@ -1798,9 +1797,7 @@ static NTSTATUS vfswrap_fget_dos_attributes(struct vfs_handle_struct *handle, > { > bool offline; > >- offline = vfswrap_is_offline(handle->conn, >- fsp->fsp_name, >- &fsp->fsp_name->st); >+ offline = vfswrap_is_offline(handle->conn, fsp->fsp_name); > if (offline) { > *dosmode |= FILE_ATTRIBUTE_OFFLINE; > } >@@ -3546,8 +3543,7 @@ static bool vfswrap_aio_force(struct vfs_handle_struct *handle, struct files_str > } > > static bool vfswrap_is_offline(struct connection_struct *conn, >- const struct smb_filename *fname, >- SMB_STRUCT_STAT *sbuf) >+ const struct smb_filename *fname) > { > NTSTATUS status; > char *path; >-- >2.25.0.265.gbab2e86ba0-goog > > >From af2b08d90539b8ef5c2ecbd9116dccfe939f0fe5 Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Mon, 24 Feb 2020 14:29:01 +0100 >Subject: [PATCH 3/5] VFS: default: avoid a crash in > vfswrap_getxattrat_do_sync() > >Must use tevent_req_data() to get our tevent_req state, talloc_get_type_abort() >will just crash as struct tevent_req != struct vfswrap_getxattrat_state. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14293 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit cbca811212a930b94f9917e5a82b6a95ab085e91) >--- > source3/modules/vfs_default.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c >index b64071d6870..69a7eba5015 100644 >--- a/source3/modules/vfs_default.c >+++ b/source3/modules/vfs_default.c >@@ -3325,7 +3325,7 @@ static struct tevent_req *vfswrap_getxattrat_send( > > static void vfswrap_getxattrat_do_sync(struct tevent_req *req) > { >- struct vfswrap_getxattrat_state *state = talloc_get_type_abort( >+ struct vfswrap_getxattrat_state *state = tevent_req_data( > req, struct vfswrap_getxattrat_state); > char *path = NULL; > char *tofree = NULL; >-- >2.25.0.265.gbab2e86ba0-goog > > >From 145b99e3a9ce1f740a2159487b85feb560d0ec4a Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Mon, 24 Feb 2020 14:30:37 +0100 >Subject: [PATCH 4/5] VFS: default: use correct type for pathlen in > vfswrap_getxattrat_do_sync() > >full_path_tos() returns a ssize_t. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14293 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit ace296b97642d9160ea66db89dcd0f24a21dba4e) >--- > source3/modules/vfs_default.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c >index 69a7eba5015..bd5d4f3416a 100644 >--- a/source3/modules/vfs_default.c >+++ b/source3/modules/vfs_default.c >@@ -3330,7 +3330,7 @@ static void vfswrap_getxattrat_do_sync(struct tevent_req *req) > char *path = NULL; > char *tofree = NULL; > char pathbuf[PATH_MAX+1]; >- size_t pathlen; >+ ssize_t pathlen; > int err; > > pathlen = full_path_tos(state->dir_fsp->fsp_name->base_name, >-- >2.25.0.265.gbab2e86ba0-goog > > >From 09a5afd844ef2fae24e04cd5ce327fdf2679a791 Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Mon, 24 Feb 2020 15:03:56 +0100 >Subject: [PATCH 5/5] VFS: default: add support for FILE_ATTRIBUTE_OFFLINE to > async dosmode > >This had been missing in the initial async dosmode implementation. It's the >responsibility of the sync and async dosmode functions to call >vfswrap_is_offline() since the offline functionality has been converted from a >first class VFS function to be a part of the DOS attributes VFS functions. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14293 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit a23f8d913fa8d77bab394aea9a8e7df2704e8b19) >--- > source3/modules/vfs_default.c | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > >diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c >index bd5d4f3416a..a30f3ba1d31 100644 >--- a/source3/modules/vfs_default.c >+++ b/source3/modules/vfs_default.c >@@ -1719,6 +1719,12 @@ static void vfswrap_get_dos_attributes_getxattr_done(struct tevent_req *subreq) > struct vfswrap_get_dos_attributes_state); > ssize_t xattr_size; > DATA_BLOB blob = {0}; >+ char *path = NULL; >+ char *tofree = NULL; >+ char pathbuf[PATH_MAX+1]; >+ ssize_t pathlen; >+ struct smb_filename smb_fname; >+ bool offline; > NTSTATUS status; > > xattr_size = SMB_VFS_GETXATTRAT_RECV(subreq, >@@ -1767,6 +1773,29 @@ static void vfswrap_get_dos_attributes_getxattr_done(struct tevent_req *subreq) > return; > } > >+ pathlen = full_path_tos(state->dir_fsp->fsp_name->base_name, >+ state->smb_fname->base_name, >+ pathbuf, >+ sizeof(pathbuf), >+ &path, >+ &tofree); >+ if (pathlen == -1) { >+ tevent_req_nterror(req, NT_STATUS_NO_MEMORY); >+ return; >+ } >+ >+ smb_fname = (struct smb_filename) { >+ .base_name = path, >+ .st = state->smb_fname->st, >+ .flags = state->smb_fname->flags, >+ }; >+ >+ offline = vfswrap_is_offline(state->conn, &smb_fname); >+ if (offline) { >+ state->dosmode |= FILE_ATTRIBUTE_OFFLINE; >+ } >+ TALLOC_FREE(tofree); >+ > tevent_req_done(req); > return; > } >-- >2.25.0.265.gbab2e86ba0-goog >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
slow
:
review+
Actions:
View
Attachments on
bug 14293
: 15848