The Samba-Bugzilla – Attachment 11010 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 patchset for master.
bug-11249-master (text/plain), 10.50 KB, created by
Jeremy Allison
on 2015-05-01 21:10:04 UTC
(
hide
)
Description:
git-am patchset for master.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2015-05-01 21:10:04 UTC
Size:
10.50 KB
patch
obsolete
>From c1425c5466073523b34c978e0bfa304cf35d67a9 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/3] s3: smbd: VFS: Add vfs_stat_smb_basename() - to be called > when we *know* stream name parsing has already been done. > >https://bugzilla.samba.org/show_bug.cgi?id=11249 > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/proto.h | 2 ++ > source3/smbd/vfs.c | 28 +++++++++++++++++++++++++++- > 2 files changed, 29 insertions(+), 1 deletion(-) > >diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h >index a5144d5..5a7d16d 100644 >--- a/source3/smbd/proto.h >+++ b/source3/smbd/proto.h >@@ -1179,6 +1179,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 ebd3440..e42599e 100644 >--- a/source3/smbd/vfs.c >+++ b/source3/smbd/vfs.c >@@ -1276,7 +1276,7 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname) > } > > /** >- * XXX: This is temporary and there should be no callers of this once >+ * Xxx: This is temporary and there should be no callers of this once > * smb_filename is plumbed through all path based operations. > */ > int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname, >@@ -1331,6 +1331,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 = 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 ea9d67ab3da5e3f531f92079b9dfefcd4f6ad37f 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/3] 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. > >https://bugzilla.samba.org/show_bug.cgi?id=11249 > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > 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 adc9b37..f7daa8d 100644 >--- a/source3/modules/nfs4_acls.c >+++ b/source3/modules/nfs4_acls.c >@@ -316,9 +316,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 920c811..625e7cb 100644 >--- a/source3/modules/vfs_acl_common.c >+++ b/source3/modules/vfs_acl_common.c >@@ -620,7 +620,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 8ee4bd5..e02993b 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 63a12fd..66c19f8 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 2bf5ab3ad36979a79f06c445cf8a070f8eacadb3 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Fri, 1 May 2015 13:13:00 -0700 >Subject: [PATCH 3/3] s3: smbd: VFS: Remove vfs_stat_smb_fname() and > vfs_lstat_smb_fname(). > >No longer used or needed. > >https://bugzilla.samba.org/show_bug.cgi?id=11249 > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/proto.h | 4 ---- > source3/smbd/vfs.c | 55 ---------------------------------------------------- > 2 files changed, 59 deletions(-) > >diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h >index 5a7d16d..09a7371 100644 >--- a/source3/smbd/proto.h >+++ b/source3/smbd/proto.h >@@ -1175,10 +1175,6 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname); > NTSTATUS check_reduced_name_with_privilege(connection_struct *conn, > const char *fname, > struct smb_request *smbreq); >-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); >diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c >index e42599e..b83dfcf 100644 >--- a/source3/smbd/vfs.c >+++ b/source3/smbd/vfs.c >@@ -1276,61 +1276,6 @@ NTSTATUS check_reduced_name(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. >- */ >-int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname, >- SMB_STRUCT_STAT *psbuf) >-{ >- struct smb_filename *smb_fname; >- int ret; >- >- smb_fname = synthetic_smb_fname_split(talloc_tos(), fname, NULL); >- if (smb_fname == NULL) { >- errno = ENOMEM; >- return -1; >- } >- >- 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; >- } >- >- TALLOC_FREE(smb_fname); >- return ret; >-} >- >-/** >- * XXX: This is temporary and there should be no callers of this once >- * smb_filename is plumbed through all path based operations. >- */ >-int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname, >- SMB_STRUCT_STAT *psbuf) >-{ >- struct smb_filename *smb_fname; >- int ret; >- >- smb_fname = synthetic_smb_fname_split(talloc_tos(), fname, NULL); >- if (smb_fname == NULL) { >- errno = ENOMEM; >- return -1; >- } >- >- ret = SMB_VFS_LSTAT(conn, smb_fname); >- if (ret != -1) { >- *psbuf = smb_fname->st; >- } >- >- TALLOC_FREE(smb_fname); >- return ret; >-} >- >-/** > * XXX: This is temporary and there should be no callers of this once > * smb_filename is plumbed through all path based operations. > * >-- >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
Actions:
View
Attachments on
bug 11249
:
11010
|
11011
|
11018
|
11019
|
11021
|
11022