Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Dec 2017 06:43:53 +0000 (UTC)
From:      "Timur I. Bakeyev" <timur@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r456521 - in head/net/samba47: . files files/man
Message-ID:  <201712170643.vBH6hr0a036934@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: timur
Date: Sun Dec 17 06:43:52 2017
New Revision: 456521
URL: https://svnweb.freebsd.org/changeset/ports/456521

Log:
  Port of the latest stable Samba 4.7.3. With, hopefully, working ZFS provisioning and other fixes of long standing bugs.
  
  Still experimental and version 4.7.4 is coming shortly, so test before putting into production.
  
  Happy birthday release.
  
  Sponsored by:	iXsystems Inc.

Added:
  head/net/samba47/files/0001-Freenas-master-mdns-fixes-22.patch   (contents, props changed)
  head/net/samba47/files/0001-Zfs-provision-1.patch   (contents, props changed)
  head/net/samba47/files/man/ctdb-etcd.7   (contents, props changed)
  head/net/samba47/files/man/ctdb-statistics.7   (contents, props changed)
  head/net/samba47/files/man/ctdb-tunables.7   (contents, props changed)
  head/net/samba47/files/man/ctdb.1   (contents, props changed)
  head/net/samba47/files/man/ctdb.7   (contents, props changed)
  head/net/samba47/files/man/ctdb_diagnostics.1   (contents, props changed)
  head/net/samba47/files/man/ctdb_mutex_ceph_rados_helper.7   (contents, props changed)
  head/net/samba47/files/man/ctdbd.1   (contents, props changed)
  head/net/samba47/files/man/ctdbd.conf.5   (contents, props changed)
  head/net/samba47/files/man/ctdbd_wrapper.1   (contents, props changed)
  head/net/samba47/files/man/ltdbtool.1   (contents, props changed)
  head/net/samba47/files/man/onnode.1   (contents, props changed)
  head/net/samba47/files/man/ping_pong.1   (contents, props changed)
  head/net/samba47/files/patch-buildtools__wafsamba__samba_autoconf.py   (contents, props changed)
  head/net/samba47/files/patch-buildtools__wafsamba__samba_python.py   (contents, props changed)
  head/net/samba47/files/patch-ctdb__wscript   (contents, props changed)
  head/net/samba47/files/patch-docs-xml__smbdotconf__tuning__getwdcache.xml   (contents, props changed)
  head/net/samba47/files/patch-docs-xml__wscript_build   (contents, props changed)
  head/net/samba47/files/patch-examples__pdb__wscript_build   (contents, props changed)
  head/net/samba47/files/patch-glusterfs   (contents, props changed)
  head/net/samba47/files/patch-lib__replace__wscript   (contents, props changed)
  head/net/samba47/files/patch-lib__util__debug.c   (contents, props changed)
  head/net/samba47/files/patch-librpc__idl__xattr.idl   (contents, props changed)
  head/net/samba47/files/patch-source3__lib__util.c   (contents, props changed)
  head/net/samba47/files/patch-source3__modules__vfs_streams_xattr.c   (contents, props changed)
  head/net/samba47/files/patch-source3__winbindd__wscript_build   (contents, props changed)
  head/net/samba47/files/patch-third__party_aesni-intel_wscript   (contents, props changed)
Deleted:
  head/net/samba47/files/patch-lib__param__wscript_build
  head/net/samba47/files/patch-lib__socket__wscript_build
Modified:
  head/net/samba47/Makefile
  head/net/samba47/distinfo
  head/net/samba47/files/patch-buildtools__scripts__abi_gen.sh
  head/net/samba47/files/patch-buildtools__wafsamba__samba_install.py
  head/net/samba47/files/patch-buildtools__wafsamba__wafsamba.py
  head/net/samba47/files/patch-dynconfig__wscript
  head/net/samba47/files/patch-lib__crypto__wscript_configure
  head/net/samba47/files/patch-lib__util__wscript_build
  head/net/samba47/files/patch-nsswitch__wscript_build
  head/net/samba47/files/patch-source3__client__dnsbrowse.c
  head/net/samba47/files/patch-source3__librpc__crypto__gse.c
  head/net/samba47/files/patch-source3__modules__vfs_zfsacl.c
  head/net/samba47/files/patch-source3__smbd__quotas.c
  head/net/samba47/files/patch-source3__utils__net.c
  head/net/samba47/files/patch-source3__utils__net_time.c
  head/net/samba47/files/patch-source3__wscript
  head/net/samba47/files/patch-source3__wscript_build
  head/net/samba47/files/patch-source4__lib__http__http.c
  head/net/samba47/files/patch-third_party__waf__wafadmin__Logs.py
  head/net/samba47/files/patch-third_party__waf__wafadmin__Tools__cc.py
  head/net/samba47/pkg-plist

Modified: head/net/samba47/Makefile
==============================================================================
--- head/net/samba47/Makefile	Sun Dec 17 06:36:15 2017	(r456520)
+++ head/net/samba47/Makefile	Sun Dec 17 06:43:52 2017	(r456521)
@@ -1,7 +1,7 @@
 # Created by: timur@FreeBSD.org
 # $FreeBSD$
 
-PORTNAME?=			${SAMBA4_BASENAME}46
+PORTNAME?=			${SAMBA4_BASENAME}47
 PORTVERSION?=			${SAMBA4_VERSION}
 PORTREVISION?=			0
 CATEGORIES?=			net
@@ -15,13 +15,14 @@ LICENSE=			GPLv3
 
 IGNORE_NONTHREAD_PYTHON=	needs port lang/python${PYTHON_SUFFIX} to be build with THREADS support
 
-CONFLICTS_INSTALL?=		samba4-4.0.* samba4[1-57-9]-4.* p5-Parse-Pidl-4.*
+CONFLICTS?=			samba4-4.0.* samba4[1-689]-4.* p5-Parse-Pidl-4.*
 
-#EXTRA_PATCHES=		${PATCHDIR}/extra-patch-security:-p1
+EXTRA_PATCHES+=			${PATCHDIR}/0001-Zfs-provision-1.patch:-p1
+EXTRA_PATCHES+=			${PATCHDIR}/0001-Freenas-master-mdns-fixes-22.patch:-p1
 
 SAMBA4_BASENAME=		samba
 SAMBA4_PORTNAME=		${SAMBA4_BASENAME}4
-SAMBA4_VERSION=			4.6.11
+SAMBA4_VERSION=			4.7.3
 SAMBA4_DISTNAME=		${SAMBA4_BASENAME}-${SAMBA4_VERSION:S|.p|pre|:S|.r|rc|:S|.t|tp|:S|.a|alpha|}
 
 WRKSRC?=			${WRKDIR}/${DISTNAME}
@@ -34,6 +35,7 @@ VARDIR=				${DESTDIR}/var
 SAMBA4_RUNDIR=			${VARDIR}/run/${SAMBA4_PORTNAME}
 SAMBA4_LOGDIR=			${VARDIR}/log/${SAMBA4_PORTNAME}
 SAMBA4_LOCKDIR=			${VARDIR}/db/${SAMBA4_PORTNAME}
+SAMBA4_BINDDNSDIR=		${SAMBA4_LOCKDIR}/bind-dns
 SAMBA4_PRIVATEDIR=		${SAMBA4_LOCKDIR}/private
 SAMBA4_PAMDIR=			${PREFIX}/lib
 SAMBA4_LIBDIR=			${PREFIX}/lib/${SAMBA4_PORTNAME}
