Extended access control list support
default n
-config SAMBA4_SERVER_AD_DC
- bool "Active Directory Domain Controller support (requires krb5-server) (EXPERIMENTAL)"
- depends on PACKAGE_samba4-server
- select PACKAGE_python-crypto
- help
- installs: samba (meta-daemon) python-crypto ntlm_auth
- scripts: samba-tool
-
- Run as a Active Directory Domain Controller
- see: https://wiki.samba.org/index.php/Setting_up_Samba_as_an_Active_Directory_Domain_Controller
- HINT: see section (# Using the Domain Controller as a File Server)
- NOTE: Extroot is recommend for this setup, as it is not optimized to run completely from RAM/tempfs!
- default n
-
config SAMBA4_SERVER_AVAHI
bool "Avahi support"
depends on PACKAGE_samba4-server
include $(TOPDIR)/rules.mk
PKG_NAME:=samba
-PKG_VERSION:=4.9.8
+PKG_VERSION:=4.10.6
PKG_RELEASE:=1
PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
http://samba.mirror.bit.nl/samba/ftp/stable/ \
https://download.samba.org/pub/samba/stable/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_HASH:=82ebb7c3f1847c39341dd97ff8b73f40fa83f5f794daeceb80f3c349ace3cf56
+PKG_HASH:=9efbeb52db1203dc779b118f1c48c161e569f7a6af5101e745497ee6296eef42
# samba4=(asn1_compile) e2fsprogs=(compile_et) nfs-kernel-server=(rpcgen)
-HOST_BUILD_DEPENDS:=nfs-kernel-server/host e2fsprogs/host
+HOST_BUILD_DEPENDS:=python3/host nfs-kernel-server/host e2fsprogs/host
PKG_BUILD_DEPENDS:=samba4/host
PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_kmod-fs-xfs
include $(INCLUDE_DIR)/package.mk
+include $(TOPDIR)/feeds/packages/lang/python/python3-package.mk
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/version.mk
define Package/samba4-libs
$(call Package/samba4/Default)
TITLE+= libs
- DEPENDS:= +zlib +libtirpc +libpopt +libcomerr \
+ DEPENDS:= +zlib +libtirpc +libpopt +libcomerr +libtasn1 +libopenssl \
+PACKAGE_libcap:libcap +PACKAGE_libpthread:libpthread +PACKAGE_libnettle:libnettle \
+PACKAGE_libgcrypt:libgcrypt +PACKAGE_libpam:libpam +PACKAGE_dbus:dbus +PACKAGE_libavahi-client:libavahi-client \
+SAMBA4_SERVER_VFS:attr \
+SAMBA4_SERVER_ACL:acl +SAMBA4_SERVER_ACL:attr \
+SAMBA4_SERVER_AVAHI:libavahi-client \
- +SAMBA4_SERVER_AD_DC:python-base +SAMBA4_SERVER_AD_DC:libopenssl +SAMBA4_SERVER_AD_DC:libgnutls +SAMBA4_SERVER_AD_DC:libopenldap +SAMBA4_SERVER_AD_DC:jansson +SAMBA4_SERVER_AD_DC:libarchive
+ +SAMBA4_SERVER_AD_DC:python3-base +SAMBA4_SERVER_AD_DC:python3-crypto +SAMBA4_SERVER_AD_DC:libgnutls +SAMBA4_SERVER_AD_DC:libopenldap +SAMBA4_SERVER_AD_DC:jansson +SAMBA4_SERVER_AD_DC:libarchive
endef
define Package/samba4-server
$(call Package/samba4/Default)
TITLE+= server
DEPENDS:= +samba4-libs
- EXTRA_DEPENDS:=$(if $(CONFIG_SAMBA4_SERVER_AD_DC),python-crypto,)
endef
define Package/samba4-server/description
--without-gpgme
HOST_CONFIGURE_ARGS += --disable-avahi --without-quotas --without-acl-support --without-winbind \
- --without-ad-dc --without-json-audit --without-libarchive --disable-python --nopyc --nopyo \
+ --without-ad-dc --without-json --without-libarchive --disable-python --nopyc --nopyo \
--disable-gnutls --without-dnsupdate --without-ads --without-ldap
HOST_CONFIGURE_VARS += python_LDFLAGS="" python_LIBDIR=""
else
CONFIGURE_ARGS += --without-acl-support
endif
+#BUG: We fail to get a wortking "python embedded interpreter" for AD_DC mode, seems mixed host/target libs.
ifeq ($(CONFIG_SAMBA4_SERVER_AD_DC),y)
CONFIGURE_ARGS += --enable-gnutls --with-dnsupdate --with-ads --with-ldap
- TARGET_CFLAGS := -I$(STAGING_DIR)/usr/include/python2.7 $(TARGET_CFLAGS)
+ TARGET_CFLAGS := -I$(PYTHON3_INC_DIR) $(TARGET_CFLAGS)
else
- CONFIGURE_ARGS += --without-ad-dc --without-json-audit --without-libarchive --disable-python --nopyc --nopyo \
+ CONFIGURE_ARGS += --without-ad-dc --without-json --without-libarchive --disable-python --nopyc --nopyo --nopycache \
--disable-gnutls --without-dnsupdate --without-ads --without-ldap
CONFIGURE_VARS += \
python_LDFLAGS="" \
CONFIGURE_ARGS += --private-libraries=talloc,tevent,tevent-util,texpect,tdb,ldb,tdr,cmocka,replace
# CONFIGURE_ARGS += --disable-symbol-versions
+define Host/Configure
+ if [ $(CONFIG_SAMBA4_SERVER_AD_DC) = "y" ]; then \
+ echo "Config error: SAMBA4_SERVER_AD_DC config option is broken atm!"; \
+ echo "Last AD_DC version that builds is here: https://github.com/Andy2244/openwrt-extra/tree/samba-4.9 "; \
+ exit 1; \
+ fi
+ $(call Host/Configure/Default)
+endef
+
define Host/Compile
(cd $(HOST_BUILD_DIR); \
./buildtools/bin/waf build \
endef
# BUG: We need to use "waf install --targets=" otherwise a "make install" or "waf install" will retrigger a full recompile of all possible targets!
+# BUG: Samba4-10 "waf install --destdir" is not working, bins are not installed!
define Build/Compile
(cd $(PKG_BUILD_DIR); \
./buildtools/bin/waf install \
define Package/samba4-libs/install
$(INSTALL_DIR) $(1)/usr/lib
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/samba/*.so* $(1)/usr/lib/
+ $(CP) -L $(PKG_BUILD_DIR)/bin/shared/*.so* $(1)/usr/lib/
+ $(CP) -L $(PKG_BUILD_DIR)/bin/shared/private/*.so* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/samba/vfs $(1)/usr/lib/samba/idmap $(1)/usr/lib/samba/ldb $(1)/usr/lib/samba/krb5
- if [ -d $(PKG_INSTALL_DIR)/usr/lib/samba/idmap ]; then \
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/samba/idmap $(1)/usr/lib/samba/; \
+ if [ -d $(PKG_BUILD_DIR)/bin/modules/idmap ]; then \
+ $(CP) -L $(PKG_BUILD_DIR)/bin/modules/idmap $(1)/usr/lib/samba/; \
fi
- if [ -d $(PKG_INSTALL_DIR)/usr/lib/samba/vfs ]; then \
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/samba/vfs $(1)/usr/lib/samba/; \
+ if [ -d $(PKG_BUILD_DIR)/bin/modules/vfs ]; then \
+ $(CP) -L $(PKG_BUILD_DIR)/bin/modules/vfs $(1)/usr/lib/samba/; \
fi
- if [ -d $(PKG_INSTALL_DIR)/usr/lib/samba/krb5 ]; then \
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/samba/krb5 $(1)/usr/lib/samba/; \
+ if [ -d $(PKG_BUILD_DIR)/bin/modules/krb5 ]; then \
+ $(CP) -L $(PKG_BUILD_DIR)/bin/modules/krb5 $(1)/usr/lib/samba/; \
fi
ifeq ($(CONFIG_SAMBA4_SERVER_AD_DC),y)
- $(INSTALL_DIR) $(1)/usr/lib/python2.7
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7 $(1)/usr/lib/
+ $(INSTALL_DIR) $(1)/usr/lib/python3
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/python3 $(1)/usr/lib/
endif
endef
define Package/samba4-client/install
$(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{smbclient,cifsdd} $(1)/usr/bin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/{smbclient,cifsdd} $(1)/usr/bin/
endef
define Package/samba4-admin/install
$(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{net,smbcontrol,profiles,rpcclient,smbcacls,smbcquotas} $(1)/usr/bin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/{net,smbcontrol,profiles,rpcclient,smbcacls,smbcquotas} $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/sbin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/eventlogadm $(1)/usr/sbin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/eventlogadm $(1)/usr/sbin/
endef
define Package/samba4-utils/install
$(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{smbstatus,smbtree,smbget,mvxattr,nmblookup} $(1)/usr/bin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/{smbstatus,smbtree,smbget,mvxattr,nmblookup} $(1)/usr/bin/
endef
define Package/samba4-server/install
$(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{smbpasswd,pdbedit,testparm} $(1)/usr/bin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/{smbpasswd,pdbedit,testparm} $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/sbin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/smbd $(1)/usr/sbin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/smbd $(1)/usr/sbin/
ifeq ($(CONFIG_SAMBA4_SERVER_AD_DC),y)
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{samba-tool,ntlm_auth,smbtar} $(1)/usr/bin/
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{samba,samba-gpupdate,samba_dnsupdate,samba_kcc,samba_spnupdate,samba_upgradedns} $(1)/usr/sbin/
- # waf does not install those?
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/{samba-tool,ntlm_auth,smbtar} $(1)/usr/bin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/{samba,samba-gpupdate,samba_dnsupdate,samba_kcc,samba_spnupdate,samba_upgradedns} $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/{samba4kinit,samba4kgetcred,samba4kpasswd,samba4ktutil} $(1)/usr/bin/
endif
ifeq ($(CONFIG_SAMBA4_SERVER_NETBIOS),y)
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nmbd $(1)/usr/sbin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/nmbd $(1)/usr/sbin/
endif
ifeq ($(CONFIG_SAMBA4_SERVER_WINBIND),y)
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wbinfo $(1)/usr/bin/
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/winbindd $(1)/usr/sbin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/wbinfo $(1)/usr/bin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/winbindd $(1)/usr/sbin/
endif
ifeq ($(CONFIG_SAMBA4_SERVER_ACL),y)
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sharesec $(1)/usr/bin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/sharesec $(1)/usr/bin/
endif
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/samba $(1)/etc/init.d
- $(INSTALL_DATA) ./files/samba.config $(1)/etc/config/samba4
+ $(INSTALL_CONF) ./files/samba.config $(1)/etc/config/samba4
$(INSTALL_DATA) ./files/smb.conf.template $(1)/etc/samba
$(INSTALL_BIN) ./files/samba.init $(1)/etc/init.d/samba4
endef
[ -e /etc/samba/smb.conf ] || ln -nsf /var/etc/smb.conf /etc/samba/smb.conf
- if [ -f /etc/samba/smb.conf ]; then
+ if ! [ -L /etc/samba/smb.conf ]; then
logger -t 'samba4-server' "Local custom /etc/samba/smb.conf file detected, all luci/config settings are ignored!"
fi
local dir_mask
local browseable
local read_only
+ local writeable
local guest_ok
local guest_only
local inherit_owner
config_get dir_mask $1 dir_mask
config_get browseable $1 browseable
config_get read_only $1 read_only
+ config_get writeable $1 writeable
config_get guest_ok $1 guest_ok
config_get guest_only $1 guest_only
config_get inherit_owner $1 inherit_owner
[ -n "$browseable" ] && echo -e "\tbrowseable = $browseable" >> /var/etc/smb.conf
[ -n "$read_only" ] && echo -e "\tread only = $read_only" >> /var/etc/smb.conf
+ [ -n "$writeable" ] && echo -e "\twriteable = $writeable" >> /var/etc/smb.conf
[ -n "$guest_ok" ] && echo -e "\tguest ok = $guest_ok" >> /var/etc/smb.conf
[ -n "$guest_only" ] && echo -e "\tguest only = $guest_only" >> /var/etc/smb.conf
[ -n "$inherit_owner" ] && echo -e "\tinherit owner = $inherit_owner" >> /var/etc/smb.conf
--- /dev/null
+From a197e0cafb276a9b732f914b1f679ebb487b47f1 Mon Sep 17 00:00:00 2001
+From: pinglin <pinglin@synology.com>
+Date: Tue, 19 Mar 2019 20:46:27 +0800
+Subject: [PATCH] cross_compile argument doesn't apply
+
+reproduce:
+ ./configure --cross-compile --cross-answers=XXX
+
+The output log now will show correct cross-answers.
+---
+ third_party/waf/waflib/Context.py | 20 ++++++++++++++++++--
+ third_party/waf/waflib/Tools/c_config.py | 11 +++++++----
+ 2 files changed, 25 insertions(+), 6 deletions(-)
+
+diff --git a/third_party/waf/waflib/Context.py b/third_party/waf/waflib/Context.py
+index 3222fb1551c..d1c87512095 100644
+--- a/third_party/waf/waflib/Context.py
++++ b/third_party/waf/waflib/Context.py
+@@ -359,8 +359,16 @@ class Context(ctx):
+
+ encoding = kw.pop('decode_as', default_encoding)
+
++ exec_args = kw.pop('exec_args', [])
++ if isinstance(cmd, str):
++ cmd = [cmd] + exec_args
++ elif isinstance(cmd, list):
++ cmd = cmd + exec_args
+ try:
+- ret, out, err = Utils.run_process(cmd, kw, cargs)
++ if exec_args:
++ ret, out, err = Utils.run_regular_process(cmd, kw, cargs)
++ else:
++ ret, out, err = Utils.run_process(cmd, kw, cargs)
+ except Exception as e:
+ raise Errors.WafError('Execution failure: %s' % str(e), ex=e)
+
+@@ -438,8 +446,16 @@ class Context(ctx):
+
+ encoding = kw.pop('decode_as', default_encoding)
+
++ exec_args = kw.pop('exec_args', [])
++ if isinstance(cmd, str):
++ cmd = [cmd] + exec_args
++ elif isinstance(cmd, list):
++ cmd = cmd + exec_args
+ try:
+- ret, out, err = Utils.run_process(cmd, kw, cargs)
++ if exec_args:
++ ret, out, err = Utils.run_regular_process(cmd, kw, cargs)
++ else:
++ ret, out, err = Utils.run_process(cmd, kw, cargs)
+ except Exception as e:
+ raise Errors.WafError('Execution failure: %s' % str(e), ex=e)
+
+diff --git a/third_party/waf/waflib/Tools/c_config.py b/third_party/waf/waflib/Tools/c_config.py
+index 76082152cd9..25e468b0844 100644
+--- a/third_party/waf/waflib/Tools/c_config.py
++++ b/third_party/waf/waflib/Tools/c_config.py
+@@ -660,20 +660,23 @@ class test_exec(Task.Task):
+ """
+ color = 'PINK'
+ def run(self):
++ exec_args = Utils.to_list(self.generator.exec_args)
++
+ if getattr(self.generator, 'rpath', None):
+ if getattr(self.generator, 'define_ret', False):
+- self.generator.bld.retval = self.generator.bld.cmd_and_log([self.inputs[0].abspath()])
++ self.generator.bld.retval = self.generator.bld.cmd_and_log([self.inputs[0].abspath()], exec_args=exec_args)
+ else:
+- self.generator.bld.retval = self.generator.bld.exec_command([self.inputs[0].abspath()])
++ self.generator.bld.retval = self.generator.bld.exec_command([self.inputs[0].abspath()], exec_args=exec_args)
+ else:
+ env = self.env.env or {}
+ env.update(dict(os.environ))
+ for var in ('LD_LIBRARY_PATH', 'DYLD_LIBRARY_PATH', 'PATH'):
+ env[var] = self.inputs[0].parent.abspath() + os.path.pathsep + env.get(var, '')
++
+ if getattr(self.generator, 'define_ret', False):
+- self.generator.bld.retval = self.generator.bld.cmd_and_log([self.inputs[0].abspath()], env=env)
++ self.generator.bld.retval = self.generator.bld.cmd_and_log([self.inputs[0].abspath()], env=env, exec_args=exec_args)
+ else:
+- self.generator.bld.retval = self.generator.bld.exec_command([self.inputs[0].abspath()], env=env)
++ self.generator.bld.retval = self.generator.bld.exec_command([self.inputs[0].abspath()], env=env, exec_args=exec_args)
+
+ @feature('test_exec')
+ @after_method('apply_link')
+--
+2.17.1
+
--- /dev/null
+From f68bd76eab9a6e93b42f396a81aed64f65b99d1c Mon Sep 17 00:00:00 2001
+From: pinglin <pinglin@synology.com>
+Date: Mon, 25 Mar 2019 20:43:54 +0800
+Subject: [PATCH] fix rpath error, this commit related to the previous one
+
+---
+ buildtools/wafsamba/samba_waf18.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/buildtools/wafsamba/samba_waf18.py b/buildtools/wafsamba/samba_waf18.py
+index cc310fbf512..47acc5b3c06 100644
+--- a/buildtools/wafsamba/samba_waf18.py
++++ b/buildtools/wafsamba/samba_waf18.py
+@@ -220,7 +220,7 @@ def CHECK_LIBRARY_SUPPORT(conf, rpath=False, version_script=False, msg=None):
+ args = conf.SAMBA_CROSS_ARGS(msg=msg)
+ env = dict(os.environ)
+ env['LD_LIBRARY_PATH'] = self.inputs[0].parent.abspath() + os.pathsep + env.get('LD_LIBRARY_PATH', '')
+- self.generator.bld.cmd_and_log([self.inputs[0].abspath()] + args, env=env)
++ self.generator.bld.cmd_and_log([self.inputs[0].abspath()] + args, env=env, exec_args=args)
+ o.post()
+ bld(rule=run_app, source=o.link_task.outputs[0])
+
+--
+2.17.1
+
--- /dev/null
+From 41eeabcb0175659aebf6d480c43fb64310f37d9c Mon Sep 17 00:00:00 2001
+From: Andrew Bartlett <abartlet@samba.org>
+Date: Wed, 20 Mar 2019 13:57:50 +1300
+Subject: [PATCH] build: Allow build when --disable-gnutls is set
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=13844
+
+Signed-off-by: Andrew Bartlett <abartlet@samba.org>
+---
+ lib/mscat/wscript | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/lib/mscat/wscript b/lib/mscat/wscript
+index 7ca9ef567ee..4d1f752a3c1 100644
+--- a/lib/mscat/wscript
++++ b/lib/mscat/wscript
+@@ -12,7 +12,11 @@ def configure(conf):
+ if not conf.find_program('asn1Parser', var='ASN1PARSER'):
+ Logs.warn('WARNING: ans1Parser hasn\'t been found! Please install it (e.g. libtasn1-bin)')
+
+- conf.CHECK_FUNCS_IN('gnutls_pkcs7_get_embedded_data_oid', 'gnutls')
++ # GnuTLS is currently able to be disabled
++ if conf.env.enable_gnutls:
++ conf.CHECK_FUNCS_IN('gnutls_pkcs7_get_embedded_data_oid', 'gnutls')
++ else:
++ Logs.warn('WARNING: gnutls disabled so dumpmscat will not be built')
+
+ def build(bld):
+ if (bld.CONFIG_SET('HAVE_LIBTASN1') and
+--
+2.11.0
+
--- /dev/null
+--- a/lib/replace/replace.h
++++ b/lib/replace/replace.h
+@@ -162,10 +162,6 @@
+ #include <bsd/unistd.h>
+ #endif
+
+-#ifdef HAVE_UNISTD_H
+-#include <unistd.h>
+-#endif
+-
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #endif
}
- priv_path = private_path("msg.sock");
-+ priv_path = lock_path("msg.sock");
++ priv_path = lock_path(talloc_tos(), "msg.sock");
if (priv_path == NULL) {
return NT_STATUS_NO_MEMORY;
}
msg_ctx->msg_dgm_ref = messaging_dgm_ref(
msg_ctx, msg_ctx->event_ctx, &msg_ctx->id.unique_id,
- private_path("msg.sock"), lck_path,
-+ lock_path("msg.sock"), lck_path,
++ lock_path(talloc_tos(), "msg.sock"), lck_path,
messaging_recv_cb, msg_ctx, &ret);
if (msg_ctx->msg_dgm_ref == NULL) {
@@ -2,6 +2,7 @@
import sys
- import Build, Options, Logs
+ from waflib import Build, Options, Logs
+import imp, os
- from Configure import conf
- from samba_utils import TO_LIST
+ from waflib.Configure import conf
+ from wafsamba import samba_utils
@@ -249,17 +250,32 @@ def CHECK_BUNDLED_SYSTEM_PYTHON(conf, li
# versions
+++ /dev/null
-diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
-index 14d7a797451..1982f128cb3 100644
---- a/source3/modules/vfs_fruit.c
-+++ b/source3/modules/vfs_fruit.c
-@@ -119,6 +119,18 @@ static struct global_fruit_config {
- #define AFPRESOURCE_EA_NETATALK "user." NETATALK_RSRC_XATTR
- #endif
-
-+#ifndef OFF_T_MAX
-+#if SIZEOF_OFF_T == SIZEOF_INT8_T
-+#define OFF_T_MAX INT8_MAX
-+#elif SIZEOF_OFF_T == SIZEOF_INT16_T
-+#define OFF_T_MAX INT16_MAX
-+#elif SIZEOF_OFF_T == SIZEOF_INT32_T
-+#define OFF_T_MAX INT32_MAX
-+#elif SIZEOF_OFF_T == SIZEOF_INT64_T
-+#define OFF_T_MAX INT64_MAX
-+#endif
-+#endif
-+
- enum apple_fork {APPLE_FORK_DATA, APPLE_FORK_RSRC};
-
- enum fruit_rsrc {FRUIT_RSRC_STREAM, FRUIT_RSRC_ADFILE, FRUIT_RSRC_XATTR};
-@@ -6867,7 +6879,7 @@ static bool fruit_tmsize_do_dirent(vfs_handle_struct *handle,
- return true;
- }
-
-- if (bandsize > SIZE_MAX/nbands) {
-+ if (bandsize > OFF_T_MAX/nbands) {
- DBG_ERR("tmsize overflow: bandsize [%zu] nbands [%zu]\n",
- bandsize, nbands);
- return false;
--- /dev/null
+--- a/source3/modules/vfs_fruit.c 2019-07-09
++++ b/source3/modules/vfs_fruit.c 2019-07-09
+@@ -6995,12 +6995,12 @@ static bool fruit_tmsize_do_dirent(vfs_h
+ return true;
+ }
+
+- if (bandsize > SIZE_MAX/nbands) {
+- DBG_ERR("tmsize overflow: bandsize [%zu] nbands [%zu]\n",
+- bandsize, nbands);
+- return false;
+- }
+- tm_size = bandsize * nbands;
++ // if (bandsize > SIZE_MAX/nbands) {
++ // DBG_ERR("tmsize overflow: bandsize [%zu] nbands [%zu]\n",
++ // bandsize, nbands);
++ // return false;
++ // }
++ tm_size = (off_t)bandsize * (off_t)nbands;
+
+ if (state->total_size + tm_size < state->total_size) {
+ DBG_ERR("tmsize overflow: bandsize [%zu] nbands [%zu]\n",