From 5f2326da87033ebe199aa2b8af8ea39e09d5d4f0 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Mon, 26 Mar 2018 15:18:19 +0000
Subject: samba: update to 4.8.0

---
 ...s4-lib-tls-use-gnutls_priority_set_direct.patch | 69 -----------------
 abs/extra/samba/PKGBUILD                           | 89 +++++++++-------------
 abs/extra/samba/__changelog                        |  2 +-
 abs/extra/samba/samba.install                      |  4 -
 abs/extra/samba/samba.logrotate                    |  4 -
 5 files changed, 36 insertions(+), 132 deletions(-)
 delete mode 100644 abs/extra/samba/0001-s4-lib-tls-use-gnutls_priority_set_direct.patch

diff --git a/abs/extra/samba/0001-s4-lib-tls-use-gnutls_priority_set_direct.patch b/abs/extra/samba/0001-s4-lib-tls-use-gnutls_priority_set_direct.patch
deleted file mode 100644
index d77d7fb..0000000
--- a/abs/extra/samba/0001-s4-lib-tls-use-gnutls_priority_set_direct.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 9d9b38b434b9d2e4b3bddd618cea944dfb960966 Mon Sep 17 00:00:00 2001
-From: Evangelos Foutras <evangelos@foutrelis.com>
-Date: Mon, 13 Apr 2015 22:03:14 +0300
-Subject: [PATCH] s4:lib/tls: use gnutls_priority_set_direct()
-
-gnutls_certificate_type_set_priority() was removed in GnuTLS 3.4.0.
----
- source4/lib/tls/tls.c         | 4 +---
- source4/lib/tls/tls_tstream.c | 9 +--------
- 2 files changed, 2 insertions(+), 11 deletions(-)
-
-diff --git a/source4/lib/tls/tls.c b/source4/lib/tls/tls.c
-index b9182ad..2bcbb80 100644
---- a/source4/lib/tls/tls.c
-+++ b/source4/lib/tls/tls.c
-@@ -572,7 +572,6 @@ struct socket_context *tls_init_client(struct socket_context *socket_ctx,
- {
- 	struct tls_context *tls;
- 	int ret = 0;
--	const int cert_type_priority[] = { GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0 };
- 	struct socket_context *new_sock;
- 	NTSTATUS nt_status;
- 
-@@ -597,8 +596,7 @@ struct socket_context *tls_init_client(struct socket_context *socket_ctx,
- 	gnutls_certificate_allocate_credentials(&tls->xcred);
- 	gnutls_certificate_set_x509_trust_file(tls->xcred, ca_path, GNUTLS_X509_FMT_PEM);
- 	TLSCHECK(gnutls_init(&tls->session, GNUTLS_CLIENT));
--	TLSCHECK(gnutls_set_default_priority(tls->session));
--	gnutls_certificate_type_set_priority(tls->session, cert_type_priority);
-+	TLSCHECK(gnutls_priority_set_direct(tls->session, "NORMAL:+CTYPE-OPENPGP", NULL));
- 	TLSCHECK(gnutls_credentials_set(tls->session, GNUTLS_CRD_CERTIFICATE, tls->xcred));
- 
- 	talloc_set_destructor(tls, tls_destructor);
-diff --git a/source4/lib/tls/tls_tstream.c b/source4/lib/tls/tls_tstream.c
-index f19f5c5..ff0e881 100644
---- a/source4/lib/tls/tls_tstream.c
-+++ b/source4/lib/tls/tls_tstream.c
-@@ -967,11 +967,6 @@ struct tevent_req *_tstream_tls_connect_send(TALLOC_CTX *mem_ctx,
- #if ENABLE_GNUTLS
- 	struct tstream_tls *tlss;
- 	int ret;
--	static const int cert_type_priority[] = {
--		GNUTLS_CRT_X509,
--		GNUTLS_CRT_OPENPGP,
--		0
--	};
- #endif /* ENABLE_GNUTLS */
- 
- 	req = tevent_req_create(mem_ctx, &state,
-@@ -1007,15 +1002,13 @@ struct tevent_req *_tstream_tls_connect_send(TALLOC_CTX *mem_ctx,
- 		return tevent_req_post(req, ev);
- 	}
- 
--	ret = gnutls_set_default_priority(tlss->tls_session);
-+	ret = gnutls_priority_set_direct(tlss->tls_session, "NORMAL:+CTYPE-OPENPGP", NULL);
- 	if (ret != GNUTLS_E_SUCCESS) {
- 		DEBUG(0,("TLS %s - %s\n", __location__, gnutls_strerror(ret)));
- 		tevent_req_error(req, EINVAL);
- 		return tevent_req_post(req, ev);
- 	}
- 
--	gnutls_certificate_type_set_priority(tlss->tls_session, cert_type_priority);
--
- 	ret = gnutls_credentials_set(tlss->tls_session,
- 				     GNUTLS_CRD_CERTIFICATE,
- 				     tls_params->x509_cred);
--- 
-2.3.5
-
diff --git a/abs/extra/samba/PKGBUILD b/abs/extra/samba/PKGBUILD
index 13ddd78..54f5b82 100644
--- a/abs/extra/samba/PKGBUILD
+++ b/abs/extra/samba/PKGBUILD
@@ -10,49 +10,42 @@
 
 pkgbase=samba
 pkgname=('libwbclient' 'smbclient' 'samba')
-pkgver=4.3.4
-# We use the 'A' to fake out pacman's version comparators.  Samba chooses
-# to append 'a','b',etc to their subsequent releases, which pacman
-# misconstrues as alpha, beta, etc.  Bad samba!
-_realver=4.3.4
+pkgver=4.8.0
 pkgrel=1
-arch=(i686 x86_64)
+arch=(x86_64)
 url="http://www.samba.org"
 license=('GPL3')
 makedepends=('python2' 'docbook-xsl' 'pkg-config' 'libbsd' 'db' 'popt' 'libcups' 
-             'readline' 'tevent' 'acl' 'libldap' 'libcap' 'ldb>=1.1.15' 'krb5' 'pam' 
-             'gnutls>=2.4.1' 'talloc' 'tdb' 'dbus')
-source=(http://us1.samba.org/samba/ftp/stable/${pkgbase}-${_realver}.tar.gz
-        http://us1.samba.org/samba/ftp/stable/${pkgbase}-${_realver}.tar.asc
+             'readline' 'tevent' 'acl' 'libldap' 'libcap' 'ldb>=1.1.15' 'krb5' 'pam' 'systemd' 
+             'gnutls>=2.4.1' 'talloc' 'tdb' 'dbus' 'libaio' 'perl-parse-yapp')
+source=(http://us1.samba.org/samba/ftp/stable/${pkgbase}-${pkgver}.tar.gz
+        http://us1.samba.org/samba/ftp/stable/${pkgbase}-${pkgver}.tar.asc
         samba.logrotate
         samba.pam
-        samba.service
-        samba.conf.d
-        smbd.service
-        smbd.socket
-        nmbd.service
-        smbd@.service
-        winbindd.service
         samba.conf)
 validpgpkeys=('52FBC0B86D954B0843324CDC6F33915B6568B7EA') #Samba Distribution Verification Key <samba-bugs@samba.org>
 ### UNINSTALL dmapi package before building!!!
 
+prepare() {
+  cd samba-${pkgver}
+}
+
 build() {
   # Use samba-pkg as a staging directory for the split packages
   # (This is so RPATHS and symlinks are generated correctly via
   # make install, but the otherwise unsplit pieces can be split)
   _pkgsrc=${srcdir}/samba-pkg
   rm -rf ${_pkgsrc}
-  cd ${srcdir}/samba-${_realver}
+  cd ${srcdir}/samba-${pkgver}
   # change to use python2
   SAVEIFS=${IFS}
   IFS=$(echo -en "\n\b")
-  PYTHON_CALLERS="$(find ${srcdir}/samba-${_realver} -name '*.py')
-$(find ${srcdir}/samba-${_realver} -name 'wscript*')
-$(find ${srcdir}/samba-${_realver} -name 'configure.ac')
-$(find ${srcdir}/samba-${_realver} -name 'upgrade_from_s3')
-$(find ${srcdir}/samba-${_realver}/buildtools -type f)
-$(find ${srcdir}/samba-${_realver}/source4/scripting -type f)"
+  PYTHON_CALLERS="$(find ${srcdir}/samba-${pkgver} -name '*.py')
+$(find ${srcdir}/samba-${pkgver} -name 'wscript*')
+$(find ${srcdir}/samba-${pkgver} -name 'configure.ac')
+$(find ${srcdir}/samba-${pkgver} -name 'upgrade_from_s3')
+$(find ${srcdir}/samba-${pkgver}/buildtools -type f)
+$(find ${srcdir}/samba-${pkgver}/source4/scripting -type f)"
   sed -i -e "s|/usr/bin/env python$|/usr/bin/env python2|" \
          -e "s|python-config|python2-config|" \
          -e "s|bin/python|bin/python2|" \
@@ -63,11 +56,12 @@ $(find ${srcdir}/samba-${_realver}/source4/scripting -type f)"
 _samba4_idmap_modules=idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2
 _samba4_pdb_modules=pdb_tdbsam,pdb_ldap,pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4
 _samba4_auth_modules=auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4
- cd ${srcdir}/samba-${_realver}
+ cd ${srcdir}/samba-${pkgver}
   ./configure --enable-fhs \
               --prefix=/usr \
               --sbindir=/usr/bin \
               --libdir=/usr/lib \
+	      --libexecdir=/usr/lib/samba \
               --localstatedir=/var \
               --with-configdir=/etc/samba \
               --with-lockdir=/var/cache/samba \
@@ -77,6 +71,8 @@ _samba4_auth_modules=auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,a
               --with-ldap \
               --with-winbind \
               --with-acl-support \
+              --with-systemd \
+              --systemd-install-services \
               --enable-gnutls \
               --with-pam \
               --with-pammodulesdir=/usr/lib/security \
@@ -91,7 +87,7 @@ _samba4_auth_modules=auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,a
 
   # This gets skipped somehow
   if [ ! -e ${_pkgsrc}/usr/bin/smbtar ]; then
-      install -m755 ${srcdir}/samba-${_realver}/source3/script/smbtar ${_pkgsrc}/usr/bin/
+      install -m755 ${srcdir}/samba-${pkgver}/source3/script/smbtar ${_pkgsrc}/usr/bin/
   fi
 }
 
@@ -107,7 +103,7 @@ depends=('glibc' 'libbsd')
 
   install -d -m755 ${pkgdir}/usr/lib/samba
   mv ${_pkgsrc}/usr/lib/samba/libwinbind-client*.so* ${pkgdir}/usr/lib/samba/
-  #mv ${_pkgsrc}/usr/lib/samba/libreplace.so* ${pkgdir}/usr/lib/samba/
+  mv ${_pkgsrc}/usr/lib/samba/libreplace-samba4.so* ${pkgdir}/usr/lib/samba/
 
   install -d -m755 ${pkgdir}/usr/lib/pkgconfig
   mv ${_pkgsrc}/usr/lib/pkgconfig/wbclient.pc ${pkgdir}/usr/lib/pkgconfig/
@@ -149,7 +145,6 @@ depends=('popt' 'cifs-utils' 'tdb' "libwbclient>=$pkgver" 'ldb'
 
     install -d -m755 ${pkgdir}/usr/lib/pkgconfig
     mv ${_pkgsrc}/usr/lib/pkgconfig/smbclient.pc ${pkgdir}/usr/lib/pkgconfig/
-    mv ${_pkgsrc}/usr/lib/pkgconfig/smbclient-raw.pc ${pkgdir}/usr/lib/pkgconfig/
     mv ${_pkgsrc}/usr/lib/pkgconfig/netapi.pc ${pkgdir}/usr/lib/pkgconfig/
 
     install -d -m755 ${pkgdir}/usr/share/man/man1
@@ -175,8 +170,8 @@ depends=('popt' 'cifs-utils' 'tdb' "libwbclient>=$pkgver" 'ldb'
 
 package_samba() {
 pkgdesc="SMB Fileserver and AD Domain server"
-depends=('db>=4.7' 'popt' 'libcups' 'libcap>=2.16' 'gnutls>=2.4.1'
-         'talloc' 'ldb' 'libbsd' 'python2' 'iniparser' 'tdb' 'libaio' "smbclient>=$pkgver")
+depends=('db>=4.7' 'popt' 'libcups' 'libcap>=2.16' 'gamin' 'gnutls>=2.4.1'
+         'talloc' 'ldb' 'libbsd' 'python2' 'iniparser' 'tdb' 'libaio' 'perl-parse-yapp' "smbclient>=$pkgver")
 backup=(etc/logrotate.d/samba
         etc/pam.d/samba
         etc/samba/smb.conf
@@ -208,20 +203,16 @@ sys.path.insert(0, '/usr/lib/python${_pyver}/site-packages')" \
                ${pkgdir}/usr/${script}
     done
 
-  # install systemd files
-  install -d -m755 ${pkgdir}/usr/lib/systemd/system
-  #for i in smbd nmbd winbindd; do
-  install -m644 ${srcdir}/*.service ${pkgdir}/usr/lib/systemd/system/
-  install -m644 ${srcdir}/*.socket ${pkgdir}/usr/lib/systemd/system/
-  install -d -m755  ${pkgdir}/etc/conf.d
-  install -m644 ${srcdir}/samba.conf.d ${pkgdir}/etc/conf.d/samba
-  #done
+  # packaging/wscript_build to use /etc/conf.d
+  sed -i -e '/^EnvironmentFile/ s/sysconfig/conf.d/' "${pkgdir}"/usr/lib/systemd/system/*.service
+  install -d -m755  "${pkgdir}"/etc/conf.d
+  install -m644 "${srcdir}"/samba-${pkgver}/packaging/systemd/samba.sysconfig "${pkgdir}"/etc/conf.d/samba
+
   # create ephemeral dirs via tmpfiles rather than shipping them in package
   install -D -m644 ${srcdir}/samba.conf ${pkgdir}/usr/lib/tmpfiles.d/samba.conf
-  # install sample smb.conf
+  # create config dir
   install -d -m755 ${pkgdir}/etc/samba
-  install -m644 ${srcdir}/samba-${_realver}/packaging/LSB/smb.conf ${pkgdir}/etc/samba/smb.conf.default
-  
+
   mkdir -p ${pkgdir}/etc/samba/private
   chmod 700 ${pkgdir}/etc/samba/private
 
@@ -231,9 +222,6 @@ sys.path.insert(0, '/usr/lib/python${_pyver}/site-packages')" \
   # winbind krb5 locator
   mkdir -p ${pkgdir}/usr/lib/krb5/plugins/libkrb5
   mv  ${pkgdir}/usr/lib/*.so ${pkgdir}/usr/lib/krb5/plugins/libkrb5/
-
-  # fix logrotate
-  sed -i -e 's|log.%m|%m.log|g' ${pkgdir}/etc/samba/smb.conf.default
   
   # spool directory
   install -d -m1777 ${pkgdir}/var/spool/samba
@@ -241,17 +229,10 @@ sys.path.insert(0, '/usr/lib/python${_pyver}/site-packages')" \
   rm -rf ${pkgdir}/var/run
   
   # copy ldap example
-  install -D -m644 ${srcdir}/samba-${_realver}/examples/LDAP/samba.schema ${pkgdir}/usr/share/doc/samba/examples/LDAP/samba.schema
+  install -D -m644 ${srcdir}/samba-${pkgver}/examples/LDAP/samba.schema ${pkgdir}/usr/share/doc/samba/examples/LDAP/samba.schema
 }
-md5sums=('48df803c6c6c475a714cae82a2dc219e'
+md5sums=('3724c1d3d1befe12ecf7bb86ed7e3463'
          'SKIP'
-         '5697da77590ec092cc8a883bae06093c'
+         '995621522c6ec9b68c1b858ceed627ed'
          '96f82c38f3f540b53f3e5144900acf17'
-         'ee4763a656cf00d92bfda31b6bb2c5cb'
-         '6c447748a064d631435dbef0a3dcf32f'
-         'e4ae6a3cac080602120aa151918c4a36'
-         'a78b9aa93eb14b0ac445897395693225'
-         'df6380c73cb73163968eabc8650f7358'
-         '70afd2db60a2e8eff7615dbdecd887ac'
-         'd5f56f43e1280bba20f6bbd88d16fa41'
          '49abd7b719e3713a3f75a8a50958e381')
diff --git a/abs/extra/samba/__changelog b/abs/extra/samba/__changelog
index 8fcf9eb..3bbb112 100644
--- a/abs/extra/samba/__changelog
+++ b/abs/extra/samba/__changelog
@@ -1,2 +1,2 @@
-PKGBUILD: remove fam/gamin, systemd
+PKGBUILD: remove fam/gamin
 samba.install: add systemconfig.py -m fileshare
diff --git a/abs/extra/samba/samba.install b/abs/extra/samba/samba.install
index 26dbfa4..9562d78 100644
--- a/abs/extra/samba/samba.install
+++ b/abs/extra/samba/samba.install
@@ -1,9 +1,5 @@
 #!/bin/sh
 
-post_install() {
-  systemd-tmpfiles --create samba.conf
-}
-
 post_upgrade() {
   if [ "$(vercmp $2 4.0.4)" -lt 0 ]; then
     echo "Major upgrade from samba 3.x to 4.x,"
diff --git a/abs/extra/samba/samba.logrotate b/abs/extra/samba/samba.logrotate
index 581f4c3..ff28608 100644
--- a/abs/extra/samba/samba.logrotate
+++ b/abs/extra/samba/samba.logrotate
@@ -1,9 +1,5 @@
 /var/log/samba/log.smbd /var/log/samba/log.nmbd /var/log/samba/*.log {
    notifempty
    missingok
-   sharedscripts
    copytruncate
-   postrotate
-      /bin/kill -HUP `cat /var/run/samba/*.pid 2>/dev/null` 2>/dev/null || true
-   endscript
 }
-- 
cgit v0.12