@@ -63,7 +65,7 @@ CONFIGURE_ARGS+=		--mandir="${MANPREFIX}/man" \
 # Flags
 CONFIGURE_ENV+=			PTHREAD_LDFLAGS="-lpthread"
 
-USES=				cpe compiler waf pkgconfig perl5 python:2.7 \
+USES=				cpe compiler waf pkgconfig perl5 \
 				readline iconv shebangfix
 USE_PERL5=			build
 USE_LDCONFIG=			${SAMBA4_LIBDIR}
@@ -77,35 +79,45 @@ PLIST_SUB+=			PKGCONFIGDIR=${PKGCONFIGDIR_REL}
 # Options
 OPTIONS_SUB=			yes
 
-OPTIONS_DEFINE=			ADS AD_DC CUPS \
-				DOCS FAM LDAP \
-				QUOTAS SYSLOG UTMP
-
+OPTIONS_DEFINE=			AD_DC ADS DEBUG DOCS FAM LDAP \
+				QUOTAS SYSLOG UTMP PROFILE
+# Make those default options
 OPTIONS_DEFAULT:=		${OPTIONS_DEFINE}
+# This shouldn't be default in the release
+OPTIONS_DEFINE+=		DEVELOPER MANDOC
 
-AD_DC_DESC=			Active Directory Domain Controller support
-ADS_DESC=			Active Directory client support(implies LDAP)
-EXP_MODULES_DESC=		Experimental modules(WANT_EXP_MODULES)
-FAM_DESC=			File Alteration Monitor support
-LDAP_DESC=			LDAP client support
-PAM_SMBPASS_DESC=		PAM authentication via passdb backends
-QUOTAS_DESC=			Disk quota support
-UTMP_DESC=			UTMP accounting support
-##############################################################################
-OPTIONS_DEFINE+=		CUPS DEBUG DEVELOPER MANPAGES EXP_MODULES NTVFS
+OPTIONS_DEFINE_amd64=		AESNI
+OPTIONS_DEFAULT_amd64=		AESNI
 
-DEVELOPER_DESC=			With development support(implies NTVFS)
-MANPAGES_DESC=			Build manpages from DOCBOOK templates
-NTVFS_DESC=			Build *DEPRECATED* NTVFS file server
+OPTIONS_DEFINE+=		CLUSTER CUPS GLUSTERFS GPGME NTVFS SPOTLIGHT
 
 OPTIONS_RADIO=			DNS ZEROCONF
 OPTIONS_RADIO_DNS=		NSUPDATE BIND99 BIND910 BIND911
-OPTIONS_RADIO_ZEROCONF=		AVAHI MDNSRESPONDER
+OPTIONS_RADIO_ZEROCONF=		MDNSRESPONDER AVAHI
+##############################################################################
+AD_DC_DESC=			Active Directory Domain Controller
+ADS_DESC=			Active Directory client(implies LDAP)
+AESNI_DESC=			Accelerated AES crypto functions(amd64 only)
+CLUSTER_DESC=			Clustering
+DEVELOPER_DESC=			With developer framework(implies NTVFS)
+FAM_DESC=			File Alteration Monitor
+GPGME_DESC=			GpgME
+GLUSTERFS_DESC=			GlusterFS
+LDAP_DESC=			LDAP client
+LIBZFS_DESC=			LibZFS
+SPOTLIGHT_DESC=			Spotlight
+MANDOC_DESC=			Build manpages from DOCBOOK templates
+NTVFS_DESC=			Build *DEPRECATED* NTVFS file server
+PICKY_DEVELOPER_DESC=		Treat compiler warnings as errors(implies DEVELOPER)
+PROFILE_DESC=			Profiling data
+QUOTAS_DESC=			Disk quota
+UTMP_DESC=			UTMP accounting
 
 BIND99_DESC=			Use Bind 9.9 as AD DC DNS server frontend
 BIND910_DESC=			Use Bind 9.10 as AD DC DNS server frontend
 BIND911_DESC=			Use Bind 9.11 as AD DC DNS server frontend
 NSUPDATE_DESC=			Use samba NSUPDATE utility for AD DC
+##############################################################################
 # XXX: Unconditional dependencies which can't be switched off(if present in the system)
 # popt
 LIB_DEPENDS+=			libpopt.so:devel/popt
@@ -115,75 +127,102 @@ LIB_DEPENDS+=			libinotify.so:devel/libinotify
 LIB_DEPENDS+=			libgnutls.so:security/gnutls
 # NFS4 ACL glue
 LIB_DEPENDS+=			libsunacl.so:sysutils/libsunacl
-# Libarchive
-BUILD_DEPENDS+=			libarchive>=3.1.2:archivers/libarchive
-RUN_DEPENDS+=			libarchive>=3.1.2:archivers/libarchive
+# Jansson
+BUILD_DEPENDS+=			jansson>=2.10:devel/jansson
+RUN_DEPENDS+=			jansson>=2.10:devel/jansson
 # External Samba dependencies
 # Needed for IDL compiler
 BUILD_DEPENDS+=			p5-Parse-Yapp>=0:devel/p5-Parse-Yapp
-# External Python modules
-BUILD_DEPENDS+=			${PYTHON_PKGNAMEPREFIX}dnspython>=1.9.4:dns/py-dnspython@${PY_FLAVOR}
-RUN_DEPENDS+=			${PYTHON_PKGNAMEPREFIX}dnspython>=1.9.4:dns/py-dnspython@${PY_FLAVOR}
-PLIST_SUB+=			PY_DNSPYTHON="@comment "
-#
-BUILD_DEPENDS+=			${PYTHON_PKGNAMEPREFIX}iso8601>=0.1.11:devel/py-iso8601@${PY_FLAVOR}
-RUN_DEPENDS+=			${PYTHON_PKGNAMEPREFIX}iso8601>=0.1.11:devel/py-iso8601@${PY_FLAVOR}
-PLIST_SUB+=			PY_ISO8601="@comment "
+# Libarchive
+BUILD_DEPENDS+=			libarchive>=3.1.2:archivers/libarchive
+RUN_DEPENDS+=			libarchive>=3.1.2:archivers/libarchive
+SAMBA4_BUNDLED_LIBS+=		!libarchive
+# cmocka
+BUILD_DEPENDS+=			cmocka>=1.1.1:sysutils/cmocka
+RUN_DEPENDS+=			cmocka>=1.1.1:sysutils/cmocka
+SAMBA4_BUNDLED_LIBS+=		!cmocka
 # talloc
 BUILD_DEPENDS+=			talloc>=2.1.9:devel/talloc
 RUN_DEPENDS+=			talloc>=2.1.9:devel/talloc
-SAMBA4_BUNDLED_LIBS+=		!talloc
+SAMBA4_BUNDLED_LIBS+=		!talloc,!pytalloc-util
 # tevent
 BUILD_DEPENDS+=			tevent>=0.9.34:devel/tevent
 RUN_DEPENDS+=			tevent>=0.9.34:devel/tevent
-SAMBA4_BUNDLED_LIBS+=		!tevent
+SAMBA4_BUNDLED_LIBS+=		!tevent,!pytevent
 # tdb
-BUILD_DEPENDS+=			tdb>=1.3.12:databases/tdb
-RUN_DEPENDS+=			tdb>=1.3.12:databases/tdb
-SAMBA4_BUNDLED_LIBS+=		!tdb
+BUILD_DEPENDS+=			tdb>=1.3.14:databases/tdb
+RUN_DEPENDS+=			tdb>=1.3.14:databases/tdb
+SAMBA4_BUNDLED_LIBS+=		!tdb,!pytdb
 # ldb
