From 2ca117dce31909411431e3e23650f19dabf4cb64 Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Fri, 4 Nov 2016 19:22:44 +0530 Subject: [PATCH] Fix glfs_realpath allocation in vfs_glusterfs Signed-off-by: Anoop C S --- samba-4.3.12-vfs_gluster_realpath.patch | 49 +++++++++++++++++++++++++ samba.spec | 7 +++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 samba-4.3.12-vfs_gluster_realpath.patch diff --git a/samba-4.3.12-vfs_gluster_realpath.patch b/samba-4.3.12-vfs_gluster_realpath.patch new file mode 100644 index 0000000..7044731 --- /dev/null +++ b/samba-4.3.12-vfs_gluster_realpath.patch @@ -0,0 +1,49 @@ +From 730c0a2fab4b0c494122f29355068cc2bbf0f672 Mon Sep 17 00:00:00 2001 +From: Michael Adam +Date: Fri, 21 Oct 2016 00:15:06 +0200 +Subject: [PATCH] vfs:glusterfs: preallocate result for glfs_realpath + +https://bugzilla.samba.org/show_bug.cgi?id=12404 + +This makes us independent of the allocation +method used inside glfs_realpath. + +Signed-off-by: Michael Adam +Reviewed-by: Ira Cooper + +Autobuild-User(master): Jeremy Allison +Autobuild-Date(master): Sat Oct 22 00:28:41 CEST 2016 on sn-devel-144 + +(cherry picked from commit 92a0a56c3852726e0812d260e043957c879aefa4) +--- + source3/modules/vfs_glusterfs.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c +index 732ca51..fc40a90 100644 +--- a/source3/modules/vfs_glusterfs.c ++++ b/source3/modules/vfs_glusterfs.c +@@ -1036,7 +1036,20 @@ static int vfs_gluster_fallocate(struct vfs_handle_struct *handle, + static char *vfs_gluster_realpath(struct vfs_handle_struct *handle, + const char *path) + { +- return glfs_realpath(handle->data, path, 0); ++ char *result = NULL; ++ char *resolved_path = SMB_MALLOC_ARRAY(char, PATH_MAX+1); ++ ++ if (resolved_path == NULL) { ++ errno = ENOMEM; ++ return NULL; ++ } ++ ++ result = glfs_realpath(handle->data, path, resolved_path); ++ if (result == NULL) { ++ SAFE_FREE(resolved_path); ++ } ++ ++ return result; + } + + static bool vfs_gluster_lock(struct vfs_handle_struct *handle, +-- +2.7.4 diff --git a/samba.spec b/samba.spec index 0585d9d..373ca00 100644 --- a/samba.spec +++ b/samba.spec @@ -6,7 +6,7 @@ # ctdb is enabled by default, you can disable it with: --without clustering %bcond_without clustering -%define main_release 0 +%define main_release 1 %define samba_version 4.3.12 %define talloc_version 2.1.3 @@ -108,6 +108,7 @@ Source200: README.dc Source201: README.downgrade Patch0: samba-4.2.10-s3-winbind-make-sure-domain-member-can-talk-to-trust.patch +Patch1: samba-4.3.12-vfs_gluster_realpath.patch BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) @@ -688,6 +689,7 @@ and use CTDB instead. %setup -q -n samba-%{version}%{pre_release} %patch0 -p 1 -b .samba-4.2.10-s3-winbind-make-sure-domain-member-can-talk-to-trust.patch +%patch1 -p 1 -b .samba-4.3.12-vfs_gluster_realpath.patch %build %global _talloc_lib ,talloc,pytalloc,pytalloc-util @@ -2035,6 +2037,9 @@ rm -rf %{buildroot} %endif # with_clustering_support %changelog +* Fri Nov 04 2016 Anoop C S - 4.3.12-1 +- Fix glfs_realpath allocation in vfs_glusterfs + * Thu Nov 03 2016 Guenther Deschner - 4.3.12-0 - Update to Samba 4.3.12