samba4: revert to 4.9.11
authorAndy Walsh <andy.walsh44+github@gmail.com>
Wed, 10 Jul 2019 12:40:01 +0000 (14:40 +0200)
committerRosen Penev <rosenp@gmail.com>
Fri, 27 Sep 2019 02:36:25 +0000 (19:36 -0700)
* revert to 4.9.x series (4.10 needs too many unofficial patches and has weird waf bugs)
* cleanup patches
* enable AD_DC build option again

Signed-off-by: Andy Walsh <andy.walsh44+github@gmail.com>
(cherry-picked from 2f2a4bccd9fa1fdad7b001fad276ce485e76acbe)

net/samba4/Makefile
net/samba4/files/samba.init
net/samba4/patches/100-do-not-import-target-module-while-cross-compile.patch [deleted file]
net/samba4/patches/102-samba-4.8.2-unbundle-libreadline.patch [deleted file]
net/samba4/patches/102-samba-4.8.5-unbundle-libbsd.patch [new file with mode: 0644]
net/samba4/patches/103-samba-4.8.5-unbundle-libbsd.patch [deleted file]
net/samba4/patches/103-tmsize-overflow-fix.patch [new file with mode: 0644]
net/samba4/patches/104-tmsize-overflow-check.patch [deleted file]

index ff37ebd8ede9377989552cb5a3045609a58a8cfe..3fb6c29ca545f85ebe776e7e631a0d3ac821bc5c 100644 (file)
@@ -2,7 +2,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=samba
-PKG_VERSION:=4.9.8
+PKG_VERSION:=4.9.11
 PKG_RELEASE:=1
 
 PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
@@ -16,7 +16,7 @@ PKG_SOURCE_URL:=https://ftp.heanet.ie/mirrors/ftp.samba.org/stable/ \
                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:=bb736624d16f7369e395de2f15fec153b554f76f95864015b4ce1f2ae53e817b
 
 # samba4=(asn1_compile) e2fsprogs=(compile_et) nfs-kernel-server=(rpcgen)
 HOST_BUILD_DEPENDS:=nfs-kernel-server/host e2fsprogs/host
@@ -57,20 +57,19 @@ endef
 define Package/samba4-libs
   $(call Package/samba4/Default)
   TITLE+= libs
-  DEPENDS:= +zlib +libtirpc +libpopt +libcomerr \
+  DEPENDS:= +zlib +libtirpc +libpopt +libcomerr +libreadline \
        +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:python-base +SAMBA4_SERVER_AD_DC:python-crypto +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
 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