+SAMBA4_LDB=			12
+.if !defined(SAMBA4_LDB) || ${SAMBA4_LDB} == 13
+BUILD_DEPENDS+=			ldb13>=1.3.0:databases/ldb13
+RUN_DEPENDS+=			ldb13>=1.3.0:databases/ldb13
+.elif ${SAMBA4_LDB} == 12
+BUILD_DEPENDS+=			ldb12>=1.2.2:databases/ldb12
+RUN_DEPENDS+=			ldb12>=1.2.2:databases/ldb12
+.elif ${SAMBA4_LDB} == 11
 BUILD_DEPENDS+=			ldb>=1.1.29:databases/ldb
 RUN_DEPENDS+=			ldb>=1.1.29:databases/ldb
-SAMBA4_BUNDLED_LIBS+=		!ldb
-# Don't use external libcom_err, cmocka
-SAMBA4_BUNDLED_LIBS+=		com_err,cmocka
+.endif
+SAMBA4_BUNDLED_LIBS+=		!ldb,!pyldb,!pyldb-util
+# Don't use external libcom_err
+SAMBA4_BUNDLED_LIBS+=		com_err
 
+TEST_DEPENDS+=			python:lang/python \
+				bash:shells/bash \
+				tshark:net/tshark
+##############################################################################
 CONFIGURE_ARGS+=		\
 				--with-pam \
 				--with-iconv \
 				--with-winbind \
+				--with-regedit \
 				--disable-rpath \
+				--without-lttng \
 				--without-gettext \
 				--enable-pthreadpool \
+				--without-fake-kaserver \
+				--without-systemd \
+				--enable-gnutls \
+				--with-libarchive \
 				--with-acl-support \
 				--with-sendfile-support \
+				--disable-ctdb-tests \
 				${ICONV_CONFIGURE_BASE}
-
+##############################################################################
 BIND99_RUN_DEPENDS=		bind99>=9.9.0.0:dns/bind99
 BIND910_RUN_DEPENDS=		bind910>=9.10.0.0:dns/bind910
 BIND911_RUN_DEPENDS=		bind911>=9.11.0.0:dns/bind911
 NSUPDATE_RUN_DEPENDS=		samba-nsupdate:dns/samba-nsupdate
 
+AVAHI_CONFIGURE_ENABLE=		avahi
+AVAHI_LIB_DEPENDS=		libavahi-client.so:net/avahi-app
+
+MDNSRESPONDER_CONFIGURE_ENABLE=	dnssd
+MDNSRESPONDER_LIB_DEPENDS=	libdns_sd.so:net/mDNSResponder
+##############################################################################
 DEBUG_CONFIGURE_ON=		--verbose --enable-debug
 DEBUG_MAKE_ARGS=		--verbose
-DEBUG_VARS=			WITH_DEBUG=yes
-
+DEBUG_VARS_ON=			WITH_DEBUG=yes
+DEBUG_CFLAGS=			-g -ggdb -gdwarf-2 -gstrict-dwarf -O0
 # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194046
 GDB_CMD?=			${LOCALBASE}/bin/gdb
 # https://bugzilla.samba.org/show_bug.cgi?id=8969
 DEVELOPER_IMPLIES=		NTVFS
-DEVELOPER_BUILD_DEPENDS=	${GDB_CMD}:devel/gdb
-DEVELOPER_RUN_DEPENDS=		${GDB_CMD}:devel/gdb
 DEVELOPER_CONFIGURE_ON=		--enable-developer --enable-selftest --abi-check-disable
+DEVELOPER_BUILD_DEPENDS=	${GDB_CMD}:devel/gdb
+DEVELOPER_TEST_DEPENDS=		${GDB_CMD}:devel/gdb
 DEVELOPER_VARS_OFF=		GDB_CMD=true
+
+PICKY_DEVELOPER_CONFIGURE_ON=	--picky-developer
 # XXX: Mostly used in conjuction with DEVELOPER option, don't enable it if you don't know what you are doing
 NTVFS_CONFIGURE_WITH=		ntvfs-fileserver
 ##############################################################################
-AVAHI_CONFIGURE_ENABLE=		avahi
-AVAHI_LIB_DEPENDS=		libavahi-client.so:net/avahi-app
+AESNI_CONFIGURE_ON=		--accel-aes=intelaesni
+AESNI_CONFIGURE_OFF=		--accel-aes=none
 
-MDNSRESPONDER_CONFIGURE_ENABLE=	dnssd
-MDNSRESPONDER_LIB_DEPENDS=	libdns_sd.so:net/mDNSResponder
+CLUSTER_CONFIGURE_WITH=		cluster-support
 
 CUPS_CONFIGURE_ENABLE=		cups iprint
 CUPS_LIB_DEPENDS=		libcups.so:print/cups
@@ -192,8 +231,23 @@ CUPS_LIB_DEPENDS=		libcups.so:print/cups
 FAM_USES=			fam
 FAM_CONFIGURE_WITH=		fam
 
+GLUSTERFS_CONFIGURE_ENABLE=	glusterfs
+GLUSTERFS_LIB_DEPENDS=		libglusterfs.so:net/glusterfs
+GLUSTERFS_VARS=			SAMBA4_MODULES+=vfs_glusterfs
+
+GPGME_CONFIGURE_WITH=		gpgme
+GPGME_LIB_DEPENDS=		libgpgme.so:security/gpgme
+
+PROFILE_CONFIGURE_WITH=		profiling-data
+
 QUOTAS_CONFIGURE_WITH=		quotas
 
+SPOTLIGHT_CONFIGURE_ENABLE=	spotlight
+SPOTLIGHT_BUILD_DEPENDS=	tracker>=1.4.1:sysutils/tracker
+SPOTLIGHT_RUN_DEPENDS=		tracker>=1.4.1:sysutils/tracker
+SPOTLIGHT_USES=			bison
+SPOTLIGHT_USE=			gnome=glib20
+
 SYSLOG_CONFIGURE_WITH=		syslog
 
 UTMP_CONFIGURE_WITH=		utmp
@@ -210,9 +264,12 @@ LDAP_CONFIGURE_WITH=		ldap
 LDAP_USE=			OPENLDAP=yes
 LDAP_VARS=			SAMBA4_MODULES+=idmap_ldap
 
-MANPAGES_BUILD_DEPENDS=		${LOCALBASE}/share/xsl/docbook/manpages/docbook.xsl:textproc/docbook-xsl \
+# LIBZFS_CONFIGURE_WITH=		libzfs
+# LIBZFS_VARS=			SAMBA4_MODULES+=vfs_zfs_space
+
+MANDOC_BUILD_DEPENDS=		${LOCALBASE}/share/xsl/docbook/manpages/docbook.xsl:textproc/docbook-xsl \
 				xsltproc:textproc/libxslt
-MANPAGES_CONFIGURE_ENV_OFF=	XSLTPROC="true"
+MANDOC_CONFIGURE_ENV_OFF=	XSLTPROC="true"
 
 # !SAMBA4_SUBPORT
 .endif
@@ -223,12 +280,16 @@ MANPAGES_CONFIGURE_ENV_OFF=	XSLTPROC="true"
 
 .if !defined(SAMBA4_SUBPORT)
 
