--- source3/param/loadparm.c.orig 2020-03-11 07:17:30.827605000 -0300 +++ source3/param/loadparm.c 2020-03-11 07:20:28.867874000 -0300 @@ -2742,6 +2742,13 @@ if (!vfs_objects || !vfs_objects[0]) { if (lp_parm_const_string(-1, "xattr_tdb", "file", NULL)) { lp_do_parameter(-1, "vfs objects", "dfs_samba4 acl_xattr xattr_tdb"); + /* + * By default, the samba sysvol is located in the statedir. Provisioning will fail in setntacl + * unless we have zfacl enabled. Unfortunately, at this point the smb.conf has not been generated. + * This workaround is freebsd-specific. + */ + } else if (pathconf(get_dyn_STATEDIR(), _PC_ACL_NFS4) == 1){ + lp_do_parameter(-1, "vfs objects", "dfs_samba4 zfsacl"); } else if (lp_parm_const_string(-1, "posix", "eadb", NULL)) { lp_do_parameter(-1, "vfs objects", "dfs_samba4 acl_xattr posix_eadb"); } else {