The Samba-Bugzilla – Attachment 15099 Details for
Bug 13872
gluster vfs modules break the build on some platforms
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch from master for v4.9 and v4.10
v4-9-test.patch (text/plain), 4.44 KB, created by
Guenther Deschner
on 2019-04-26 15:08:48 UTC
(
hide
)
Description:
patch from master for v4.9 and v4.10
Filename:
MIME Type:
Creator:
Guenther Deschner
Created:
2019-04-26 15:08:48 UTC
Size:
4.44 KB
patch
obsolete
>From 30984c020fe4235aa32d69ba9408ce45c53b5f56 Mon Sep 17 00:00:00 2001 >From: Anoop C S <anoopcs@redhat.com> >Date: Thu, 25 Apr 2019 16:42:01 +0530 >Subject: [PATCH 1/2] s3/vfs_glusterfs_fuse: Dynamically determine NAME_MAX > >This allows the vfs_glusterfs_fuse build to complete on AIX. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13872 > >Signed-off-by: Anoop C S <anoopcs@redhat.com> >Reviewed-by: Guenther Deschner <gd@samba.org> >Reviewed-by: Ralph Boehme <slow@samba.org> >(cherry picked from commit e28d172b00cadf492c22bd892e2dda3bf2fe2d70) >--- > source3/modules/vfs_glusterfs_fuse.c | 32 ++++++++++++++++++++++------ > 1 file changed, 26 insertions(+), 6 deletions(-) > >diff --git a/source3/modules/vfs_glusterfs_fuse.c b/source3/modules/vfs_glusterfs_fuse.c >index 8855cd18d01..0b1de9fcdb2 100644 >--- a/source3/modules/vfs_glusterfs_fuse.c >+++ b/source3/modules/vfs_glusterfs_fuse.c >@@ -28,19 +28,35 @@ static int vfs_gluster_fuse_get_real_filename(struct vfs_handle_struct *handle, > char **_found_name) > { > int ret; >- char key_buf[NAME_MAX + 64]; >- char val_buf[NAME_MAX + 1]; >+ char *key_buf = NULL, *val_buf = NULL; >+ long name_max; > char *found_name = NULL; > >- if (strlen(name) >= NAME_MAX) { >+ name_max = pathconf(path, _PC_NAME_MAX); >+ if ((name_max + 1) < 1) { >+ errno = EINVAL; >+ return -1; >+ } >+ >+ if (strlen(name) >= name_max) { > errno = ENAMETOOLONG; > return -1; > } > >- snprintf(key_buf, NAME_MAX + 64, >- "glusterfs.get_real_filename:%s", name); >+ key_buf = talloc_asprintf(mem_ctx, "glusterfs.get_real_filename:%s", >+ name); >+ if (key_buf == NULL) { >+ errno = ENOMEM; >+ return -1; >+ } >+ >+ val_buf = talloc_zero_array(mem_ctx, char, name_max + 1); >+ if (val_buf == NULL) { >+ errno = ENOMEM; >+ return -1; >+ } > >- ret = getxattr(path, key_buf, val_buf, NAME_MAX + 1); >+ ret = getxattr(path, key_buf, val_buf, name_max + 1); > if (ret == -1) { > if (errno == ENOATTR) { > errno = EOPNOTSUPP; >@@ -54,6 +70,10 @@ static int vfs_gluster_fuse_get_real_filename(struct vfs_handle_struct *handle, > return -1; > } > *_found_name = found_name; >+ >+ TALLOC_FREE(key_buf); >+ TALLOC_FREE(val_buf); >+ > return 0; > } > >-- >2.20.1 > > >From 8587fec0db2648382f8126c0ea5a483bbd9e42b7 Mon Sep 17 00:00:00 2001 >From: Anoop C S <anoopcs@redhat.com> >Date: Thu, 25 Apr 2019 16:41:53 +0530 >Subject: [PATCH 2/2] s3/vfs_glusterfs: Dynamically determine NAME_MAX > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13872 > >Signed-off-by: Anoop C S <anoopcs@redhat.com> >Reviewed-by: Guenther Deschner <gd@samba.org> >Reviewed-by: Ralph Boehme <slow@samba.org> >(cherry picked from commit 8e3a042eb9e502821b147f1bbb2d98d59f17a095) >--- > source3/modules/vfs_glusterfs.c | 37 ++++++++++++++++++++++++++------- > 1 file changed, 29 insertions(+), 8 deletions(-) > >diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c >index fc2ea2addeb..e8c88a0abe0 100644 >--- a/source3/modules/vfs_glusterfs.c >+++ b/source3/modules/vfs_glusterfs.c >@@ -1450,20 +1450,36 @@ static int vfs_gluster_chflags(struct vfs_handle_struct *handle, > > static int vfs_gluster_get_real_filename(struct vfs_handle_struct *handle, > const char *path, const char *name, >- TALLOC_CTX *mem_ctx, char **found_name) >+ TALLOC_CTX *mem_ctx, char **_found_name) > { > int ret; >- char key_buf[NAME_MAX + 64]; >- char val_buf[NAME_MAX + 1]; >+ char *key_buf = NULL, *val_buf = NULL; >+ long name_max; >+ char *found_name = NULL; > >- if (strlen(name) >= NAME_MAX) { >+ name_max = pathconf(path, _PC_NAME_MAX); >+ if ((name_max + 1) < 1) { >+ errno = EINVAL; >+ return -1; >+ } >+ >+ if (strlen(name) >= name_max) { > errno = ENAMETOOLONG; > return -1; > } > >- snprintf(key_buf, NAME_MAX + 64, >- "glusterfs.get_real_filename:%s", name); >+ key_buf = talloc_asprintf(mem_ctx, "glusterfs.get_real_filename:%s", >+ name); >+ if (key_buf == NULL) { >+ errno = ENOMEM; >+ return -1; >+ } > >+ val_buf = talloc_zero_array(mem_ctx, char, name_max + 1); >+ if (val_buf == NULL) { >+ errno = ENOMEM; >+ return -1; >+ } > ret = glfs_getxattr(handle->data, path, key_buf, val_buf, NAME_MAX + 1); > if (ret == -1) { > if (errno == ENOATTR) { >@@ -1472,11 +1488,16 @@ static int vfs_gluster_get_real_filename(struct vfs_handle_struct *handle, > return -1; > } > >- *found_name = talloc_strdup(mem_ctx, val_buf); >- if (found_name[0] == NULL) { >+ found_name = talloc_strdup(mem_ctx, val_buf); >+ if (found_name == NULL) { > errno = ENOMEM; > return -1; > } >+ *_found_name = found_name; >+ >+ TALLOC_FREE(key_buf); >+ TALLOC_FREE(val_buf); >+ > return 0; > } > >-- >2.20.1 >
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 13872
:
15074
| 15099 |
15250