-.if ${PORT_OPTIONS:MEXP_MODULES}
-.	if !defined(WANT_EXP_MODULES) || empty(WANT_EXP_MODULES)
+.if !defined(WANT_EXP_MODULES) || empty(WANT_EXP_MODULES)
 WANT_EXP_MODULES=		vfs_cacheprime
-.	endif
 .endif
 
+.if ${WANT_EXP_MODULES:Mvfs_snapper}
+# snapper needs dbus
+LIB_DEPENDS+=			libdbus-1.so:devel/dbus
+LIB_DEPENDS+=			libdbus-glib-1.so:devel/dbus-glib
+.endif
+
 SAMBA4_MODULES+=		idmap_nss idmap_autorid idmap_rid idmap_hash idmap_tdb idmap_tdb2 idmap_script nss-info_hash
 # List of extra modules taken from RHEL build
 # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197320
@@ -258,6 +319,50 @@ CONFIGURE_ARGS+=		--with-shared-modules="${SAMBA4_MODU
 .for module in ${SAMBA4_MODULES}
 PLIST_FILES+=			lib/shared-modules/${module:C|_|/|:C|-|_|}.so
 .endfor
+# Python bindings
+.if defined(NO_PYTHON)
+USES+=				python:2.7,build,test
+CONFIGURE_ARGS+=		--disable-python
+PLIST_SUB+=			SAMBA4_PYTHON2="@comment " SAMBA4_PYTHON3="@comment "
+.else
+USES+=				python:2.7
+PLIST_SUB+=			SAMBA4_PYTHON2=""
+# External Python modules
+BUILD_DEPENDS+=			${PYTHON_PKGNAMEPREFIX}dnspython>=1.15.0:dns/py-dnspython@${PY_FLAVOR}
+RUN_DEPENDS+=			${PYTHON_PKGNAMEPREFIX}dnspython>=1.15.0:dns/py-dnspython@${PY_FLAVOR}
+
+BUILD_DEPENDS+=			${PYTHON_PKGNAMEPREFIX}iso8601>=0.1.11:devel/py-iso8601@${PY_FLAVOR}
+RUN_DEPENDS+=			${PYTHON_PKGNAMEPREFIX}iso8601>=0.1.11:devel/py-iso8601@${PY_FLAVOR}
+# XXX: This is a gross hack to make port use both Python 2.7+ and 3.3+
+# This is not officially supported, use at your own risk
+.if defined(WITH_SAMBA4_PYTHON3) && ${WITH_SAMBA4_PYTHON3:Mpython3\.[0-9]}
+SAMBA4_PYTHON3=			${WITH_SAMBA4_PYTHON3}
+SAMBA4_PYTHON3_VERSION:=	${SAMBA4_PYTHON3:S/^python//}
+SAMBA4_PYTHON3_VER:=		${SAMBA4_PYTHON3_VERSION:C/\.//}
+.if !exists(${PORTSDIR}/lang/python${SAMBA4_PYTHON3_VER})
+.error				unsupported or unknown Python version ${SAMBA4_PYTHON3_VERSION}
+.endif
+BUILD_DEPENDS+=			${SAMBA4_PYTHON3}:lang/python${SAMBA4_PYTHON3_VER}
+RUN_DEPENDS+=			${SAMBA4_PYTHON3}:lang/python${SAMBA4_PYTHON3_VER}
+# External Python modules
+BUILD_DEPENDS+=			py${SAMBA4_PYTHON3_VER}-dnspython>=1.15.0:dns/py-dnspython@py${SAMBA4_PYTHON3_VER}
+RUN_DEPENDS+=			py${SAMBA4_PYTHON3_VER}-dnspython>=1.15.0:dns/py-dnspython@py${SAMBA4_PYTHON3_VER}
+
+BUILD_DEPENDS+=			py${SAMBA4_PYTHON3_VER}-iso8601>=0.1.11:devel/py-iso8601@py${SAMBA4_PYTHON3_VER}
+RUN_DEPENDS+=			py${SAMBA4_PYTHON3_VER}-iso8601>=0.1.11:devel/py-iso8601@py${SAMBA4_PYTHON3_VER}
+# cpython-36m
+SAMBA4_PYTHON3_SO_ABI!=		[ ! -f "${LOCALBASE}/bin/${SAMBA4_PYTHON3}" ] || ${LOCALBASE}/bin/${SAMBA4_PYTHON3} -c 'import sysconfig; print(sysconfig.get_config_var("SOABI") or "")' 2>/dev/null
+SAMBA4_PYTHON3_SITELIBDIR=	lib/python${SAMBA4_PYTHON3_VERSION}/site-packages
+
+CONFIGURE_ENV+=			PYTHON3_SO_ABI_FLAG=.${SAMBA4_PYTHON3_SO_ABI}
+CONFIGURE_ARGS+=		--extra-python=${LOCALBASE}/bin/${SAMBA4_PYTHON3}
+
+PLIST_SUB+=			SAMBA4_PYTHON3="" SAMBA4_PYTHON3_SITELIBDIR="${SAMBA4_PYTHON3_SITELIBDIR}"
+.else
+PLIST_SUB+=			SAMBA4_PYTHON3="@comment "
+.endif
+.endif
+
 # !SAMBA4_SUBPORT
 .endif
 
@@ -266,10 +371,31 @@ PLIST_FILES+=			lib/shared-modules/${module:C|_|/|:C|-
 ##############################################################################
 
 .if !defined(SAMBA4_SUBPORT)
+
+# for libexecinfo: (so that __builtin_frame_address() finds the top of the stack)
+CFLAGS_amd64+=			-fno-omit-frame-pointer
+# No fancy color error messages
+CONFIGURE_ENV+=			NOCOLOR=yes WAF_LOG_FORMAT='%(c1)s%(zone)s%(c2)s %(message)s'
+MAKE_ENV+=			NOCOLOR=yes WAF_LOG_FORMAT='%(c1)s%(zone)s%(c2)s %(message)s'
+
+TEST_ENV+=			PYTHON="${PYTHON_CMD}" SHA1SUM=/sbin/sha1
+
+.if ${CHOSEN_COMPILER_TYPE} == clang
+CFLAGS+=			-fno-color-diagnostics
+.endif
+
+.if ${readline_ARGS} == port
+CFLAGS+=			-D_FUNCTION_DEF
+.endif
+# Make sure that the right version of Python is used by the tools
+# https://bugzilla.samba.org/show_bug.cgi?id=7305
+SHEBANG_FILES=			${PATCH_WRKSRC}/source4/scripting/bin/* ${PATCH_WRKSRC}/selftest/*
+
 SAMBA4_SUB=			SAMBA4_LOGDIR="${SAMBA4_LOGDIR}" \
 				SAMBA4_RUNDIR="${SAMBA4_RUNDIR}" \
 				SAMBA4_LOCKDIR="${SAMBA4_LOCKDIR}" \
 				SAMBA4_MODULEDIR="${SAMBA4_MODULEDIR}" \
+				SAMBA4_BINDDNSDIR="${SAMBA4_BINDDNSDIR}" \
 				SAMBA4_PRIVATEDIR="${SAMBA4_PRIVATEDIR}" \
 				SAMBA4_CONFDIR="${SAMBA4_CONFDIR}" \
 				SAMBA4_CONFIG="${SAMBA4_CONFIG}"
@@ -279,56 +405,7 @@ SUB_LIST+=			${SAMBA4_SUB}
 
 USE_RC_SUBR=			samba_server
 SUB_FILES=			pkg-message README.FreeBSD
-# Make sure that the right version of Python is used by the tools
-# https://bugzilla.samba.org/show_bug.cgi?id=7305
-SHEBANG_FILES=			${PATCH_WRKSRC}/source4/scripting/bin/*
-# No fancy color error messages
 
-# for libexecinfo: (so that __builtin_frame_address() finds the top of the stack)
-.if ${ARCH} == "amd64"
-CFLAGS+=			-fno-omit-frame-pointer
-.endif
-.if ${CHOSEN_COMPILER_TYPE} == clang
-CFLAGS+=			-fno-color-diagnostics
-.endif
-.if ${readline_ARGS} == port
-CFLAGS+=			-D_FUNCTION_DEF
-.endif
-CONFIGURE_ENV+=			NOCOLOR=yes WAF_LOG_FORMAT='%(c1)s%(zone)s%(c2)s %(message)s'
-MAKE_ENV+=			NOCOLOR=yes WAF_LOG_FORMAT='%(c1)s%(zone)s%(c2)s %(message)s'
-
-SAMBA_MAN1+=			dbwrap_tool.1 findsmb.1 gentest.1 locktest.1 \
-				log2pcap.1 masktest.1 mvxattr.1 ndrdump.1 nmblookup.1 \
-				nmblookup4.1 ntlm_auth.1 oLschema2ldif.1 \
-				profiles.1 regdiff.1 regpatch.1 regshell.1 \
-				regtree.1 rpcclient.1 sharesec.1 smbcacls.1 \
-				smbclient.1 smbcontrol.1 smbcquotas.1 smbget.1 \
-				smbstatus.1 smbtar.1 smbtorture.1 smbtree.1 \
-				testparm.1 vfstest.1 wbinfo.1
-
-SAMBA_MAN5+=			lmhosts.5 smbgetrc.5 smbpasswd.5 pam_winbind.conf.5 \
-				smb.conf.5
-
-SAMBA_MAN7+=			libsmbclient.7 samba.7 winbind_krb5_locator.7
-
-SAMBA_MAN8+=			cifsdd.8 eventlogadm.8 idmap_ad.8 idmap_autorid.8 idmap_hash.8 \
-				idmap_ldap.8 idmap_nss.8 idmap_rfc2307.8 idmap_rid.8 idmap_script.8 \
-				idmap_tdb.8 idmap_tdb2.8 net.8 nmbd.8 pam_winbind.8 pdbedit.8 \
-				samba-regedit.8 samba-tool.8 samba.8 smbd.8 smbpasswd.8 \
-				smbspool_krb5_wrapper.8 smbspool.8 smbta-util.8 vfs_acl_tdb.8 vfs_acl_xattr.8 \
-				vfs_aio_fork.8 vfs_aio_linux.8 vfs_aio_pthread.8 \
-				vfs_audit.8 vfs_cacheprime.8 vfs_cap.8 vfs_catia.8 vfs_ceph.8 \
-				vfs_commit.8 vfs_crossrename.8 vfs_default_quota.8 \
-				vfs_dirsort.8 vfs_extd_audit.8 vfs_fake_perms.8 vfs_fileid.8 \
-				vfs_fruit.8 vfs_full_audit.8 vfs_glusterfs.8 vfs_gpfs.8 vfs_media_harmony.8 \
-				vfs_netatalk.8 vfs_offline.8 vfs_prealloc.8 \
-				vfs_preopen.8 vfs_readahead.8 vfs_readonly.8 \
-				vfs_recycle.8 vfs_scannedonly.8 vfs_shadow_copy.8 \
-				vfs_shadow_copy2.8 vfs_snapper.8 vfs_smb_traffic_analyzer.8 \
-				vfs_streams_depot.8 vfs_streams_xattr.8 vfs_syncops.8 vfs_time_audit.8 \
-				vfs_tsmsm.8 vfs_worm.8 vfs_xattr_tdb.8 winbindd.8 \
-				vfs_linux_xfs_sgid.8 vfs_btrfs.8 vfs_shell_snap.8 vfs_unityed_media.8
-
 PORTDOCS=			README.FreeBSD
 
 post-extract:
@@ -343,6 +420,8 @@ post-patch:
 					${PATCH_WRKSRC}/buildtools/scripts/abi_gen.sh
 				@${REINPLACE_CMD} -e 's|%%SAMBA4_CONFIG%%|${SAMBA4_CONFIG}|g' \
 					${PATCH_WRKSRC}/dynconfig/wscript
+				@${REINPLACE_CMD} -e '1s|/bin/bash|/bin/sh|' \
+					 ${PATCH_WRKSRC}/ctdb/tools/onnode
 
 # Use threading (or multiprocessing) but not thread (renamed in python 3+).
 pre-configure:
@@ -353,7 +432,9 @@ pre-configure:
 					${FALSE}; \
 				fi
 
-pre-build-MANPAGES-off:
+pre-build-MANDOC-off:
+				${MKDIR} ${BUILD_WRKSRC}/bin/default/docs-xml/
+				${CP} -rp ${BUILD_WRKSRC}/docs/manpages ${BUILD_WRKSRC}/bin/default/docs-xml/
 .for man in			libcli/nbt/man/nmblookup4.1 \
 				librpc/tools/ndrdump.1 \
 				source4/lib/registry/man/regdiff.1 \
@@ -366,21 +447,31 @@ pre-build-MANPAGES-off:
 				source4/torture/man/smbtorture.1 \
 				source4/utils/man/ntlm_auth4.1 \
 				source4/utils/man/oLschema2ldif.1
-					-@${MKDIR} `dirname ${BUILD_WRKSRC}/bin/default/${man}`
+					${MKDIR} `dirname ${BUILD_WRKSRC}/bin/default/${man}`
 					${INSTALL_MAN} ${FILESDIR}/man/`basename ${man}` ${BUILD_WRKSRC}/bin/default/${man}
 .endfor
-				-@${MKDIR} ${BUILD_WRKSRC}/bin/default/docs-xml/manpages
-.for man in			${SAMBA_MAN1} ${SAMBA_MAN5} ${SAMBA_MAN7} ${SAMBA_MAN8}
-					-${INSTALL_MAN} ${BUILD_WRKSRC}/docs/manpages/${man} ${BUILD_WRKSRC}/bin/default/docs-xml/manpages
+.if ${PORT_OPTIONS:MCLUSTER}
+				${MKDIR} ${BUILD_WRKSRC}/bin/default/ctdb/
+.	for man in		ctdb_diagnostics.1 ctdb.1 ctdbd_wrapper.1 ctdbd.1 \
+				ltdbtool.1 onnode.1 ping_pong.1 ctdbd.conf.5 \
+				ctdb.7 ctdb-statistics.7 ctdb-tunables.7
+					${INSTALL_MAN} ${FILESDIR}/man/${man} ${BUILD_WRKSRC}/bin/default/ctdb/
+.	endfor
+.endif
+
+post-install-rm-junk:
+.for f in vfs_aio_linux.8 vfs_btrfs.8 vfs_ceph.8 vfs_gpfs.8
+				${RM} ${STAGEDIR}${PREFIX}/man/man8/${f}
 .endfor
 
-post-install:
+post-install: post-install-rm-junk
 				${LN} -sf smb.conf.5.gz ${STAGEDIR}${PREFIX}/man/man5/smb4.conf.5.gz
 # Run post-install script
 .for dir in			${SAMBA4_LOGDIR} ${SAMBA4_RUNDIR} ${SAMBA4_LOCKDIR} ${SAMBA4_MODULEDIR}
 					${INSTALL} -d -m 0755 "${STAGEDIR}${dir}"
 .endfor
-				${INSTALL} -d -m 0700 "${STAGEDIR}${SAMBA4_PRIVATEDIR}"
+				${INSTALL} -d -m 0750 "${STAGEDIR}${SAMBA4_BINDDNSDIR}"
+				${INSTALL} -d -m 0750 "${STAGEDIR}${SAMBA4_PRIVATEDIR}"
 .for dir in			auth bind9 gensec gpext idmap ldb nss_info pdb perfcount process_model service vfs
 					${INSTALL} -d -m 0755 "${STAGEDIR}${SAMBA4_MODULEDIR}/${dir}"
 .endfor
@@ -390,11 +481,6 @@ post-install-DOCS-on:
 .for doc in			${PORTDOCS}
 				${INSTALL_DATA} ${WRKDIR}/${doc} ${STAGEDIR}${DOCSDIR}
 .endfor
-
-.if ${PORT_OPTIONS:MDEVELOPER}
-test: build
-				@(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${INSTALL_WRKSRC}/${WAF_CMD} ${MAKE_ARGS} $@)
-.endif
 
 # !SAMBA4_SUBPORT
 .endif

Modified: head/net/samba47/distinfo
==============================================================================
--- head/net/samba47/distinfo	Sun Dec 17 06:36:15 2017	(r456520)
+++ head/net/samba47/distinfo	Sun Dec 17 06:43:52 2017	(r456521)
@@ -1,3 +1,3 @@
-TIMESTAMP = 1511283638
-SHA256 (samba-4.6.11.tar.gz) = 051b7ab0fa088d77dc0df039ff5d6b8fd998372f0c29ecb455b149457c20ed1d
-SIZE (samba-4.6.11.tar.gz) = 21157318
+TIMESTAMP = 1511474282
+SHA256 (samba-4.7.3.tar.gz) = 06e4152ca1cb803f005e92eb6baedb6cc874998b44ee37c2a7819e77a55bfd2c
+SIZE (samba-4.7.3.tar.gz) = 16845436

Added: head/net/samba47/files/0001-Freenas-master-mdns-fixes-22.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/samba47/files/0001-Freenas-master-mdns-fixes-22.patch	Sun Dec 17 06:43:52 2017	(r456521)
@@ -0,0 +1,366 @@
+From 923bc7a1afeb0b920e60e14846987ae1d2d7dca4 Mon Sep 17 00:00:00 2001
+From: John Hixson <john@ixsystems.com>
+Date: Thu, 7 Dec 2017 09:36:32 -0500
+Subject: [PATCH] Freenas/master mdns fixes (#22)
+
+* mDNS fixes for Samba (work in progress).
+
+* Fix mDNS - Can advertise on individual interfaces
+
+* Fix mDNS browsing in smbclient
+
+Signed-off-by: Timur I. Bakeyev <timur@iXsystems.com>
+---
+ source3/client/dnsbrowse.c |  17 ++--
+ source3/smbd/dnsregister.c | 193 +++++++++++++++++++++++++++++----------------
+ 2 files changed, 137 insertions(+), 73 deletions(-)
+
+diff --git a/source3/client/dnsbrowse.c b/source3/client/dnsbrowse.c
+index efd57d42d88..83aef966d2a 100644
+--- a/source3/client/dnsbrowse.c
++++ b/source3/client/dnsbrowse.c
+@@ -39,6 +39,7 @@ struct mdns_smbsrv_result
+ struct mdns_browse_state
+ {
+ 	struct mdns_smbsrv_result *listhead; /* Browse result list head */
++	TALLOC_CTX * ctx;
+ 	int browseDone;
+ 
+ };
+@@ -64,7 +65,7 @@ static void do_smb_resolve(struct mdns_smbsrv_result *browsesrv)
+ 	struct timeval tv;
+ 	DNSServiceErrorType err;
+ 
+-	TALLOC_CTX * ctx = talloc_tos();
++	TALLOC_CTX * ctx = talloc_new(NULL);
+ 
+ 	err = DNSServiceResolve(&mdns_conn_sdref, 0 /* flags */,
+ 		browsesrv->ifIndex,
+@@ -124,18 +125,19 @@ do_smb_browse_reply(DNSServiceRef sdRef, DNSServiceFlags flags,
+ 		return;
+ 	}
+ 
+-	bresult = talloc_array(talloc_tos(), struct mdns_smbsrv_result, 1);
++	bresult = talloc_array(bstatep->ctx, struct mdns_smbsrv_result, 1);
+ 	if (bresult == NULL) {
+ 		return;
+ 	}
+ 
++	bresult->nextResult = NULL;
+ 	if (bstatep->listhead != NULL) {
+ 		bresult->nextResult = bstatep->listhead;
+ 	}
+ 
+-	bresult->serviceName = talloc_strdup(talloc_tos(), serviceName);
+-	bresult->regType = talloc_strdup(talloc_tos(), regtype);
+-	bresult->domain = talloc_strdup(talloc_tos(), replyDomain);
++	bresult->serviceName = talloc_strdup(bstatep->ctx, serviceName);
++	bresult->regType = talloc_strdup(bstatep->ctx, regtype);
++	bresult->domain = talloc_strdup(bstatep->ctx, replyDomain);
+ 	bresult->ifIndex = interfaceIndex;
+ 	bstatep->listhead = bresult;
+ }
+@@ -151,10 +153,13 @@ int do_smb_browse(void)
+ 	DNSServiceRef mdns_conn_sdref = NULL;
+ 	DNSServiceErrorType err;
+ 
+-	TALLOC_CTX * ctx = talloc_stackframe();
++	TALLOC_CTX * ctx = talloc_new(NULL);
+ 
+ 	ZERO_STRUCT(bstate);
+ 
++	bstate.ctx = ctx;
++	bstate.listhead = NULL;
++
+ 	err = DNSServiceBrowse(&mdns_conn_sdref, 0, 0, "_smb._tcp", "",
+ 			do_smb_browse_reply, &bstate);
+ 
+diff --git a/source3/smbd/dnsregister.c b/source3/smbd/dnsregister.c
+index df189001a09..f25b60f4611 100644
+--- a/source3/smbd/dnsregister.c
++++ b/source3/smbd/dnsregister.c
+@@ -36,85 +36,111 @@
+ #include <dns_sd.h>
+ 
+ struct dns_reg_state {
+-	struct tevent_context *event_ctx;
+-	uint16_t port;
+-	DNSServiceRef srv_ref;
+-	struct tevent_timer *te;
+-	int fd;
+-	struct tevent_fd *fde;
++	int count;
++	struct reg_state {
++		DNSServiceRef srv_ref;
++		TALLOC_CTX *mem_ctx;
++		struct tevent_context *event_ctx;
++		struct tevent_timer *te;
++		struct tevent_fd *fde;
++		uint16_t port;
++		int if_index;
++		int fd;
++	} *drs;
+ };
+ 
+-static int dns_reg_state_destructor(struct dns_reg_state *dns_state)
++static void dns_register_smbd_retry(struct tevent_context *ctx,
++				    struct tevent_timer *te,
++				    struct timeval now,
++				    void *private_data);
++static void dns_register_smbd_fde_handler(struct tevent_context *ev,
++					  struct tevent_fd *fde,
++					  uint16_t flags,
++					  void *private_data);
++
++
++static int reg_state_destructor(struct reg_state *state)
+ {
+-	if (dns_state->srv_ref != NULL) {
++	if (state == NULL) {
++		return -1;
++	}
++
++	if (state->srv_ref != NULL) {
+ 		/* Close connection to the mDNS daemon */
+-		DNSServiceRefDeallocate(dns_state->srv_ref);
+-		dns_state->srv_ref = NULL;
++		DNSServiceRefDeallocate(state->srv_ref);
++		state->srv_ref = NULL;
+ 	}
+ 
+ 	/* Clear event handler */
+-	TALLOC_FREE(dns_state->te);
+-	TALLOC_FREE(dns_state->fde);
+-	dns_state->fd = -1;
++	TALLOC_FREE(state->te);
++	TALLOC_FREE(state->fde);
++	state->fd = -1;
+ 
+ 	return 0;
+ }
+ 
+-static void dns_register_smbd_retry(struct tevent_context *ctx,
+-				    struct tevent_timer *te,
+-				    struct timeval now,
+-				    void *private_data);
+-static void dns_register_smbd_fde_handler(struct tevent_context *ev,
+-					  struct tevent_fd *fde,
+-					  uint16_t flags,
+-					  void *private_data);
+ 
+-static bool dns_register_smbd_schedule(struct dns_reg_state *dns_state,
++static bool dns_register_smbd_schedule(struct reg_state *state,
+ 				       struct timeval tval)
+ {
+-	dns_reg_state_destructor(dns_state);
++	reg_state_destructor(state);
+ 
+-	dns_state->te = tevent_add_timer(dns_state->event_ctx,
+-					 dns_state,
++	state->te = tevent_add_timer(state->event_ctx,
++					 state->mem_ctx,
+ 					 tval,
+ 					 dns_register_smbd_retry,
+-					 dns_state);
+-	if (!dns_state->te) {
++					 state);
++	if (!state->te) {
+ 		return false;
+ 	}
+ 
+ 	return true;
+ }
+ 
++static void dns_register_smbd_callback(DNSServiceRef service,
++				       DNSServiceFlags flags,
++				       DNSServiceErrorType errorCode,
++				       const char *name,
++				       const char *type,
++				       const char *domain,
++				       void *context)
++{
++	if (errorCode != kDNSServiceErr_NoError) {
++		DEBUG(6, ("error=%d\n", errorCode));
++	} else {
++		DEBUG(6, ("%-15s %s.%s%s\n", "REGISTER", name, type, domain));
++	}
++}
++
+ static void dns_register_smbd_retry(struct tevent_context *ctx,
+ 				    struct tevent_timer *te,
+ 				    struct timeval now,
+ 				    void *private_data)
+ {
+-	struct dns_reg_state *dns_state = talloc_get_type_abort(private_data,
+-					  struct dns_reg_state);
++	struct reg_state *state = (struct reg_state *)private_data;
+ 	DNSServiceErrorType err;
+ 
+-	dns_reg_state_destructor(dns_state);
++	reg_state_destructor(state);
+ 
+-	DEBUG(6, ("registering _smb._tcp service on port %d\n",
+-		  dns_state->port));
++	DEBUG(6, ("registering _smb._tcp service on port %d index %d\n",
++		  state->port, state->if_index));
+ 
+ 	/* Register service with DNS. Connects with the mDNS
+ 	 * daemon running on the local system to perform DNS
+ 	 * service registration.
+ 	 */
+-	err = DNSServiceRegister(&dns_state->srv_ref, 0 /* flags */,
+-			kDNSServiceInterfaceIndexAny,
+-			NULL /* service name */,
+-			"_smb._tcp" /* service type */,
+-			NULL /* domain */,
+-			"" /* SRV target host name */,
+-			htons(dns_state->port),
+-			0 /* TXT record len */,
+-			NULL /* TXT record data */,
+-			NULL /* callback func */,
+-			NULL /* callback context */);
++	err = DNSServiceRegister(&state->srv_ref,
++			0		/* flags */,
++			state->if_index /* interface index */,
++			NULL 		/* service name */,
++			"_smb._tcp"	/* service type */,
++			NULL		/* domain */,
++			""		/* SRV target host name */,
++			htons(state->port) /* port */, 
++			0		/* TXT record len */,
++			NULL		/* TXT record data */,
++			dns_register_smbd_callback /* callback func */,
++			NULL		/* callback context */);
+ 
+ 	if (err != kDNSServiceErr_NoError) {
+ 		/* Failed to register service. Schedule a re-try attempt.
+@@ -123,24 +149,24 @@ static void dns_register_smbd_retry(struct tevent_context *ctx,
+ 		goto retry;
+ 	}
+ 
+-	dns_state->fd = DNSServiceRefSockFD(dns_state->srv_ref);
+-	if (dns_state->fd == -1) {
++	state->fd = DNSServiceRefSockFD(state->srv_ref);
++	if (state->fd == -1) {
+ 		goto retry;
+ 	}
+ 
+-	dns_state->fde = tevent_add_fd(dns_state->event_ctx,
+-				       dns_state,
+-				       dns_state->fd,
+-				       TEVENT_FD_READ,
+-				       dns_register_smbd_fde_handler,
+-				       dns_state);
+-	if (!dns_state->fde) {
++	state->fde = tevent_add_fd(state->event_ctx,
++				   state->mem_ctx,
++				   state->fd,
++				   TEVENT_FD_READ,
++				   dns_register_smbd_fde_handler,
++				   state);
++	if (!state->fde) {
+ 		goto retry;
+ 	}
+ 
+ 	return;
+  retry:
+-	dns_register_smbd_schedule(dns_state,
++	dns_register_smbd_schedule(state,
+ 		timeval_current_ofs(DNS_REG_RETRY_INTERVAL, 0));
+ }
+ 
+@@ -150,44 +176,77 @@ static void dns_register_smbd_fde_handler(struct tevent_context *ev,
+ 					  uint16_t flags,
+ 					  void *private_data)
+ {
+-	struct dns_reg_state *dns_state = talloc_get_type_abort(private_data,
+-					  struct dns_reg_state);
++	struct reg_state *state = (struct reg_state *)private_data;
+ 	DNSServiceErrorType err;
+ 
+-	err = DNSServiceProcessResult(dns_state->srv_ref);
++	err = DNSServiceProcessResult(state->srv_ref);
+ 	if (err != kDNSServiceErr_NoError) {
+-		DEBUG(3, ("failed to process mDNS result (err %d), re-trying\n",
+-			    err));
++		DEBUG(3, ("failed to process mDNS result (err %d), re-trying\n", err));
+ 		goto retry;
+ 	}
+ 
+-	talloc_free(dns_state);
+ 	return;
+ 
+  retry:
+-	dns_register_smbd_schedule(dns_state,
+-		timeval_current_ofs(DNS_REG_RETRY_INTERVAL, 0));
++	dns_register_smbd_schedule(state, timeval_zero());
+ }
+ 
++static int dns_reg_state_destructor(struct dns_reg_state *state)
++{
++	if (state != NULL) {
++		talloc_free(state);
++	}
++	return 0;
++}
++
++
+ bool smbd_setup_mdns_registration(struct tevent_context *ev,
+ 				  TALLOC_CTX *mem_ctx,
+ 				  uint16_t port)
+ {
+ 	struct dns_reg_state *dns_state;
++	bool bind_all = true;
++	int i;
+ 
+ 	dns_state = talloc_zero(mem_ctx, struct dns_reg_state);
+-	if (dns_state == NULL) {
++	if (dns_state == NULL)
++		return false;
++
++	if (lp_interfaces() && lp_bind_interfaces_only())
++		bind_all = false;
++
++	dns_state->count = iface_count();
++	if (dns_state->count <= 0 || bind_all == true)
++		dns_state->count = 1;
++
++	dns_state->drs = talloc_array(mem_ctx, struct reg_state, dns_state->count);
++	if (dns_state->drs == NULL) {
++		talloc_free(dns_state);
+ 		return false;
+ 	}
+-	dns_state->event_ctx = ev;
+-	dns_state->port = port;
+-	dns_state->fd = -1;
+ 
+-	talloc_set_destructor(dns_state, dns_reg_state_destructor);
++	for (i = 0; i < dns_state->count; i++) {
++		struct interface *iface = get_interface(i);
++		struct reg_state *state = &dns_state->drs[i];
++
++		state->mem_ctx = mem_ctx;
++		state->srv_ref = NULL;
++		state->event_ctx = ev;
++		state->te = NULL;
++		state->fde = NULL;
++		state->port = port;
++		state->fd = -1;
++
++		state->if_index = bind_all ? kDNSServiceInterfaceIndexAny : iface->if_index;
+ 
+-	return dns_register_smbd_schedule(dns_state, timeval_zero());
++		dns_register_smbd_schedule(&dns_state->drs[i], timeval_zero());
++	}
++
++	talloc_set_destructor(dns_state, dns_reg_state_destructor);
++	return true;
+ }
+ 
++
+ #else /* WITH_DNSSD_SUPPORT */
+ 
+ bool smbd_setup_mdns_registration(struct tevent_context *ev,
+-- 
+2.14.2
+

Added: head/net/samba47/files/0001-Zfs-provision-1.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/samba47/files/0001-Zfs-provision-1.patch	Sun Dec 17 06:43:52 2017	(r456521)
@@ -0,0 +1,320 @@
+From 2664c997587416a2c8c911a75158485a5c98b70b Mon Sep 17 00:00:00 2001
+From: John Hixon <john@ixsystems.com>
+Date: Sat, 20 May 2017 04:39:37 +0200
+Subject: [PATCH] Zfs provision (#1)
+
+Cherry-pick ZFS provisioning code by iXsystems Inc.
+
+* Check if sysvol is on filesystem with NFSv4 ACL's
+(cherry picked from commit ca86f52b78a7b6e7537454a69cf93e7b96210cba)
+
+* Only check targetdir if it is defined (I had assumed it was)
+(cherry picked from commit a29050cb2978ce23e3c04a859340dc2664c77a8a)
+
+* Kick samba a little bit into understanding NFSv4 ACL's
+(cherry picked from commit 1c7542ff4904b729e311e17464ee76582760c219)
+
+Signed-off-by: Timur I. Bakeyev <timur@iXsystems.com>
+---
+ python/samba/provision/__init__.py |  25 ++++--
+ source3/lib/sysacls.c              |  10 +++
+ source3/param/loadparm.c           |   7 ++
+ source3/smbd/pysmbd.c              | 156 ++++++++++++++++++++++++++++++++++++-
+ 4 files changed, 191 insertions(+), 7 deletions(-)
+
+diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py
+index 5de986463a5..cd3b91f41b9 100644
+--- a/python/samba/provision/__init__.py
++++ b/python/samba/provision/__init__.py
+@@ -1556,19 +1556,25 @@ def setsysvolacl(samdb, netlogon, sysvol, uid, gid, domainsid, dnsdomain,
+         s3conf = s3param.get_context()
+         s3conf.load(lp.configfile)
+ 
+-        file = tempfile.NamedTemporaryFile(dir=os.path.abspath(sysvol))
++        sysvol_dir = os.path.abspath(sysvol)
++
++        if smbd.has_posix_acls(sysvol_dir):
++            set_simple_acl = smbd.set_simple_acl
++        elif smbd.has_nfsv4_acls(sysvol_dir):
++            set_simple_acl = smbd.set_simple_nfsv4_acl
++
++        file = tempfile.NamedTemporaryFile(dir=sysvol_dir)
+         try:
+             try:
+-                smbd.set_simple_acl(file.name, 0755, gid)
++                set_simple_acl(file.name, 0755, gid)
+             except OSError:
+-                if not smbd.have_posix_acls():
++                if not smbd.have_posix_acls() and not smbd.have_nfsv4_acls():
+                     # This clue is only strictly correct for RPM and
+                     # Debian-like Linux systems, but hopefully other users
+                     # will get enough clue from it.
+-                    raise ProvisioningError("Samba was compiled without the posix ACL support that s3fs requires.  "
++                    raise ProvisioningError("Samba was compiled without the ACL support that s3fs requires.  "
+                                             "Try installing libacl1-dev or libacl-devel, then re-run configure and make.")
+-
+-                raise ProvisioningError("Your filesystem or build does not support posix ACLs, which s3fs requires.  "
++                raise ProvisioningError("Your filesystem or build does not support ACLs, which s3fs requires.  "
+                                         "Try the mounting the filesystem with the 'acl' option.")
+             try:
+                 smbd.chown(file.name, uid, gid)
+@@ -1821,6 +1828,9 @@ def provision_fill(samdb, secrets_ldb, logger, names, paths,
+         samdb.transaction_commit()
+ 
+     if serverrole == "active directory domain controller":
++        if targetdir and smbd.have_nfsv4_acls() and smbd.has_nfsv4_acls(targetdir):
++            smbd.set_nfsv4_defaults()
++
+         # Continue setting up sysvol for GPO. This appears to require being
+         # outside a transaction.
+         if not skip_sysvolacl:
+@@ -2184,6 +2194,9 @@ def provision(logger, session_info, smbconf=None,
+             if not os.path.isdir(paths.netlogon):
+                 os.makedirs(paths.netlogon, 0755)
+ 
++            if smbd.have_nfsv4_acls() and smbd.has_nfsv4_acls(paths.sysvol):
++                smbd.set_nfsv4_defaults()
++
+         if adminpass is None:
+             adminpass = samba.generate_random_password(12, 32)
+             adminpass_generated = True
+diff --git a/source3/lib/sysacls.c b/source3/lib/sysacls.c
+index 0bf3c37edfa..786cd39b5bc 100644
+--- a/source3/lib/sysacls.c
++++ b/source3/lib/sysacls.c
+@@ -38,6 +38,16 @@
+ #include "modules/vfs_hpuxacl.h"
+ #endif
+ 
++/*
++ * NFSv4 ACL's should be understood and a first class citizen. Work
++ * needs to be done in librpc/idl/smb_acl.idl for this to occur.
++ */
++#if defined(HAVE_LIBSUNACL) && defined(FREEBSD)
++#if 0
++#include "modules/nfs4_acls.h"
++#endif
++#endif
++
+ #undef  DBGC_CLASS
+ #define DBGC_CLASS DBGC_ACLS
+ 
+diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
+index a2fcc4246c9..4b676897fc1 100644
+--- a/source3/param/loadparm.c
++++ b/source3/param/loadparm.c
+@@ -2740,6 +2740,13 @@ static void init_locals(void)
+ 			} else if (lp_parm_const_string(-1, "posix", "eadb", NULL)) {
+ 				lp_do_parameter(-1, "vfs objects", "dfs_samba4 acl_xattr posix_eadb");
+ 			} else {

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712170643.vBH6hr0a036934>