diff --git a/net/samba419/Makefile b/net/samba419/Makefile index a2f94220341d..54b0614a6d81 100644 --- a/net/samba419/Makefile +++ b/net/samba419/Makefile @@ -1,704 +1,704 @@ PORTNAME= ${SAMBA4_BASENAME}419 PORTVERSION= ${SAMBA4_VERSION} -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES?= net MASTER_SITES= SAMBA/samba/stable SAMBA/samba/rc DISTNAME= ${SAMBA4_DISTNAME} MAINTAINER= samba@FreeBSD.org COMMENT= Free SMB/CIFS and AD/DC server and client for Unix WWW= https://gitlab.com/samba-freebsd/ LICENSE= GPLv3+ LICENSE_FILE= ${WRKSRC}/COPYING USES= cpe CONFLICTS_INSTALL?= samba4* EXTRA_PATCHES= \ ${PATCHDIR}/0001-Compact-and-simplify-modules-build-and-config-genera.patch:-p1 \ ${PATCHDIR}/0002-Adjust-abi_gen.sh-script-to-run-under-FreeBSD-with-i.patch:-p1 \ ${PATCHDIR}/0003-Mask-CLang-prototype-warnings-in-kadm5-admin.h.patch:-p1 \ ${PATCHDIR}/0004-On-FreeBSD-date-1-has-different-semantics-than-on-Li.patch:-p1 \ ${PATCHDIR}/0005-Include-jemalloc-jemalloc.h-if-ENABLE_JEMALLOC-is-se.patch:-p1 \ ${PATCHDIR}/0006-Install-nss_-modules-into-PAMMODULESDIR-path.patch:-p1 \ ${PATCHDIR}/0007-Use-macro-value-as-a-default-backlog-size-for-the-li.patch:-p1 \ ${PATCHDIR}/0008-Brute-force-work-around-usage-of-Linux-specific-m-fl.patch:-p1 \ ${PATCHDIR}/0009-Make-sure-that-config-checks-fail-if-the-warning-is-.patch:-p1 \ ${PATCHDIR}/0010-Add-option-with-pkgconfigdir-to-specify-alternative-.patch:-p1 \ ${PATCHDIR}/0011-Use-provided-by-port-location-of-the-XML-catalog.patch:-p1 \ ${PATCHDIR}/0012-Create-shared-libraries-according-to-the-FreeBSD-spe.patch:-p1 \ ${PATCHDIR}/0013-Pass-additional-msg-parameter-to-CHECK_LIB-so-it-can.patch:-p1 \ ${PATCHDIR}/0014-Add-option-to-disable-CTDB-tests-failing-on-FreeBSD-.patch:-p1 \ ${PATCHDIR}/0015-Add-extra-debug-class-to-trck-down-DB-locking-code.patch:-p1 \ ${PATCHDIR}/0016-Make-ldb_schema_attribute_compare-a-stable-comparisi.patch:-p1 \ ${PATCHDIR}/0017-Use-arc4random-when-available-to-generate-random-tal.patch:-p1 \ ${PATCHDIR}/0018-Add-configuration-option-that-allows-to-choose-alter.patch:-p1 \ ${PATCHDIR}/0019-From-923bc7a1afeb0b920e60e14846987ae1d2d7dca4-Mon-Se.patch:-p1 \ ${PATCHDIR}/0020-FreeBSD-12-between-r336017-and-r342928-wrongfuly-ret.patch:-p1 \ ${PATCHDIR}/0021-Fix-casting-warnings-in-the-nfs_quota-debug-message.patch:-p1 \ ${PATCHDIR}/0022-Clean-up-UTMP-handling-code-and-add-FreeBSD-support..patch:-p1 \ ${PATCHDIR}/0023-Add-cmd_get_quota-test-function-into-vfstest-to-test.patch:-p1 \ ${PATCHDIR}/0024-Cherry-pick-ZFS-provisioning-code-by-iXsystems-Inc.patch:-p1 \ ${PATCHDIR}/0025-From-d9b748869a8f4018ebee302aae8246bf29f60309-Mon-Se.patch:-p1 \ ${PATCHDIR}/0026-vfs-add-a-compatibility-option-to-the-vfs_streams_xa.patch:-p1 \ ${PATCHDIR}/0027-Add-VFS-module-vfs_freebsd-that-implements-FreeBSD-s.patch:-p1 \ ${PATCHDIR}/0028-Fix-rl_completion_func_t.patch:-p1 \ ${PATCHDIR}/0100-Fix-pathref-handling-for-FreeBSD-13plus.patch SAMBA4_BASENAME= samba SAMBA4_PORTNAME= ${SAMBA4_BASENAME}4 SAMBA4_VERSION= 4.19.9 SAMBA4_DISTNAME= ${SAMBA4_BASENAME}-${SAMBA4_VERSION:S|.p|pre|:S|.r|rc|:S|.t|tp|:S|.a|alpha|} WRKSRC?= ${WRKDIR}/${DISTNAME} PLIST?= ${PKGDIR}/pkg-plist CPE_VENDOR= samba CPE_PRODUCT= samba # Directories 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} SAMBA4_INCLUDEDIR= ${PREFIX}/include/${SAMBA4_PORTNAME} SAMBA4_CONFDIR= ${PREFIX}/etc SAMBA4_CONFIG= smb4.conf SAMBA4_MODULES_CLASS= auth bind9 gensec gpext idmap ldb nss_info \ pdb perfcount process_model service vfs CONFIGURE_ARGS= --mandir="${PREFIX}/share/man" \ --sysconfdir="${SAMBA4_CONFDIR}" \ --includedir="${SAMBA4_INCLUDEDIR}" \ --datadir="${DATADIR}" \ --libdir="${SAMBA4_LIBDIR}" \ --with-privatelibdir="${SAMBA4_LIBDIR}/private" \ --with-pammodulesdir="${SAMBA4_PAMDIR}" \ --with-modulesdir="${SAMBA4_MODULEDIR}" \ --with-pkgconfigdir="${PKGCONFIGDIR}" \ --localstatedir="${VARDIR}" \ --with-piddir="${SAMBA4_RUNDIR}" \ --with-sockets-dir="${SAMBA4_RUNDIR}" \ --with-privileged-socket-dir="${SAMBA4_RUNDIR}" \ --with-lockdir="${SAMBA4_LOCKDIR}" \ --with-statedir="${SAMBA4_LOCKDIR}" \ --with-cachedir="${SAMBA4_LOCKDIR}" \ --with-bind-dns-dir=${SAMBA4_BINDDNSDIR} \ --with-privatedir="${SAMBA4_PRIVATEDIR}" \ --with-logfilebase="${SAMBA4_LOGDIR}" # XXX: Flags CONFIGURE_ENV= PTHREAD_LDFLAGS="-lpthread" \ PYTHONHASHSEED=1 MAKE_ENV= PYTHONHASHSEED=1 USES= compiler:c++11-lang iconv localbase:ldflags \ perl5 pkgconfig shebangfix waf gettext-runtime USE_PERL5= build USE_LDCONFIG= ${SAMBA4_LIBDIR} WAF_CMD= buildtools/bin/waf CONFIGURE_LOG= bin/config.log # Make sure that the right version of Python is used by the tools # https://bugzilla.samba.org/show_bug.cgi?id=7305 SHEBANG_FILES= source3/script* source4/scripting/bin/* selftest/* PKGCONFIGDIR?= ${PREFIX}/libdata/pkgconfig PKGCONFIGDIR_REL?= ${PKGCONFIGDIR:S,^${PREFIX}/,,} PLIST_SUB= PKGCONFIGDIR=${PKGCONFIGDIR_REL} SUB_LIST= PKGCONFIGDIR=${PKGCONFIGDIR_REL} ############################################################################## OPTIONS_SUB= yes OPTIONS_DEFINE= AD_DC ADS CLUSTER CUPS DOCS FAM GPGME \ LDAP MANDOC PROFILE PYTHON3 QUOTAS \ SPOTLIGHT SYSLOG UTMP #OPTIONS_DEFINE+= DEVELOPER MEMORY_DEBUG OPTIONS_GROUP= VFS OPTIONS_GROUP_VFS= FRUIT GLUSTERFS OPTIONS_SINGLE= GSSAPI ZEROCONF OPTIONS_SINGLE_GSSAPI= GSSAPI_BUILTIN GSSAPI_MIT #GSSAPI_HEIMDAL OPTIONS_SINGLE_ZEROCONF= ZEROCONF_NONE AVAHI MDNSRESPONDER # Make those default options OPTIONS_DEFAULT= AD_DC ADS DOCS FAM LDAP \ PROFILE PYTHON3 QUOTAS SYSLOG UTMP \ FRUIT GSSAPI_BUILTIN AVAHI ############################################################################## ADS_DESC= Active Directory client(implies LDAP) AD_DC_DESC= Active Directory Domain Controller(implies PYTHON3) CLUSTER_DESC= Clustering support DEVELOPER_DESC= With developer framework FAM_DESC= File Alteration Monitor GPGME_DESC= GpgME support LDAP_DESC= LDAP client LIBZFS_DESC= LibZFS SPOTLIGHT_DESC= Spotlight server-side search support MANDOC_DESC= Build manpages from DOCBOOK templates MEMORY_DEBUG_DESC= Debug memory allocator PICKY_DEVELOPER_DESC= Treat compiler warnings as errors(implies DEVELOPER) PROFILE_DESC= Profiling data QUOTAS_DESC= Disk quota support UTMP_DESC= UTMP accounting VFS_DESC= VFS modules FRUIT_DESC= MacOSX and TimeMachine support GLUSTERFS_DESC= GlusterFS support GSSAPI_BUILTIN_DESC= GSSAPI support via bundled Heimdal ZEROCONF_DESC= Zero configuration networking ZEROCONF_NONE_DESC= Zeroconf support is absent ############################################################################## # XXX: Unconditional dependencies which can't be switched off(if present in # the system) # Iconv(picked up unconditionaly) LIB_DEPENDS= libiconv.so:converters/libiconv # unwind LIB_DEPENDS+= libunwind.so:devel/libunwind # Readline(sponsored by Python) # XXX: USES=readline pollutes CPPFLAGS, so we explicitly put dependency LIB_DEPENDS+= libreadline.so:devel/readline # popt LIB_DEPENDS+= libpopt.so:devel/popt # inotify LIB_DEPENDS+= libinotify.so:devel/libinotify # GNUTLS LIB_DEPENDS+= libgnutls.so:security/gnutls LIB_DEPENDS+= libgcrypt.so:security/libgcrypt # NFSv4 ACL glue LIB_DEPENDS+= libsunacl.so:sysutils/libsunacl # Jansson BUILD_DEPENDS+= jansson>=2.10:devel/jansson RUN_DEPENDS+= jansson>=2.10:devel/jansson # tasn1 BUILD_DEPENDS+= libtasn1>=3.8:security/libtasn1 RUN_DEPENDS+= libtasn1>=3.8:security/libtasn1 # External Samba dependencies # Needed for IDL compiler BUILD_DEPENDS+= p5-Parse-Yapp>=0:devel/p5-Parse-Yapp # Libarchive SAMBA4_BUNDLED_LIBS= !libarchive BUILD_DEPENDS+= libarchive>=3.1.2:archivers/libarchive RUN_DEPENDS+= libarchive>=3.1.2:archivers/libarchive ### Bundled libraries SAMBA4_BUNDLED_CMOCKA?= no SAMBA4_BUNDLED_TALLOC?= no SAMBA4_BUNDLED_TEVENT?= no SAMBA4_BUNDLED_TDB?= no SAMBA4_BUNDLED_LDB?= no # cmocka .if defined(SAMBA4_BUNDLED_CMOCKA) && ${SAMBA4_BUNDLED_CMOCKA} == yes SAMBA4_BUNDLED_LIBS+= cmocka CONFLICTS_INSTALL+= cmocka-1.* PLIST_SUB+= SAMBA4_BUNDLED_CMOCKA="" SUB_LIST+= SAMBA4_BUNDLED_CMOCKA="" .else SAMBA4_BUNDLED_LIBS+= !cmocka BUILD_DEPENDS+= cmocka>=1.1.3:sysutils/cmocka TEST_DEPENDS+= cmocka>=1.1.3:sysutils/cmocka PLIST_SUB+= SAMBA4_BUNDLED_CMOCKA="@comment " SUB_LIST+= SAMBA4_BUNDLED_CMOCKA="@comment " .endif # talloc .if defined(SAMBA4_BUNDLED_TALLOC) && ${SAMBA4_BUNDLED_TALLOC} == yes SAMBA4_BUNDLED_LIBS+= talloc PLIST_SUB+= SAMBA4_BUNDLED_TALLOC="" SUB_LIST+= SAMBA4_BUNDLED_TALLOC="" .else SAMBA4_BUNDLED_LIBS+= !talloc BUILD_DEPENDS+= talloc>=2.4.1:devel/talloc RUN_DEPENDS+= talloc>=2.4.1:devel/talloc PLIST_SUB+= SAMBA4_BUNDLED_TALLOC="@comment " SUB_LIST+= SAMBA4_BUNDLED_TALLOC="@comment " .endif # tevent .if defined(SAMBA4_BUNDLED_TEVENT) && ${SAMBA4_BUNDLED_TEVENT} == yes SAMBA4_BUNDLED_LIBS+= tevent CONFLICTS_INSTALL+= tevent-* tevent1-* PLIST_SUB+= SAMBA4_BUNDLED_TEVENT="" SUB_LIST+= SAMBA4_BUNDLED_TEVENT="" .else SAMBA4_BUNDLED_LIBS+= !tevent BUILD_DEPENDS+= tevent>=0.15.0:devel/tevent RUN_DEPENDS+= tevent>=0.15.0:devel/tevent PLIST_SUB+= SAMBA4_BUNDLED_TEVENT="@comment " SUB_LIST+= SAMBA4_BUNDLED_TEVENT="@comment " .endif # tdb .if defined(SAMBA4_BUNDLED_TDB) && ${SAMBA4_BUNDLED_TDB} == yes SAMBA4_BUNDLED_LIBS+= tdb CONFLICTS_INSTALL+= tdb-* tdb1-* PLIST_SUB+= SAMBA4_BUNDLED_TDB="" SUB_LIST+= SAMBA4_BUNDLED_TDB="" .else SAMBA4_BUNDLED_LIBS+= !tdb BUILD_DEPENDS+= tdb>=1.4.9:databases/tdb RUN_DEPENDS+= tdb>=1.4.9:databases/tdb PLIST_SUB+= SAMBA4_BUNDLED_TDB="@comment " SUB_LIST+= SAMBA4_BUNDLED_TDB="@comment " .endif # ldb .if defined(SAMBA4_BUNDLED_LDB) && ${SAMBA4_BUNDLED_LDB} == yes SAMBA4_BUNDLED_LDB= yes SAMBA4_BUNDLED_LIBS+= ldb PLIST_SUB+= SAMBA4_BUNDLED_LDB="" SUB_LIST+= SAMBA4_BUNDLED_LDB="" SAMBA4_MODULEDIR= ${SAMBA4_LIBDIR}/modules .else SAMBA4_BUNDLED_LIBS+= !ldb BUILD_DEPENDS+= ldb28>=2.8.1:databases/ldb28 RUN_DEPENDS+= ldb28>=2.8.1:databases/ldb28 PLIST_SUB+= SAMBA4_BUNDLED_LDB="@comment " SUB_LIST+= SAMBA4_BUNDLED_LDB="@comment " SAMBA4_MODULEDIR= ${PREFIX}/lib/shared-modules .endif .if (defined(SAMBA4_BUNDLED_TALLOC) && ${SAMBA4_BUNDLED_TALLOC} == yes) \ || (defined(SAMBA4_BUNDLED_TDB) && ${SAMBA4_BUNDLED_TDB} == yes) \ || (defined(SAMBA4_BUNDLED_LDB) && ${SAMBA4_BUNDLED_LDB} == yes) \ || (defined(SAMBA4_BUNDLED_TEVENT) && ${SAMBA4_BUNDLED_TEVENT} == yes) SAMBA4_BUNDLED_LIBS+= replace .endif # Don't use external libcom_err SAMBA4_BUNDLED_LIBS+= com_err # Set the test environment variables TEST_USES= python TEST_ENV= PYTHON="${PYTHON_CMD}" \ SHA1SUM=/sbin/sha1 \ SHA256SUM=/sbin/sha256 \ MD5SUM=/sbin/md5 \ PYTHONDONTWRITEBYTECODE=1 TEST_DEPENDS= bash:shells/bash \ tshark:net/wireshark@nox11 # External Python modules TEST_BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}iso8601>=0.1.11:devel/py-iso8601@${PY_FLAVOR} TEST_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}iso8601>=0.1.11:devel/py-iso8601@${PY_FLAVOR} ############################################################################## CONFIGURE_ARGS+= \ --with-pam \ --with-iconv \ --with-winbind \ --with-regedit \ --disable-rpath \ --without-lttng \ --without-gettext \ --enable-pthreadpool \ --without-fake-kaserver \ --without-systemd \ --with-libarchive \ --with-acl-support \ --with-sendfile-support \ --disable-ctdb-tests # ${ICONV_CONFIGURE_BASE} ############################################################################## FRUIT_PREVENTS= ZEROCONF_NONE FRUIT_PREVENTS_MSG= MacOSX support requires Zeroconf(AVAHI or MDNSRESPONDER) FRUIT_VARS= SAMBA4_MODULES+=vfs_fruit FRUIT_PLIST_FILES= share/man/man8/vfs_fruit.8.gz GLUSTERFS_CONFIGURE_ENABLE= glusterfs GLUSTERFS_LIB_DEPENDS= libglusterfs.so:net/glusterfs GLUSTERFS_VARS= SAMBA4_MODULES+=vfs_glusterfs GLUSTERFS_PLIST_FILES= share/man/man8/vfs_glusterfs.8.gz ZEROCONF_NONE_MAKE_ENV= ZEROCONF=none ############################################################################## AVAHI_CONFIGURE_ENABLE= avahi AVAHI_LIB_DEPENDS= libavahi-client.so:net/avahi-app AVAHI_VARS= SAMBA4_SERVICES+=avahi_daemon MDNSRESPONDER_CONFIGURE_ENABLE= dnssd MDNSRESPONDER_LIB_DEPENDS= libdns_sd.so:net/mDNSResponder MDNSRESPONDER_VARS= SAMBA4_SERVICES+=mdnsd ############################################################################## MEMORY_DEBUG_IMPLIES= DEBUG MEMORY_DEBUG_CONFIGURE_ENV= ADDITIONAL_CFLAGS="-DENABLE_JEMALLOC `pkg-config --cflags jemalloc`" ADDITIONAL_LDFLAGS="`pkg-config --libs jemalloc`" MEMORY_DEBUG_LIB_DEPENDS= libjemalloc.so.2:devel/jemalloc # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194046 GDB_CMD?= ${LOCALBASE}/bin/gdb # https://bugzilla.samba.org/show_bug.cgi?id=8969 PICKY_DEVELOPER_IMPLIES= DEVELOPER PICKY_DEVELOPER_CONFIGURE_ON= --picky-developer DEVELOPER_CONFIGURE_ON= --enable-developer --enable-selftest --abi-check-disable DEVELOPER_CONFIGURE_ENV= WAF_CMD_FORMAT=string DEVELOPER_BUILD_DEPENDS= ${SAMBA4_LMDB_DEPENDS} \ ${GDB_CMD}:devel/gdb DEVELOPER_RUN_DEPENDS= ${SAMBA4_LMDB_DEPENDS} DEVELOPER_TEST_DEPENDS= ${GDB_CMD}:devel/gdb DEVELOPER_VARS_OFF= GDB_CMD=true ############################################################################## AD_DC_IMPLIES= PYTHON3 AD_DC_CONFIGURE_OFF= --without-ad-dc AD_DC_BUILD_DEPENDS= ${SAMBA4_LMDB_DEPENDS} AD_DC_RUN_DEPENDS= ${SAMBA4_LMDB_DEPENDS} AD_DC_VARS= PLIST+=${PKGDIR}/pkg-plist.ad_dc # samba-tool requires those for *upgrade AD_DC_BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}markdown>=3.3.7:textproc/py-markdown@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}dnspython>=2.2.1:dns/py-dnspython@${PY_FLAVOR} AD_DC_RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}markdown>=3.3.7:textproc/py-markdown@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}dnspython>=2.2.1:dns/py-dnspython@${PY_FLAVOR} ADS_IMPLIES= LDAP ADS_CONFIGURE_WITH= ads CLUSTER_CONFIGURE_WITH= cluster-support CLUSTER_VARS= PLIST+=${PKGDIR}/pkg-plist.cluster CUPS_CONFIGURE_ENABLE= cups iprint CUPS_LIB_DEPENDS= libcups.so:print/cups # https://bugzilla.samba.org/show_bug.cgi?id=9545 FAM_USES= fam FAM_CONFIGURE_WITH= fam GPGME_CONFIGURE_WITH= gpgme GPGME_LIB_DEPENDS= libgpgme.so:security/gpgme GPGME_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}gpgme>=1.14.0:security/py-gpgme@${PY_FLAVOR} GSSAPI_BUILTIN_USES= bison GSSAPI_BUILTIN_BUILD_DEPENDS= p5-JSON>=4.0:converters/p5-JSON GSSAPI_MIT_CONFIGURE_ON= --with-system-mitkrb5 ${GSSAPIBASEDIR} \ --with-system-mitkdc=${GSSAPIBASEDIR}/sbin/krb5kdc \ --with-experimental-mit-ad-dc GSSAPI_MIT_USES= gssapi:mit GSSAPI_HEIMDAL_CONFIGURE_ON= --with-system-heimdalkrb5 ${GSSAPIBASEDIR} GSSAPI_HEIMDAL_USES= gssapi:heimdal GSSAPI_HEIMDAL_PREVENTS= AD_DC GSSAPI_HEIMDAL_PREVENTS_MSG= GSSAPI_HEIMDAL and AD_DC enable conflicting options LDAP_CONFIGURE_WITH= ldap LDAP_CONFIGURE_ON= --with-openldap=${LOCALBASE} LDAP_USES= ldap LDAP_VARS= SAMBA4_MODULES+=idmap_ldap 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 MANDOC_CONFIGURE_ENV_OFF= XSLTPROC="true" 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 # ICU SPOTLIGHT_LIB_DEPENDS= libicuuc.so:devel/icu SPOTLIGHT_USES= bison gnome SPOTLIGHT_USE= gnome=glib20 SYSLOG_CONFIGURE_WITH= syslog UTMP_CONFIGURE_WITH= utmp ############################################################################## .include ############################################################################## .if !${PORT_OPTIONS:MADS} && ${PORT_OPTIONS:MAD_DC} IGNORE=To disable ADS option you also need to disable AD_DC option .endif .if !defined(WANT_EXP_MODULES) || empty(WANT_EXP_MODULES) WANT_EXP_MODULES= vfs_cacheprime .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+= krb5_async_dns_krb5_locator krb5_winbind_krb5_locator 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 .if ${PORT_OPTIONS:MADS} SAMBA4_MODULES+= idmap_ad idmap_rfc2307 nss-info_template \ nss-info_rfc2307 nss-info_sfu nss-info_sfu20 .endif # This kind of special for this distribution SAMBA4_MODULES+= vfs_freebsd SAMBA4_MODULES+= vfs_acl_tdb vfs_acl_xattr vfs_aio_fork vfs_aio_pthread \ vfs_audit vfs_cap vfs_catia vfs_commit vfs_crossrename \ vfs_default_quota vfs_dirsort vfs_expand_msdfs \ vfs_extd_audit vfs_fake_perms vfs_full_audit \ vfs_linux_xfs_sgid vfs_media_harmony vfs_offline \ vfs_preopen vfs_readahead vfs_readonly vfs_recycle \ vfs_shadow_copy vfs_shadow_copy2 vfs_shell_snap \ vfs_streams_depot vfs_streams_xattr vfs_syncops \ vfs_time_audit vfs_unityed_media vfs_virusfilter \ vfs_widelinks vfs_worm vfs_xattr_tdb vfs_zfsacl .if ${PORT_OPTIONS:MDEVELOPER} SAMBA4_MODULES+= auth_skel pdb_test gpext_security gpext_registry \ gpext_scripts perfcount_test vfs_fake_dfq \ vfs_skel_opaque vfs_skel_transparent \ vfs_shadow_copy_test vfs_fake_acls \ vfs_nfs4acl_xattr vfs_error_inject vfs_delay_inject .endif # Python bindings .if ! ${PORT_OPTIONS:MPYTHON3} || defined(NO_PYTHON) USES+= python:build,test CONFIGURE_ARGS+= --disable-python .else USES+= python PLIST+= ${PKGDIR}/pkg-plist.python # Don't cache Python modules CONFIGURE_ARGS+= --nopycache MAKE_ENV+= PYTHONDONTWRITEBYTECODE=1 . if defined(SAMBA4_BUNDLED_TALLOC) && ${SAMBA4_BUNDLED_TALLOC} == yes SAMBA4_BUNDLED_LIBS+= pytalloc-util . else SAMBA4_BUNDLED_LIBS+= !pytalloc-util . endif . if defined(SAMBA4_BUNDLED_TEVENT) && ${SAMBA4_BUNDLED_TEVENT} == yes SAMBA4_BUNDLED_LIBS+= pytevent . else SAMBA4_BUNDLED_LIBS+= !pytevent . endif . if defined(SAMBA4_BUNDLED_TDB) && ${SAMBA4_BUNDLED_TDB} == yes SAMBA4_BUNDLED_LIBS+= pytdb . else SAMBA4_BUNDLED_LIBS+= !pytdb . endif . if defined(SAMBA4_BUNDLED_LDB) && ${SAMBA4_BUNDLED_LDB} == yes SAMBA4_BUNDLED_LIBS+= pyldb pyldb-util . else SAMBA4_BUNDLED_LIBS+= !pyldb !pyldb-util . endif .endif .if defined(WANT_EXP_MODULES) && !empty(WANT_EXP_MODULES) SAMBA4_MODULES+= ${WANT_EXP_MODULES} .endif .if defined(SAMBA4_BUNDLED_LIBS) && !empty(SAMBA4_BUNDLED_LIBS) CONFIGURE_ARGS+= --bundled-libraries="${SAMBA4_BUNDLED_LIBS:Q:C|(\\\\ )+|,|g:S|\\||g}" .endif .if defined(SAMBA4_MODULES) && !empty(SAMBA4_MODULES) CONFIGURE_ARGS+= --with-shared-modules="${SAMBA4_MODULES:C|-|_|:Q:C|(\\\\ )+|,|g:S|\\||g}" .endif # XXX: Hack for nss-info_* -> nss_info/* modules # Add selected modules to the plist .for module in ${SAMBA4_MODULES} PLIST_FILES+= ${SAMBA4_MODULEDIR}/${module:C|_|/|:C|-|_|}.so .endfor .for module_class in ${SAMBA4_MODULES_CLASS} PLIST_DIRS+= ${SAMBA4_MODULEDIR}/${module_class} .endfor PLIST_DIRS+= ${SAMBA4_MODULEDIR} .if defined(WITH_DEBUG) CONFIGURE_ARGS+= --verbose --enable-debug MAKE_ARGS+= --verbose DEBUG_FLAGS?= -g -ggdb3 -O0 .endif ############################################################################## .include ############################################################################## # Only for 64-bit architectures .if ${ARCH} != armv6 && ${ARCH} != armv7 && ${ARCH} != i386 && ${ARCH} != mips && ${ARCH} != powerpc && ${ARCH} != powerpcspe . if defined(SAMBA4_BUNDLED_LDB) && ${SAMBA4_BUNDLED_LDB} == yes && (${PORT_OPTIONS:MAD_DC} || ${PORT_OPTIONS:MDEVELOPER}) # LMDB SAMBA4_LMDB_DEPENDS= lmdb>=0.9.16:databases/lmdb PLIST_FILES+= ${SAMBA4_LIBDIR}/private/libldb-mdb-int-samba4.so \ ${SAMBA4_MODULEDIR}/ldb/mdb.so . endif .endif .if ${PORT_OPTIONS:MGSSAPI_MIT} PLIST_FILES+= ${SAMBA4_MODULEDIR}/krb5/winbind_krb5_localauth.so \ share/man/man8/winbind_krb5_localauth.8.gz . if ${PORT_OPTIONS:MAD_DC} PLIST_FILES+= ${SAMBA4_LIBDIR}/krb5/plugins/kdb/samba.so . endif .endif # for libexecinfo: (so that __builtin_frame_address() finds the top of the stack) CFLAGS_amd64+= -fno-omit-frame-pointer # No fancy color error messages CFLAGS+= ${CFLAGS_${CHOSEN_COMPILER_TYPE}} CFLAGS_clang= -fno-color-diagnostics 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' # Allow rpcgen to find proper CPP MAKE_ENV+= RPCGEN_CPP="${CPP}" #.if ${readline_ARGS} == port #CFLAGS+= -D_FUNCTION_DEF #.endif # Some symbols in samba's linker version scripts are not defined, but since the # scripts are generated dynamically, suppress errors with lld >= 17 due to these # undefined symbols. LDFLAGS+= -Wl,--undefined-version SAMBA4_SUB= SAMBA4_LOGDIR="${SAMBA4_LOGDIR}" \ SAMBA4_RUNDIR="${SAMBA4_RUNDIR}" \ SAMBA4_LOCKDIR="${SAMBA4_LOCKDIR}" \ SAMBA4_LIBDIR="${SAMBA4_LIBDIR}" \ SAMBA4_MODULEDIR="${SAMBA4_MODULEDIR}" \ SAMBA4_BINDDNSDIR="${SAMBA4_BINDDNSDIR}" \ SAMBA4_PRIVATEDIR="${SAMBA4_PRIVATEDIR}" \ SAMBA4_CONFDIR="${SAMBA4_CONFDIR}" \ SAMBA4_CONFIG="${SAMBA4_CONFIG}" \ SAMBA4_SERVICES="${SAMBA4_SERVICES}" PLIST_SUB+= ${SAMBA4_SUB} SUB_LIST+= ${SAMBA4_SUB} USE_RC_SUBR= samba_server SUB_FILES= pkg-message README.FreeBSD PORTDOCS= README.FreeBSD post-extract: @${RM} -r ${WRKSRC}/pidl/lib/Parse/Yapp post-patch: @${REINPLACE_CMD} -e 's|$${PKGCONFIGDIR}|${PKGCONFIGDIR}|g' \ ${PATCH_WRKSRC}/buildtools/wafsamba/pkgconfig.py @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \ ${PATCH_WRKSRC}/buildtools/wafsamba/wafsamba.py @${REINPLACE_CMD} -e 's|%%GDB_CMD%%|${GDB_CMD}|g' \ ${PATCH_WRKSRC}/buildtools/scripts/abi_gen.sh @${REINPLACE_CMD} -e 's|%%SAMBA4_CONFIG%%|${SAMBA4_CONFIG}|g' \ ${PATCH_WRKSRC}/dynconfig/wscript # Use threading (or multiprocessing) but not thread (renamed in python 3+). pre-configure: .if (!${PORT_OPTIONS:MPYTHON3} || defined(NO_PYTHON)) && ${PORT_OPTIONS:MAD_DC} @${ECHO_CMD}; \ ${ECHO_MSG} "===> AD_DC option requires PYTHON3 to be set"; \ ${ECHO_CMD}; \ ${FALSE} .endif 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 \ source4/lib/registry/man/regpatch.1 \ source4/lib/registry/man/regshell.1 \ source4/lib/registry/man/regtree.1 \ source4/scripting/man/samba-gpupdate.8 \ source4/torture/man/gentest.1 \ source4/torture/man/locktest.1 \ source4/torture/man/masktest.1 \ source4/torture/man/smbtorture.1 \ source4/utils/man/ntlm_auth4.1 \ source4/utils/oLschema2ldif/oLschema2ldif.1 \ lib/tdb/man/tdbdump.8 \ lib/tdb/man/tdbbackup.8 \ lib/tdb/man/tdbtool.8 \ lib/talloc/man/talloc.3 \ lib/tdb/man/tdbrestore.8 \ lib/ldb/man/ldb.3 \ lib/ldb/man/ldbadd.1 \ lib/ldb/man/ldbdel.1 \ lib/ldb/man/ldbedit.1 \ lib/ldb/man/ldbmodify.1 \ lib/ldb/man/ldbrename.1 \ lib/ldb/man/ldbsearch.1 \ docs-xml/manpages/vfs_freebsd.8 ${MKDIR} `dirname ${BUILD_WRKSRC}/bin/default/${man}` ${INSTALL_MAN} ${FILESDIR}/man/`basename ${man}` ${BUILD_WRKSRC}/bin/default/${man} .endfor .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 \ ctdb.conf.5 ctdb.sysconfig.5 ctdb-script.options.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: ${RM} -r ${STAGEDIR}${PYTHON_SITELIBDIR}/samba/third_party ${FIND} ${STAGEDIR}${PYTHON_SITELIBDIR} -name __pycache__ \ -type d -print0 | ${XARGS} -0 -n 1 -t ${RM} -r ${FIND} ${STAGEDIR} -type f -empty -delete post-install-fix-manpages: .for f in vfs_aio_linux.8 vfs_btrfs.8 vfs_ceph.8 vfs_gpfs.8 ${RM} ${STAGEDIR}${PREFIX}/share/man/man8/${f} .endfor .if defined(SAMBA4_BUNDLED_LDB) && ${SAMBA4_BUNDLED_LDB} == yes . for f in ldbadd.1 ldbdel.1 ldbedit.1 ldbmodify.1 ldbrename.1 ldbsearch.1 ${MV} ${STAGEDIR}${PREFIX}/share/man/man1/${f} ${STAGEDIR}${PREFIX}/share/man/man1/samba-${f} . endfor .endif .if defined(SAMBA4_BUNDLED_TALLOC) && ${SAMBA4_BUNDLED_TALLOC} == yes . for f in talloc.3 ${MV} ${STAGEDIR}${PREFIX}/share/man/man3/${f} ${STAGEDIR}${PREFIX}/share/man/man3/samba-${f} . endfor .endif .if defined(SAMBA4_BUNDLED_TDB) && ${SAMBA4_BUNDLED_TDB} == yes . for f in tdbbackup.8 tdbdump.8 tdbrestore.8 tdbtool.8 ${MV} ${STAGEDIR}${PREFIX}/share/man/man8/${f} ${STAGEDIR}${PREFIX}/share/man/man8/samba-${f} . endfor .endif post-install: post-install-rm-junk post-install-fix-manpages ${LN} -sf smb.conf.5.gz ${STAGEDIR}${PREFIX}/share/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 0750 "${STAGEDIR}${SAMBA4_BINDDNSDIR}" ${INSTALL} -d -m 0750 "${STAGEDIR}${SAMBA4_PRIVATEDIR}" .for module_class in ${SAMBA4_MODULES_CLASS} ${INSTALL} -d -m 0755 "${STAGEDIR}${SAMBA4_MODULEDIR}/${module_class}" .endfor .if !defined(WITH_DEBUG) -${FIND} ${STAGEDIR}${PREFIX}/bin ${STAGEDIR}${PREFIX}/sbin ${STAGEDIR}${PREFIX}/libexec \ -type f -print0 | ${XARGS} -0 -n 1 -t ${STRIP_CMD} -${FIND} ${STAGEDIR}${PREFIX}/lib -name '*.so*' \ -type f -print0 | ${XARGS} -0 -n 1 -t ${STRIP_CMD} .endif post-install-FRUIT-off: ${RM} ${STAGEDIR}${SAMBA4_MODULEDIR}/vfs/fruit.so ${RM} ${STAGEDIR}${PREFIX}/share/man/man8/vfs_fruit.8 post-install-DOCS-on: ${MKDIR} ${STAGEDIR}${DOCSDIR} .for doc in ${PORTDOCS} ${INSTALL_DATA} ${WRKDIR}/${doc} ${STAGEDIR}${DOCSDIR} .endfor post-install-CLUSTER-on: ${LN} -nfs ../../../../share/ctdb/events/legacy/00.ctdb.script ${STAGEDIR}${PREFIX}/etc/ctdb/events/legacy/00.ctdb.script ${LN} -nfs ../../../../share/ctdb/events/legacy/10.interface.script ${STAGEDIR}${PREFIX}/etc/ctdb/events/legacy/10.interface.script ${LN} -nfs ../../../../share/ctdb/events/legacy/05.system.script ${STAGEDIR}${PREFIX}/etc/ctdb/events/legacy/05.system.script ${LN} -nfs ../../../../share/ctdb/events/legacy/01.reclock.script ${STAGEDIR}${PREFIX}/etc/ctdb/events/legacy/01.reclock.script .include diff --git a/net/samba419/files/0100-Fix-pathref-handling-for-FreeBSD-13plus.patch b/net/samba419/files/0100-Fix-pathref-handling-for-FreeBSD-13plus.patch index 6a8492d89401..3289c0026304 100644 --- a/net/samba419/files/0100-Fix-pathref-handling-for-FreeBSD-13plus.patch +++ b/net/samba419/files/0100-Fix-pathref-handling-for-FreeBSD-13plus.patch @@ -1,485 +1,193 @@ https://bugzilla.samba.org/show_bug.cgi?id=15376 ---- source3/smbd/open.c 2023-04-19 12:18:56.254875400 +0200 -+++ source3/smbd/open.c 2023-06-20 08:29:06.210298000 +0200 -@@ -1204,9 +1204,6 @@ - int new_fd; - NTSTATUS status; - -- if (!fsp->fsp_flags.have_proc_fds) { -- return NT_STATUS_MORE_PROCESSING_REQUIRED; -- } - - old_fd = fsp_get_pathref_fd(fsp); - if (old_fd == -1) { -@@ -1222,22 +1219,28 @@ - return NT_STATUS_INVALID_HANDLE; - } - -- p = sys_proc_fd_path(old_fd, buf, sizeof(buf)); -- if (p == NULL) { -- return NT_STATUS_NO_MEMORY; -- } -+ -+ if (sys_open_real_fd_from_pathref_fd(old_fd, &new_fd, flags) != 0) { -+ if (!fsp->fsp_flags.have_proc_fds) { -+ return NT_STATUS_MORE_PROCESSING_REQUIRED; -+ } - -- proc_fname = (struct smb_filename) { -- .base_name = discard_const_p(char, p), -- }; -+ p = sys_proc_fd_path(old_fd, buf, sizeof(buf)); -+ if (p == NULL) { -+ return NT_STATUS_NO_MEMORY; -+ } - -- fsp->fsp_flags.is_pathref = false; -+ proc_fname = (struct smb_filename) { -+ .base_name = discard_const_p(char, p), -+ }; - -- new_fd = SMB_VFS_OPENAT(fsp->conn, -- fsp->conn->cwd_fsp, -- &proc_fname, -- fsp, -- &how); -+ new_fd = SMB_VFS_OPENAT(fsp->conn, -+ fsp->conn->cwd_fsp, -+ &proc_fname, -+ fsp, -+ &how); -+ } -+ - if (new_fd == -1) { - status = map_nt_error_from_unix(errno); - fd_close(fsp); -@@ -1250,6 +1260,8 @@ - } - - fsp_set_fd(fsp, new_fd); -+ fsp->fsp_flags.is_pathref = false; -+ - return NT_STATUS_OK; - } - --- source3/lib/system.c 2023-01-18 16:32:24.174553200 +0100 +++ source3/lib/system.c 2023-06-19 23:35:30.132465000 +0200 @@ -1022,6 +1022,8 @@ } proc_fd_patterns[] = { /* Linux */ { "/proc/self/fd/%d", "/proc/self/fd/0" }, + /* FreeBSD */ + { "/var/run/samba4/fd/%d", "/var/run/samba4/fd/0" }, { NULL, NULL }, }; -@@ -1077,4 +1079,27 @@ - } - - return buf; -+} -+ -+ -+/* Helper function that opens a usable fd for accessing data -+ (metadata & content) from a pathref fd */ -+int sys_open_real_fd_from_pathref_fd(int fd, -+ int *rfd, -+ int flags) { -+ int tfd; -+ -+#if defined(HAVE_OPENAT) && defined(O_EMPTY_PATH) -+ /* This works for FreeBSD 13+ atleast */ -+ -+ tfd = openat(fd, "", O_EMPTY_PATH|flags); -+ if (tfd < 0) { -+ return errno; -+ } -+ -+ *rfd = tfd; -+ return 0; -+#else -+ return ENOSYS; -+#endif - } ---- source3/modules/vfs_default.c 2023-05-31 18:06:44.154299500 +0200 -+++ source3/modules/vfs_default.c 2023-06-19 23:23:58.116903000 +0200 -@@ -2721,7 +2721,7 @@ - - static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) - { -- int result; -+ int result, fd, real_fd; - - START_PROFILE(syscall_fchmod); - -@@ -2731,8 +2731,9 @@ - return result; - } - -+ fd = fsp_get_pathref_fd(fsp); -+ - if (fsp->fsp_flags.have_proc_fds) { -- int fd = fsp_get_pathref_fd(fsp); - const char *p = NULL; - char buf[PATH_MAX]; - -@@ -2746,6 +2747,17 @@ - return result; - } - -+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { -+ int saved_errno; -+ -+ result = fchmod(real_fd, mode); -+ saved_errno = errno; -+ close(real_fd); -+ errno = saved_errno; -+ END_PROFILE(syscall_fchmod); -+ return result; -+ } -+ - /* - * This is no longer a handle based call. - */ -@@ -2758,7 +2770,7 @@ - static int vfswrap_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid) - { - #ifdef HAVE_FCHOWN -- int result; -+ int result, fd, real_fd; - - START_PROFILE(syscall_fchown); - if (!fsp->fsp_flags.is_pathref) { -@@ -2767,8 +2779,9 @@ - return result; - } - -+ fd = fsp_get_pathref_fd(fsp); -+ - if (fsp->fsp_flags.have_proc_fds) { -- int fd = fsp_get_pathref_fd(fsp); - const char *p = NULL; - char buf[PATH_MAX]; - -@@ -2782,6 +2795,17 @@ - return result; - } - -+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { -+ int saved_errno; -+ -+ result = fchown(real_fd, uid, gid); -+ saved_errno = errno; -+ close(real_fd); -+ errno = saved_errno; -+ END_PROFILE(syscall_fchown); -+ return result; -+ } -+ - /* - * This is no longer a handle based call. - */ -@@ -2855,7 +2879,7 @@ - files_struct *fsp, - struct smb_file_time *ft) - { -- int result = -1; -+ int result = -1, fd, real_fd; - struct timespec ts[2]; - struct timespec *times = NULL; - -@@ -2900,8 +2924,9 @@ - goto out; - } - -+ fd = fsp_get_pathref_fd(fsp); -+ - if (fsp->fsp_flags.have_proc_fds) { -- int fd = fsp_get_pathref_fd(fsp); - const char *p = NULL; - char buf[PATH_MAX]; - -@@ -2919,6 +2944,16 @@ - goto out; - } - -+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { -+ int saved_errno; -+ -+ result = futimens(real_fd, times); -+ saved_errno = errno; -+ close(real_fd); -+ errno = saved_errno; -+ goto out; -+ } -+ - /* - * The fd is a pathref (opened with O_PATH) and there isn't fd to - * path translation mechanism. Fallback to path based call. -@@ -3322,6 +3357,7 @@ - { - #ifdef HAVE_FCHFLAGS - int fd = fsp_get_pathref_fd(fsp); -+ int real_fd; - - SMB_ASSERT(!fsp_is_alternate_stream(fsp)); - -@@ -3341,6 +3377,16 @@ - return chflags(p, flags); - } - -+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { -+ int saved_errno, result; -+ -+ result = fchflags(real_fd, flags); -+ saved_errno = errno; -+ close(real_fd); -+ errno = saved_errno; -+ return result; -+ } -+ - /* - * This is no longer a handle based call. - */ -@@ -3569,6 +3615,7 @@ - size_t size) - { - int fd = fsp_get_pathref_fd(fsp); -+ int real_fd; - - SMB_ASSERT(!fsp_is_alternate_stream(fsp)); - -@@ -3588,6 +3635,16 @@ - return getxattr(p, name, value, size); - } - -+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { -+ int saved_errno, result; -+ -+ result = fgetxattr(real_fd, name, value, size); -+ saved_errno = errno; -+ close(real_fd); -+ errno = saved_errno; -+ return result; -+ } -+ - /* - * This is no longer a handle based call. - */ -@@ -3895,6 +3952,7 @@ - static ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size) - { - int fd = fsp_get_pathref_fd(fsp); -+ int real_fd; - - SMB_ASSERT(!fsp_is_alternate_stream(fsp)); - -@@ -3914,6 +3972,16 @@ - return listxattr(p, list, size); - } - -+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { -+ int saved_errno, result; -+ -+ result = flistxattr(real_fd, list, size); -+ saved_errno = errno; -+ close(real_fd); -+ errno = saved_errno; -+ return result; -+ } -+ - /* - * This is no longer a handle based call. - */ -@@ -3923,6 +3991,7 @@ - static int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name) - { - int fd = fsp_get_pathref_fd(fsp); -+ int real_fd; - - SMB_ASSERT(!fsp_is_alternate_stream(fsp)); - -@@ -3942,6 +4011,16 @@ - return removexattr(p, name); - } - -+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { -+ int saved_errno, result; -+ -+ result = fremovexattr(real_fd, name); -+ saved_errno = errno; -+ close(real_fd); -+ errno = saved_errno; -+ return result; -+ } -+ - /* - * This is no longer a handle based call. - */ -@@ -3951,6 +4030,7 @@ - static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) - { - int fd = fsp_get_pathref_fd(fsp); -+ int real_fd; - - SMB_ASSERT(!fsp_is_alternate_stream(fsp)); - -@@ -3968,6 +4048,16 @@ - } - - return setxattr(p, name, value, size, flags); -+ } -+ -+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { -+ int saved_errno, result; -+ -+ result = fsetxattr(real_fd, name, value, size, flags); -+ saved_errno = errno; -+ close(real_fd); -+ errno = saved_errno; -+ return result; - } - - /* ---- source3/modules/vfs_zfsacl.c 2023-01-18 16:32:24.210553400 +0100 -+++ source3/modules/vfs_zfsacl.c 2023-06-20 08:51:53.077953000 +0200 -@@ -234,13 +234,39 @@ +--- source3/modules/vfs_zfsacl.c 2023-11-27 13:09:10.612012900 +0100 ++++ source3/modules/vfs_zfsacl.c 2025-01-07 18:53:05.292522000 +0100 +@@ -169,6 +169,7 @@ + bool must_add_empty_ace = false; + struct zfsacl_config_data *config = NULL; + int fd; ++ char buf[PATH_MAX]; + SMB_VFS_HANDLE_GET_DATA(handle, config, + struct zfsacl_config_data, +@@ -235,22 +236,49 @@ SMB_ASSERT(i == naces); -- /* store acl */ + /* store acl */ - fd = fsp_get_pathref_fd(fsp); - if (fd == -1) { -- errno = EBADF; -- return false; + if (!fsp->fsp_flags.is_pathref) { -+ rv = facl(fsp_get_io_fd(fsp), ACE_SETACL, naces, acebuf); -+ } else { -+ const char *procfd_p = NULL; -+ char buf[PATH_MAX]; -+ -+ fd = fsp_get_pathref_fd(fsp); -+ if (fsp->fsp_flags.have_proc_fds && (procfd_p = sys_proc_fd_path(fd, buf, sizeof(buf)))) { -+ rv = acl(procfd_p, ACE_SETACL, naces, acebuf); -+ } else { -+ int real_fd; -+ -+ fd = fsp_get_pathref_fd(fsp); -+ -+ /* First try this for versions of FreeBSD 13+ that allows facl() on O_PATH fd's */ -+ rv = facl(fd, ACE_SETACL, naces, acebuf); -+ -+ if (rv < 0 && errno == EBADF && -+ sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { -+ /* Works on FreeBSD 13+ */ -+ int saved_errno; -+ -+ rv = facl(real_fd, ACE_SETACL, naces, acebuf); -+ saved_errno = errno; -+ close(real_fd); -+ errno = saved_errno; -+ } else { -+ /* Last ditch fallback */ -+ rv = acl(fsp->fsp_name->base_name, ACE_SETACL, naces, acebuf); -+ } -+ } - } ++ fd = fsp_get_io_fd(fsp); ++ ++ rv = facl(fd, ACE_SETACL, naces, acebuf); ++ if (rv != 0) { ++ DEBUG(8, ("zfs_process_smbacl(%s): Not PATHREF: facl(ACE_SETACL, %d): %s\n", ++ fsp_str_dbg(fsp), naces, ++ strerror(errno))); ++ return false; ++ } ++ DEBUG(10, ("zfs_process_smbacl(%s): Not PATHREF: facl(ACE_SETACL, %d) -> %d\n", ++ fsp_str_dbg(fsp), naces, ++ rv)); ++ ++ } else if (fsp->fsp_flags.have_proc_fds) { ++ fd = fsp_get_pathref_fd(fsp); ++ if (fd == -1) { ++ DEBUG(8, ("zfs_process_smbacl(%s): PATHREF(proc_fd): fsp_get_pathref_fd=-1: %s\n", ++ fsp_str_dbg(fsp), strerror(errno))); + errno = EBADF; + return false; +- } - rv = facl(fd, ACE_SETACL, naces, acebuf); -+ - if (rv != 0) { - if(errno == ENOSYS) { - DEBUG(9, ("acl(ACE_SETACL, %s): Operation is not " -@@ -284,14 +310,39 @@ +- if (rv != 0) { +- if(errno == ENOSYS) { +- DEBUG(9, ("acl(ACE_SETACL, %s): Operation is not " +- "supported on the filesystem where the file " +- "reside", fsp_str_dbg(fsp))); +- } else { +- DEBUG(9, ("acl(ACE_SETACL, %s): %s ", fsp_str_dbg(fsp), +- strerror(errno))); +- } ++ } ++ rv = acl(sys_proc_fd_path(fd, buf, sizeof(buf)), ACE_SETACL, naces, acebuf); ++ if (rv != 0) { ++ DEBUG(8, ("zfs_process_smbacl(%s): acl(ACE_SETACL, %d): %s\n", ++ fsp_str_dbg(fsp), naces, ++ strerror(errno))); + return false; ++ } ++ DEBUG(10, ("zfs_process_smbacl(%s): PATHREF(proc_fd): acl(ACE_SETACL, %d) -> %d\n", ++ fsp_str_dbg(fsp), naces, ++ rv)); ++ } else { ++ rv = acl(fsp->fsp_name->base_name, ACE_SETACL, naces, acebuf); ++ if (rv != 0) { ++ DEBUG(8, ("zfs_process_smbacl(%s): PATHREF(base_name): acl(ACE_SETACL, %d): %s\n", ++ fsp_str_dbg(fsp), naces, ++ strerror(errno))); ++ return false; ++ } ++ DEBUG(10, ("zfs_process_smbacl(%s): PATHREF(base_name): facl(ACE_SETACL, %d) -> %d\n", ++ fsp_str_dbg(fsp), naces, ++ rv)); + } + + return True; +@@ -282,25 +310,48 @@ + struct files_struct *fsp, + ace_t **outbuf) { - int naces, rv; +- int naces, rv; ++ int naces, rv = -1, fd = -1; ace_t *acebuf = NULL; - int fd; -+ int fd = -1; -+ const char *procfd_p = NULL; -+ char buf[PATH_MAX]; - fd = fsp_get_pathref_fd(fsp); - if (fd == -1) { -- errno = EBADF; -- return -1; -+ if (!fsp->fsp_flags.is_pathref) { -+ naces = facl(fsp_get_io_fd(fsp), ACE_GETACLCNT, 0, NULL); -+ } else { -+ fd = fsp_get_pathref_fd(fsp); -+ -+ if (fsp->fsp_flags.have_proc_fds && (procfd_p = sys_proc_fd_path(fd, buf, sizeof(buf)))) { -+ /* If we have procfd support, try this first */ -+ naces = acl(procfd_p, ACE_GETACLCNT, 0, NULL); -+ } else { -+ int real_fd; + -+ /* First try this for versions of FreeBSD 13+ that allows facl() on O_PATH fd's */ -+ naces = facl(fd, ACE_GETACLCNT, 0, NULL); -+ if (naces < 0 && errno == EBADF && -+ sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { -+ /* Works on FreeBSD 13+ */ -+ int saved_errno; ++ char buf[PATH_MAX]; + -+ naces = facl(real_fd, ACE_GETACLCNT, 0, NULL); -+ saved_errno = errno; -+ close(real_fd); -+ errno = saved_errno; -+ } else { -+ /* Last ditch fallback */ -+ naces = acl(fsp->fsp_name->base_name, ACE_GETACLCNT, 0, NULL); -+ } -+ } - } -- naces = facl(fd, ACE_GETACLCNT, 0, NULL); + - if (naces == -1) { - int dbg_level = 10; ++ if (!fsp->fsp_flags.is_pathref) { ++ fd = fsp_get_io_fd(fsp); ++ if (fd == -1) { ++ DEBUG(8, ("fget_zfsacl(%s): Not PATHREF: fsp_get_io_fd=-1: %s\n", ++ fsp_str_dbg(fsp), strerror(errno))); + errno = EBADF; + return -1; +- } +- naces = facl(fd, ACE_GETACLCNT, 0, NULL); +- if (naces == -1) { +- int dbg_level = 10; +- +- if (errno == ENOSYS) { +- dbg_level = 1; +- } +- DEBUG(dbg_level, ("facl(ACE_GETACLCNT, %s): %s ", ++ } ++ naces = facl(fd, ACE_GETACLCNT, 0, NULL); ++ if (naces == -1) { ++ DEBUG(8, ("fget_zfsacl(%s): Not PATHREF: facl(ACE_GETACLCNT): %s\n", ++ fsp_str_dbg(fsp), strerror(errno))); ++ return -1; ++ } ++ } else if (fsp->fsp_flags.have_proc_fds) { ++ fd = fsp_get_pathref_fd(fsp); ++ if (fd == -1) { ++ DEBUG(8, ("fget_zfsacl(%s): PATHREF(proc_fd): fsp_get_pathref_fd=-1: %s\n", ++ fsp_str_dbg(fsp), strerror(errno))); ++ errno = EBADF; ++ return -1; ++ } ++ naces = acl(sys_proc_fd_path(fd, buf, sizeof(buf)), ACE_GETACLCNT, 0, NULL); ++ if (naces == -1) { ++ DEBUG(8, ("fget_zfsacl(%s): PATHREF(proc_fd): acl(ACE_GETACLCNT): %s\n", + fsp_str_dbg(fsp), strerror(errno))); +- return naces; ++ return -1; ++ } ++ } else { ++ naces = acl(fsp->fsp_name->base_name, ACE_GETACLCNT, 0, NULL); ++ if (naces == -1) { ++ DEBUG(8, ("fget_zfsacl(%s): PATHREF(base_name): acl(ACE_GETACLCNT): %s\n", ++ fsp_str_dbg(fsp), strerror(errno))); ++ return -1; ++ } + } -@@ -309,7 +360,32 @@ + acebuf = talloc_size(mem_ctx, sizeof(ace_t)*naces); +@@ -309,15 +360,37 @@ return -1; } - rv = facl(fd, ACE_GETACL, naces, acebuf); +- if (rv == -1) { +- DBG_DEBUG("acl(ACE_GETACL, %s): %s ", +- fsp_str_dbg(fsp), strerror(errno)); + if (!fsp->fsp_flags.is_pathref) { -+ rv = facl(fsp_get_io_fd(fsp), ACE_GETACL, naces, acebuf); ++ rv = facl(fd, ACE_GETACL, naces, acebuf); ++ if (rv == -1) { ++ DEBUG(8, ("fget_zfsacl(%s): Not PATHREF: facl(ACE_GETACL): %s\n", ++ fsp_str_dbg(fsp), strerror(errno))); + return -1; ++ } ++ DEBUG(10, ("fget_zfsacl(%s): Not PATHREF: facl(ACE_GETACL) -> %d entries\n", ++ fsp_str_dbg(fsp), rv)); ++ } else if (fsp->fsp_flags.have_proc_fds) { ++ rv = acl(sys_proc_fd_path(fd, buf, sizeof(buf)), ACE_GETACL, naces, acebuf); ++ if (rv == -1) { ++ DEBUG(8, ("fget_zfsacl(%s): PATHREF(proc_fd): acl(ACE_GETACL): %s\n", ++ fsp_str_dbg(fsp), strerror(errno))); ++ return -1; ++ } ++ DEBUG(10, ("fget_zfsacl(%s): PATHREF(proc_fd): acl(ACE_GETACL) -> %d entries\n", ++ fsp_str_dbg(fsp), rv)); + } else { -+ if (procfd_p) { -+ rv = acl(procfd_p, ACE_GETACL, naces, acebuf); -+ } else { -+ int real_fd; -+ -+ /* First try this for versions of FreeBSD that allows facl() on O_PATH fd's */ -+ rv = facl(fd, ACE_GETACL, naces, acebuf); -+ if (rv < 0 && errno == EBADF && -+ sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { -+ /* Works on FreeBSD 13+ */ -+ int saved_errno; -+ -+ rv = facl(real_fd, ACE_GETACL, naces, acebuf); -+ saved_errno = errno; -+ close(real_fd); -+ errno = saved_errno; -+ } else { -+ /* Last ditch fallback */ -+ rv = acl(fsp->fsp_name->base_name, ACE_GETACL, naces, acebuf); -+ } -+ } -+ } -+ - if (rv == -1) { - DBG_DEBUG("acl(ACE_GETACL, %s): %s ", - fsp_str_dbg(fsp), strerror(errno)); ---- source3/include/proto.h 2023-05-31 18:06:44.142299400 +0200 -+++ source3/include/proto.h 2023-06-19 23:23:58.115127000 +0200 -@@ -211,6 +211,10 @@ - bool sys_have_proc_fds(void); - const char *sys_proc_fd_path(int fd, char *buf, size_t bufsize); ++ rv = acl(fsp->fsp_name->base_name, ACE_GETACL, naces, acebuf); ++ if (rv == -1) { ++ DEBUG(8, ("fget_zfsacl(%s): PATHREF(base_name): acl(ACE_GETACL): %s\n", ++ fsp_str_dbg(fsp), strerror(errno))); ++ return -1; ++ } ++ DEBUG(10, ("fget_zfsacl(%s): PATHREF(base_name): acl(ACE_GETACL) -> %d entries\n", ++ fsp_str_dbg(fsp), rv)); + } +- ++ + *outbuf = acebuf; +- return naces; ++ return rv; + } -+int sys_open_real_fd_from_pathref_fd(int fd, -+ int *mfd, -+ int flags); -+ - struct stat; - void init_stat_ex_from_stat (struct stat_ex *dst, - const struct stat *src, + static NTSTATUS zfsacl_fget_nt_acl(struct vfs_handle_struct *handle,