@@ -453,7 +452,7 @@ ifeq ($(CONFIG_SAMBA4_SERVER_ACL),y)
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/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
index b61f4bbe0712425ac86abbb6f1c1c15666496c8d..48a2d0dcaf60fdeb19ffe07a86e55a9809697fd0 100644 (file)
@@ -61,7 +61,7 @@ EOT
 
        [ -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
        
@@ -75,6 +75,7 @@ smb_add_share() {
        local dir_mask
        local browseable
        local read_only
+       local writeable
        local guest_ok
        local guest_only
        local inherit_owner
@@ -92,6 +93,7 @@ smb_add_share() {
        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
@@ -118,6 +120,7 @@ smb_add_share() {
 
        [ -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
diff --git a/net/samba4/patches/100-do-not-import-target-module-while-cross-compile.patch b/net/samba4/patches/100-do-not-import-target-module-while-cross-compile.patch
deleted file mode 100644 (file)
index e0766b6..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-Some modules such as dynamic library maybe cann't be imported while cross compile, 
-we just check whether does the module exist.
-
-Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
-
---- a/buildtools/wafsamba/samba_bundled.py
-+++ b/buildtools/wafsamba/samba_bundled.py
-@@ -2,6 +2,7 @@
- import sys
- import Build, Options, Logs
-+import imp, os
- from Configure import conf
- from samba_utils import TO_LIST
-@@ -249,17 +250,32 @@ def CHECK_BUNDLED_SYSTEM_PYTHON(conf, li
-     # versions
-     minversion = minimum_library_version(conf, libname, minversion)
--    try:
--        m = __import__(modulename)
--    except ImportError:
--        found = False
--    else:
-+    # Find module in PYTHONPATH
-+    stuff = imp.find_module(modulename, [os.environ["PYTHONPATH"]])
-+    if stuff:
-         try:
--            version = m.__version__
--        except AttributeError:
-+            m = imp.load_module(modulename, stuff[0], stuff[1], stuff[2])
-+        except ImportError:
-             found = False
-+
-+            if conf.env.CROSS_COMPILE:
-+                # Some modules such as dynamic library maybe cann't be imported
-+                # while cross compile, we just check whether the module exist
-+                Logs.warn('Cross module[%s] has been found, but can not be loaded.' % (stuff[1]))
-+                found = True
-         else:
--            found = tuplize_version(version) >= tuplize_version(minversion)
-+            try:
-+                version = m.__version__
-+            except AttributeError:
-+                found = False
-+            else:
-+                found = tuplize_version(version) >= tuplize_version(minversion)
-+        finally:
-+            if stuff[0]:
-+                stuff[0].close()
-+    else:
-+        found = False
-+
-     if not found and not conf.LIB_MAY_BE_BUNDLED(libname):
-         Logs.error('ERROR: Python module %s of version %s not found, and bundling disabled' % (libname, minversion))
-         sys.exit(1)
diff --git a/net/samba4/patches/102-samba-4.8.2-unbundle-libreadline.patch b/net/samba4/patches/102-samba-4.8.2-unbundle-libreadline.patch
deleted file mode 100644 (file)
index e164d56..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
---- a/libcli/smbreadline/wscript_configure
-+++ b/libcli/smbreadline/wscript_configure
-@@ -1,11 +1,13 @@
- #!/usr/bin/env python
--conf.CHECK_HEADERS('readline.h history.h readline/readline.h readline/history.h')
--for termlib in ['ncurses', 'curses', 'termcap', 'terminfo', 'termlib', 'tinfo']:
--    if conf.CHECK_FUNCS_IN('tgetent', termlib):
--        conf.env['READLINE_TERMLIB'] = termlib
--        break
-+#conf.CHECK_HEADERS('readline.h history.h readline/readline.h readline/history.h')
-+#for termlib in ['ncurses', 'curses', 'termcap', 'terminfo', 'termlib', 'tinfo']:
-+#    if conf.CHECK_FUNCS_IN('tgetent', termlib):
-+#        conf.env['READLINE_TERMLIB'] = termlib
-+#        break
-+
-+conf.undefine('HAVE_READLINE_READLINE_H')
- #
- # Check if we need to work around readline/readline.h
diff --git a/net/samba4/patches/102-samba-4.8.5-unbundle-libbsd.patch b/net/samba4/patches/102-samba-4.8.5-unbundle-libbsd.patch
new file mode 100644 (file)
index 0000000..c8eae59
--- /dev/null
@@ -0,0 +1,77 @@
+--- a/lib/crypto/wscript_configure
++++ b/lib/crypto/wscript_configure
+@@ -2,11 +2,11 @@
+ import Options
+ import Utils
+-if not conf.CHECK_FUNCS_IN('MD5Init', 'bsd', headers='bsd/md5.h',
+-    checklibc=True):
+-    conf.CHECK_FUNCS_IN('MD5Init', 'md5', headers='sys/md5.h',
+-                        checklibc=True)
+-    conf.CHECK_FUNCS_IN('MD5Init', 'md', headers='sys/md5.h',
++# if not conf.CHECK_FUNCS_IN('MD5Init', 'bsd', headers='bsd/md5.h',
++    # checklibc=True):
++conf.CHECK_FUNCS_IN('MD5Init', 'md5', headers='sys/md5.h',
++                                      checklibc=True)
++conf.CHECK_FUNCS_IN('MD5Init', 'md', headers='sys/md5.h',
+                         checklibc=True)
+ conf.CHECK_FUNCS_IN('CC_MD5_Init', '', headers='CommonCrypto/CommonDigest.h',
+     checklibc=True)
+--- a/lib/replace/wscript
++++ b/lib/replace/wscript
+@@ -340,22 +340,13 @@ def configure(conf):
+     conf.CHECK_FUNCS('prctl dirname basename')
+-    strlcpy_in_bsd = False
++    # Not checking for libbsd
++    conf.CHECK_FUNCS('strlcpy strlcat')
++    conf.CHECK_FUNCS('getpeereid')
++    conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h')
++    conf.CHECK_FUNCS('setproctitle_init')
+-    # libbsd on some platforms provides strlcpy and strlcat
+-    if not conf.CHECK_FUNCS('strlcpy strlcat'):
+-        if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h',
+-                               checklibc=True):
+-            strlcpy_in_bsd = True
+-    if not conf.CHECK_FUNCS('getpeereid'):
+-        conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h')
+-    if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'):
+-        conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h')
+-    if not conf.CHECK_FUNCS('setproctitle_init'):
+-        conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h')
+-
+-    if not conf.CHECK_FUNCS('closefrom'):
+-        conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h')
++    conf.CHECK_FUNCS('closefrom')
+     conf.CHECK_CODE('''
+                 struct ucred cred;
+@@ -698,9 +689,6 @@ def configure(conf):
+     # look for a method of finding the list of network interfaces
+     for method in ['HAVE_IFACE_GETIFADDRS', 'HAVE_IFACE_AIX', 'HAVE_IFACE_IFCONF', 'HAVE_IFACE_IFREQ']:
+-        bsd_for_strlcpy = ''
+-        if strlcpy_in_bsd:
+-            bsd_for_strlcpy = ' bsd'
+         if conf.CHECK_CODE('''
+                            #define %s 1
+                            #define NO_CONFIG_H 1
+@@ -713,7 +701,7 @@ def configure(conf):
+                            #include "test/getifaddrs.c"
+                            ''' % method,
+                            method,
+-                           lib='nsl socket' + bsd_for_strlcpy,
++                           lib='nsl socket',
+                            addmain=False,
+                            execute=True):
+             break
+@@ -761,7 +749,6 @@ def build(bld):
+                 break
+     extra_libs = ''
+-    if bld.CONFIG_SET('HAVE_LIBBSD'): extra_libs += ' bsd'
+     bld.SAMBA_SUBSYSTEM('LIBREPLACE_HOSTCC',
+         REPLACE_HOSTCC_SOURCE,
diff --git a/net/samba4/patches/103-samba-4.8.5-unbundle-libbsd.patch b/net/samba4/patches/103-samba-4.8.5-unbundle-libbsd.patch
deleted file mode 100644 (file)
index c8eae59..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
---- a/lib/crypto/wscript_configure
-+++ b/lib/crypto/wscript_configure
-@@ -2,11 +2,11 @@
- import Options
- import Utils
--if not conf.CHECK_FUNCS_IN('MD5Init', 'bsd', headers='bsd/md5.h',
--    checklibc=True):
--    conf.CHECK_FUNCS_IN('MD5Init', 'md5', headers='sys/md5.h',
--                        checklibc=True)
--    conf.CHECK_FUNCS_IN('MD5Init', 'md', headers='sys/md5.h',
-+# if not conf.CHECK_FUNCS_IN('MD5Init', 'bsd', headers='bsd/md5.h',
-+    # checklibc=True):
-+conf.CHECK_FUNCS_IN('MD5Init', 'md5', headers='sys/md5.h',
-+                                      checklibc=True)
-+conf.CHECK_FUNCS_IN('MD5Init', 'md', headers='sys/md5.h',
-                         checklibc=True)
- conf.CHECK_FUNCS_IN('CC_MD5_Init', '', headers='CommonCrypto/CommonDigest.h',
-     checklibc=True)
---- a/lib/replace/wscript
-+++ b/lib/replace/wscript
-@@ -340,22 +340,13 @@ def configure(conf):
-     conf.CHECK_FUNCS('prctl dirname basename')
--    strlcpy_in_bsd = False
-+    # Not checking for libbsd
-+    conf.CHECK_FUNCS('strlcpy strlcat')
-+    conf.CHECK_FUNCS('getpeereid')
-+    conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h')
-+    conf.CHECK_FUNCS('setproctitle_init')
--    # libbsd on some platforms provides strlcpy and strlcat
--    if not conf.CHECK_FUNCS('strlcpy strlcat'):
--        if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h',
--                               checklibc=True):
--            strlcpy_in_bsd = True
--    if not conf.CHECK_FUNCS('getpeereid'):
--        conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h')
--    if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'):
--        conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h')
--    if not conf.CHECK_FUNCS('setproctitle_init'):
--        conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h')
--
--    if not conf.CHECK_FUNCS('closefrom'):
--        conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h')
-+    conf.CHECK_FUNCS('closefrom')
-     conf.CHECK_CODE('''
-                 struct ucred cred;
-@@ -698,9 +689,6 @@ def configure(conf):
-     # look for a method of finding the list of network interfaces
-     for method in ['HAVE_IFACE_GETIFADDRS', 'HAVE_IFACE_AIX', 'HAVE_IFACE_IFCONF', 'HAVE_IFACE_IFREQ']:
--        bsd_for_strlcpy = ''
--        if strlcpy_in_bsd:
--            bsd_for_strlcpy = ' bsd'
-         if conf.CHECK_CODE('''
-                            #define %s 1
-                            #define NO_CONFIG_H 1
-@@ -713,7 +701,7 @@ def configure(conf):
-                            #include "test/getifaddrs.c"
-                            ''' % method,
-                            method,
--                           lib='nsl socket' + bsd_for_strlcpy,
-+                           lib='nsl socket',
-                            addmain=False,
-                            execute=True):
-             break
-@@ -761,7 +749,6 @@ def build(bld):
-                 break
-     extra_libs = ''
--    if bld.CONFIG_SET('HAVE_LIBBSD'): extra_libs += ' bsd'
-     bld.SAMBA_SUBSYSTEM('LIBREPLACE_HOSTCC',
-         REPLACE_HOSTCC_SOURCE,
diff --git a/net/samba4/patches/103-tmsize-overflow-fix.patch b/net/samba4/patches/103-tmsize-overflow-fix.patch
new file mode 100644 (file)
index 0000000..5d6cebe
--- /dev/null
@@ -0,0 +1,21 @@
+--- 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",
diff --git a/net/samba4/patches/104-tmsize-overflow-check.patch b/net/samba4/patches/104-tmsize-overflow-check.patch
deleted file mode 100644 (file)
index 8a35a78..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-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;