The Samba-Bugzilla – Attachment 11022 Details for
Bug 11249
Mangled names do not work with acl_xattr
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am fix for 4.1.next.
bug-11249-4.1 (text/plain), 12.74 KB, created by
Jeremy Allison
on 2015-05-05 19:44:28 UTC
(
hide
)
Description:
git-am fix for 4.1.next.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2015-05-05 19:44:28 UTC
Size:
12.74 KB
patch
obsolete
>From 14f85ac27ca0ec23f9d45c7769150fdbf0b5ce70 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Fri, 1 May 2015 12:50:51 -0700 >Subject: [PATCH 1/4] s3: smbd: VFS: Add vfs_stat_smb_basename() - to be called > when we *know* stream name parsing has already been done. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=11249 > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Andreas Schneider <asn@samba.org> >Reviewed-by: Ralph Boehme <slow@samba.org> >(cherry picked from commit 044dabfd92d09de4f168a36a07ac3232f5647a1d) >--- > source3/smbd/proto.h | 2 ++ > source3/smbd/vfs.c | 26 ++++++++++++++++++++++++++ > 2 files changed, 28 insertions(+) > >diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h >index 327b25d..2ff0f88 100644 >--- a/source3/smbd/proto.h >+++ b/source3/smbd/proto.h >@@ -1158,6 +1158,8 @@ int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname, > SMB_STRUCT_STAT *psbuf); > int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname, > SMB_STRUCT_STAT *psbuf); >+int vfs_stat_smb_basename(struct connection_struct *conn, const char *fname, >+ SMB_STRUCT_STAT *psbuf); > NTSTATUS vfs_stat_fsp(files_struct *fsp); > NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid); > NTSTATUS vfs_streaminfo(connection_struct *conn, >diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c >index cdd5042..118f6c9 100644 >--- a/source3/smbd/vfs.c >+++ b/source3/smbd/vfs.c >@@ -1325,6 +1325,32 @@ int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname, > } > > /** >+ * XXX: This is temporary and there should be no callers of this once >+ * smb_filename is plumbed through all path based operations. >+ * >+ * Called when we know stream name parsing has already been done. >+ */ >+int vfs_stat_smb_basename(struct connection_struct *conn, const char *fname, >+ SMB_STRUCT_STAT *psbuf) >+{ >+ struct smb_filename smb_fname = { >+ .base_name = discard_const_p(char, fname) >+ }; >+ int ret; >+ >+ if (lp_posix_pathnames()) { >+ ret = SMB_VFS_LSTAT(conn, &smb_fname); >+ } else { >+ ret = SMB_VFS_STAT(conn, &smb_fname); >+ } >+ >+ if (ret != -1) { >+ *psbuf = smb_fname.st; >+ } >+ return ret; >+} >+ >+/** > * Ensure LSTAT is called for POSIX paths. > */ > >-- >2.2.0.rc0.207.ga3a616c > > >From c9dd784b37cf9d5fb43e8828bd536b5840d14050 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Fri, 1 May 2015 13:09:36 -0700 >Subject: [PATCH 2/4] s3: smbd: VFS: All the places that are currently calling > vfs_stat_smb_fname() and vfs_lstat_smb_fname() should be calling > vfs_stat_smb_basename(). > >They are all post-stream name processing. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=11249 > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Andreas Schneider <asn@samba.org> >Reviewed-by: Ralph Boehme <slow@samba.org> >(cherry picked from commit 14f4e254bb8d1f456ebb8da728f2fb812a9b3034) >--- > source3/modules/nfs4_acls.c | 4 ++-- > source3/modules/vfs_acl_common.c | 19 ++++++++++++++++++- > source3/modules/vfs_acl_tdb.c | 16 +++------------- > source3/modules/vfs_recycle.c | 2 +- > source3/modules/vfs_solarisacl.c | 2 +- > source3/modules/vfs_xattr_tdb.c | 2 +- > 6 files changed, 26 insertions(+), 19 deletions(-) > >diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c >index 500cb47..c7542db 100644 >--- a/source3/modules/nfs4_acls.c >+++ b/source3/modules/nfs4_acls.c >@@ -282,9 +282,9 @@ static int smbacl4_GetFileOwner(struct connection_struct *conn, > memset(psbuf, 0, sizeof(SMB_STRUCT_STAT)); > > /* Get the stat struct for the owner info. */ >- if (vfs_stat_smb_fname(conn, filename, psbuf) != 0) >+ if (vfs_stat_smb_basename(conn, filename, psbuf) != 0) > { >- DEBUG(8, ("vfs_stat_smb_fname failed with error %s\n", >+ DEBUG(8, ("vfs_stat_smb_basename failed with error %s\n", > strerror(errno))); > return -1; > } >diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c >index 57fc6c8..c9124a5 100644 >--- a/source3/modules/vfs_acl_common.c >+++ b/source3/modules/vfs_acl_common.c >@@ -617,7 +617,24 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle, > } > psbuf = &fsp->fsp_name->st; > } else { >- int ret = vfs_stat_smb_fname(handle->conn, >+ /* >+ * https://bugzilla.samba.org/show_bug.cgi?id=11249 >+ * >+ * We are currently guaranteed that 'name' here is >+ * a smb_fname->base_name, which *cannot* contain >+ * a stream name (':'). vfs_stat_smb_fname() splits >+ * a name into a base name + stream name, which >+ * when we get here we know we've already done. >+ * So we have to call the stat or lstat VFS >+ * calls directly here. Else, a base_name that >+ * contains a ':' (from a demangled name) will >+ * get split again. >+ * >+ * FIXME. >+ * This uglyness will go away once smb_fname >+ * is fully plumbed through the VFS. >+ */ >+ int ret = vfs_stat_smb_basename(handle->conn, > name, > &sbuf); > if (ret == -1) { >diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c >index 80839e3..ec0aaa4 100644 >--- a/source3/modules/vfs_acl_tdb.c >+++ b/source3/modules/vfs_acl_tdb.c >@@ -159,7 +159,7 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx, > status = vfs_stat_fsp(fsp); > sbuf = fsp->fsp_name->st; > } else { >- int ret = vfs_stat_smb_fname(handle->conn, name, &sbuf); >+ int ret = vfs_stat_smb_basename(handle->conn, name, &sbuf); > if (ret == -1) { > status = map_nt_error_from_unix(errno); > } >@@ -282,12 +282,7 @@ static int rmdir_acl_tdb(vfs_handle_struct *handle, const char *path) > struct db_context *db = acl_db; > int ret = -1; > >- if (lp_posix_pathnames()) { >- ret = vfs_lstat_smb_fname(handle->conn, path, &sbuf); >- } else { >- ret = vfs_stat_smb_fname(handle->conn, path, &sbuf); >- } >- >+ ret = vfs_stat_smb_basename(handle->conn, path, &sbuf); > if (ret == -1) { > return -1; > } >@@ -347,12 +342,7 @@ static int sys_acl_set_file_tdb(vfs_handle_struct *handle, > struct db_context *db = acl_db; > int ret = -1; > >- if (lp_posix_pathnames()) { >- ret = vfs_lstat_smb_fname(handle->conn, path, &sbuf); >- } else { >- ret = vfs_stat_smb_fname(handle->conn, path, &sbuf); >- } >- >+ ret = vfs_stat_smb_basename(handle->conn, path, &sbuf); > if (ret == -1) { > return -1; > } >diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c >index 00d7f34..9af78fd 100644 >--- a/source3/modules/vfs_recycle.c >+++ b/source3/modules/vfs_recycle.c >@@ -188,7 +188,7 @@ static bool recycle_directory_exist(vfs_handle_struct *handle, const char *dname > { > SMB_STRUCT_STAT st; > >- if (vfs_stat_smb_fname(handle->conn, dname, &st) == 0) { >+ if (vfs_stat_smb_basename(handle->conn, dname, &st) == 0) { > if (S_ISDIR(st.st_ex_mode)) { > return True; > } >diff --git a/source3/modules/vfs_solarisacl.c b/source3/modules/vfs_solarisacl.c >index 9b3c4f6..efd2d75 100644 >--- a/source3/modules/vfs_solarisacl.c >+++ b/source3/modules/vfs_solarisacl.c >@@ -167,7 +167,7 @@ int solarisacl_sys_acl_set_file(vfs_handle_struct *handle, > * that has not been specified in "type" from the file first > * and concatenate it with the acl provided. > */ >- if (vfs_stat_smb_fname(handle->conn, name, &s) != 0) { >+ if (vfs_stat_smb_basename(handle->conn, name, &s) != 0) { > DEBUG(10, ("Error in stat call: %s\n", strerror(errno))); > goto done; > } >diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c >index 43456cf..590ffaa 100644 >--- a/source3/modules/vfs_xattr_tdb.c >+++ b/source3/modules/vfs_xattr_tdb.c >@@ -414,7 +414,7 @@ static int xattr_tdb_rmdir(vfs_handle_struct *handle, const char *path) > TALLOC_FREE(frame); return -1; > }); > >- if (vfs_stat_smb_fname(handle->conn, path, &sbuf) == -1) { >+ if (vfs_stat_smb_basename(handle->conn, path, &sbuf) == -1) { > TALLOC_FREE(frame); > return -1; > } >-- >2.2.0.rc0.207.ga3a616c > > >From aa04f3fab46250e1b1671c491ae2cfd2e21036b1 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Fri, 1 May 2015 21:06:20 -0700 >Subject: [PATCH 3/4] s3: smbd: VFS: For all EA and ACL calls use > synthetic_smb_fname(), not synthetic_smb_fname_split(). > >EA's and ACL paths are all post-stream name checks (and shouldn't >get stream names). This one took a *long* time to find. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=11249 > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Andreas Schneider <asn@samba.org> >Reviewed-by: Ralph Boehme <slow@samba.org> >(cherry picked from commit ccb4f791fd19d9b3af79a205a15c0219ed7240ea) >--- > source3/modules/non_posix_acls.c | 2 +- > source3/modules/vfs_fake_acls.c | 2 +- > source3/modules/vfs_xattr_tdb.c | 2 +- > source3/smbd/posix_acls.c | 2 +- > 4 files changed, 4 insertions(+), 4 deletions(-) > >diff --git a/source3/modules/non_posix_acls.c b/source3/modules/non_posix_acls.c >index b1c2420..fca9979 100644 >--- a/source3/modules/non_posix_acls.c >+++ b/source3/modules/non_posix_acls.c >@@ -32,7 +32,7 @@ int non_posix_sys_acl_blob_get_file_helper(vfs_handle_struct *handle, > struct xattr_sys_acl_hash_wrapper acl_wrapper = {}; > struct smb_filename *smb_fname; > >- smb_fname = synthetic_smb_fname_split(frame, path_p, NULL); >+ smb_fname = synthetic_smb_fname(frame, path_p, NULL, NULL); > if (smb_fname == NULL) { > TALLOC_FREE(frame); > errno = ENOMEM; >diff --git a/source3/modules/vfs_fake_acls.c b/source3/modules/vfs_fake_acls.c >index 0e7ebb9..f3c2ebb 100644 >--- a/source3/modules/vfs_fake_acls.c >+++ b/source3/modules/vfs_fake_acls.c >@@ -348,7 +348,7 @@ static int fake_acls_sys_acl_delete_def_file(vfs_handle_struct *handle, const ch > TALLOC_CTX *frame = talloc_stackframe(); > struct smb_filename *smb_fname; > >- smb_fname = synthetic_smb_fname_split(frame, path, NULL); >+ smb_fname = synthetic_smb_fname(frame, path, NULL, NULL); > if (smb_fname == NULL) { > TALLOC_FREE(frame); > errno = ENOMEM; >diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c >index 590ffaa..d72b50c 100644 >--- a/source3/modules/vfs_xattr_tdb.c >+++ b/source3/modules/vfs_xattr_tdb.c >@@ -37,7 +37,7 @@ static int xattr_tdb_get_file_id(struct vfs_handle_struct *handle, > TALLOC_CTX *frame = talloc_stackframe(); > struct smb_filename *smb_fname; > >- smb_fname = synthetic_smb_fname_split(frame, path, NULL); >+ smb_fname = synthetic_smb_fname(frame, path, NULL, NULL); > if (smb_fname == NULL) { > TALLOC_FREE(frame); > errno = ENOMEM; >diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c >index d187787..b926584 100644 >--- a/source3/smbd/posix_acls.c >+++ b/source3/smbd/posix_acls.c >@@ -4747,7 +4747,7 @@ int posix_sys_acl_blob_get_file(vfs_handle_struct *handle, > }; > struct smb_filename *smb_fname; > >- smb_fname = synthetic_smb_fname_split(frame, path_p, NULL); >+ smb_fname = synthetic_smb_fname(frame, path_p, NULL, NULL); > if (smb_fname == NULL) { > TALLOC_FREE(frame); > errno = ENOMEM; >-- >2.2.0.rc0.207.ga3a616c > > >From be185dc5eefaec7abd841093874e939a76f7edd6 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Mon, 4 May 2015 19:56:39 -0700 >Subject: [PATCH 4/4] s3: smbd: VFS: fake_acl module called > get_full_smb_filename() with a stream path, then used the result to call > XATTR functions directly. > >Ensure when pulling XATTR values, we don't allow a stream filename. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=11249 > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Ralph Boehme <slow@samba.org> >(cherry picked from commit 0f23bf228ceb38b024a77fcf2916971ad4f6aa4d) >--- > source3/modules/vfs_fake_acls.c | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > >diff --git a/source3/modules/vfs_fake_acls.c b/source3/modules/vfs_fake_acls.c >index f3c2ebb..3887e86 100644 >--- a/source3/modules/vfs_fake_acls.c >+++ b/source3/modules/vfs_fake_acls.c >@@ -115,8 +115,16 @@ static int fake_acls_stat(vfs_handle_struct *handle, > if (ret == 0) { > TALLOC_CTX *frame = talloc_stackframe(); > char *path; >+ struct smb_filename smb_fname_base = { >+ .base_name = smb_fname->base_name >+ }; > NTSTATUS status; >- status = get_full_smb_filename(frame, smb_fname, &path); >+ /* >+ * As we're calling getxattr directly here >+ * we need to use only the base_name, not >+ * the full name containing any stream name. >+ */ >+ status = get_full_smb_filename(frame, &smb_fname_base, &path); > if (!NT_STATUS_IS_OK(status)) { > errno = map_errno_from_nt_status(status); > TALLOC_FREE(frame); >@@ -148,8 +156,16 @@ static int fake_acls_lstat(vfs_handle_struct *handle, > if (ret == 0) { > TALLOC_CTX *frame = talloc_stackframe(); > char *path; >+ struct smb_filename smb_fname_base = { >+ .base_name = smb_fname->base_name >+ }; > NTSTATUS status; >- status = get_full_smb_filename(frame, smb_fname, &path); >+ /* >+ * As we're calling getxattr directly here >+ * we need to use only the base_name, not >+ * the full name containing any stream name. >+ */ >+ status = get_full_smb_filename(frame, &smb_fname_base, &path); > if (!NT_STATUS_IS_OK(status)) { > errno = map_errno_from_nt_status(status); > TALLOC_FREE(frame); >-- >2.2.0.rc0.207.ga3a616c >
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 11249
:
11010
|
11011
|
11018
|
11019
|
11021
| 11022