diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/samba46/Makefile | 2 | ||||
-rw-r--r-- | net/samba46/distinfo | 6 | ||||
-rw-r--r-- | net/samba47/Makefile | 12 | ||||
-rw-r--r-- | net/samba47/distinfo | 6 | ||||
-rw-r--r-- | net/samba47/files/0001-Zfs-provision-1.patch | 7 | ||||
-rw-r--r-- | net/samba47/files/patch-dbwrap | 96 | ||||
-rw-r--r-- | net/samba47/files/patch-source3__modules__wscript_build | 15 | ||||
-rw-r--r-- | net/samba47/files/patch-vfs_freebsd.c | 1785 | ||||
-rw-r--r-- | net/samba47/files/samba_server.in | 7 |
9 files changed, 1914 insertions, 22 deletions
diff --git a/net/samba46/Makefile b/net/samba46/Makefile index fbf4152856c9..f35525cfeb19 100644 --- a/net/samba46/Makefile +++ b/net/samba46/Makefile @@ -21,7 +21,7 @@ CONFLICTS_INSTALL?= samba4-4.0.* samba4[1-57-9]-4.* p5-Parse-Pidl-4.* SAMBA4_BASENAME= samba SAMBA4_PORTNAME= ${SAMBA4_BASENAME}4 -SAMBA4_VERSION= 4.6.14 +SAMBA4_VERSION= 4.6.15 SAMBA4_DISTNAME= ${SAMBA4_BASENAME}-${SAMBA4_VERSION:S|.p|pre|:S|.r|rc|:S|.t|tp|:S|.a|alpha|} WRKSRC?= ${WRKDIR}/${DISTNAME} diff --git a/net/samba46/distinfo b/net/samba46/distinfo index b437ea65ce33..1596d9fa0e7e 100644 --- a/net/samba46/distinfo +++ b/net/samba46/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1520935711 -SHA256 (samba-4.6.14.tar.gz) = 673f459f9e423f3893b017c86343df1e65d57571c949fe030fcffdcc05b8de47 -SIZE (samba-4.6.14.tar.gz) = 21161954 +TIMESTAMP = 1526084366 +SHA256 (samba-4.6.15.tar.gz) = 72f66dbefd08807d2f1bacdbbb1398a03536c3fc640deec6a3b91e7308b30772 +SIZE (samba-4.6.15.tar.gz) = 21175479 diff --git a/net/samba47/Makefile b/net/samba47/Makefile index 72373ab6b626..6c69a5670c3d 100644 --- a/net/samba47/Makefile +++ b/net/samba47/Makefile @@ -22,7 +22,7 @@ EXTRA_PATCHES+= ${PATCHDIR}/0001-Freenas-master-mdns-fixes-22.patch:-p1 SAMBA4_BASENAME= samba SAMBA4_PORTNAME= ${SAMBA4_BASENAME}4 -SAMBA4_VERSION= 4.7.6 +SAMBA4_VERSION= 4.7.7 SAMBA4_DISTNAME= ${SAMBA4_BASENAME}-${SAMBA4_VERSION:S|.p|pre|:S|.r|rc|:S|.t|tp|:S|.a|alpha|} WRKSRC?= ${WRKDIR}/${DISTNAME} @@ -350,7 +350,7 @@ LIB_DEPENDS+= libdbus-1.so:devel/dbus LIB_DEPENDS+= libdbus-glib-1.so:devel/dbus-glib .endif -#SAMBA4_MODULES+= vfs_freebsd +SAMBA4_MODULES+= vfs_freebsd 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 @@ -412,10 +412,10 @@ BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}iso8601>=0.1.11:devel/py-iso8601@${PY_F 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 defined(WITH_SAMBA4_PYTHON3) && ${WITH_SAMBA4_PYTHON3:M3\.[0-9]} +SAMBA4_PYTHON3_VERSION= ${WITH_SAMBA4_PYTHON3} +SAMBA4_PYTHON3= python${SAMBA4_PYTHON3_VERSION} +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 diff --git a/net/samba47/distinfo b/net/samba47/distinfo index bbd1592f9086..ac853628c8b8 100644 --- a/net/samba47/distinfo +++ b/net/samba47/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1520935629 -SHA256 (samba-4.7.6.tar.gz) = 1eede30fc8ef6504e24602fb72b00baa0a7b73b59f16d25cb0771dc8c7c57d6e -SIZE (samba-4.7.6.tar.gz) = 16864824 +TIMESTAMP = 1525222693 +SHA256 (samba-4.7.7.tar.gz) = 29fad16fa70c1342c300d28d1b474b04c01a2a650149e94cace36fcbace80131 +SIZE (samba-4.7.7.tar.gz) = 16875059 diff --git a/net/samba47/files/0001-Zfs-provision-1.patch b/net/samba47/files/0001-Zfs-provision-1.patch index b6250bb750f7..12f9ac9f394a 100644 --- a/net/samba47/files/0001-Zfs-provision-1.patch +++ b/net/samba47/files/0001-Zfs-provision-1.patch @@ -26,16 +26,15 @@ diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init_ 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, +@@ -1556,19 +1556,24 @@ 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_acl ++ if smbd.has_nfsv4_acls(sysvol_dir): + set_simple_acl = smbd.set_simple_nfsv4_acl + + file = tempfile.NamedTemporaryFile(dir=sysvol_dir) diff --git a/net/samba47/files/patch-dbwrap b/net/samba47/files/patch-dbwrap new file mode 100644 index 000000000000..619cf53681f5 --- /dev/null +++ b/net/samba47/files/patch-dbwrap @@ -0,0 +1,96 @@ +--- lib/dbwrap/dbwrap.c.orig 2018-01-17 10:08:39 UTC ++++ lib/dbwrap/dbwrap.c +@@ -28,6 +28,9 @@ + #include "lib/util/util_tdb.h" + #include "lib/util/tevent_ntstatus.h" + ++#undef DBGC_CLASS ++#define DBGC_CLASS DBGC_LOCKING ++ + /* + * Fall back using fetch if no genuine exists operation is provided + */ +--- lib/dbwrap/dbwrap_local_open.c.orig 2018-01-14 21:41:58.000000000 +0100 ++++ lib/dbwrap/dbwrap_local_open.c 2018-03-29 23:49:51.888588000 +0200 +@@ -24,6 +24,9 @@ + #include "tdb.h" + #include "lib/param/param.h" + ++#undef DBGC_CLASS ++#define DBGC_CLASS DBGC_LOCKING ++ + struct db_context *dbwrap_local_open(TALLOC_CTX *mem_ctx, + struct loadparm_context *lp_ctx, + const char *name, +--- lib/dbwrap/dbwrap_rbt.c.orig 2018-01-17 09:08:39.000000000 +0100 ++++ lib/dbwrap/dbwrap_rbt.c 2018-03-29 23:50:13.427755000 +0200 +@@ -24,6 +24,9 @@ + #include "../lib/util/rbtree.h" + #include "../lib/util/dlinklist.h" + ++#undef DBGC_CLASS ++#define DBGC_CLASS DBGC_LOCKING ++ + #define DBWRAP_RBT_ALIGN(_size_) (((_size_)+15)&~15) + + struct db_rbt_ctx { +--- lib/dbwrap/dbwrap_tdb.c.orig 2018-01-17 09:08:39.000000000 +0100 ++++ lib/dbwrap/dbwrap_tdb.c 2018-03-29 23:50:40.789642000 +0200 +@@ -27,6 +27,9 @@ + #include "lib/param/param.h" + #include "libcli/util/error.h" + ++#undef DBGC_CLASS ++#define DBGC_CLASS DBGC_LOCKING ++ + struct db_tdb_ctx { + struct tdb_wrap *wtdb; + +--- lib/dbwrap/dbwrap_util.c.orig 2018-01-17 09:08:39.000000000 +0100 ++++ lib/dbwrap/dbwrap_util.c 2018-03-29 23:51:35.907061000 +0200 +@@ -26,6 +26,9 @@ + #include "dbwrap.h" + #include "lib/util/util_tdb.h" + ++#undef DBGC_CLASS ++#define DBGC_CLASS DBGC_LOCKING ++ + struct dbwrap_fetch_int32_state { + NTSTATUS status; + int32_t result; +--- source3/lib/dbwrap/dbwrap_ctdb.c.orig 2018-01-17 09:08:39.000000000 +0100 ++++ source3/lib/dbwrap/dbwrap_ctdb.c 2018-03-29 23:57:41.784931000 +0200 +@@ -38,6 +38,9 @@ + #include "lib/cluster_support.h" + #include "lib/util/tevent_ntstatus.h" + ++#undef DBGC_CLASS ++#define DBGC_CLASS DBGC_LOCKING ++ + struct db_ctdb_transaction_handle { + struct db_ctdb_ctx *ctx; + /* +--- source3/lib/dbwrap/dbwrap_open.c.orig 2018-01-17 09:08:39.000000000 +0100 ++++ source3/lib/dbwrap/dbwrap_open.c 2018-03-29 23:57:54.680614000 +0200 +@@ -31,6 +31,9 @@ + #include "ctdbd_conn.h" + #include "messages.h" + ++#undef DBGC_CLASS ++#define DBGC_CLASS DBGC_LOCKING ++ + bool db_is_local(const char *name) + { + const char *sockname = lp_ctdbd_socket(); +--- source3/lib/dbwrap/dbwrap_watch.c.orig 2018-01-17 09:08:39.000000000 +0100 ++++ source3/lib/dbwrap/dbwrap_watch.c 2018-03-29 23:58:09.746298000 +0200 +@@ -28,6 +28,9 @@ + #include "server_id_watch.h" + #include "lib/dbwrap/dbwrap_private.h" + ++#undef DBGC_CLASS ++#define DBGC_CLASS DBGC_LOCKING ++ + static ssize_t dbwrap_record_watchers_key(struct db_context *db, + struct db_record *rec, + uint8_t *wkey, size_t wkey_len) diff --git a/net/samba47/files/patch-source3__modules__wscript_build b/net/samba47/files/patch-source3__modules__wscript_build new file mode 100644 index 000000000000..9c0ed05ba148 --- /dev/null +++ b/net/samba47/files/patch-source3__modules__wscript_build @@ -0,0 +1,15 @@ +--- source3/modules/wscript_build.orig 2018-02-08 00:37:51 UTC ++++ source3/modules/wscript_build +@@ -516,3 +516,12 @@ bld.SAMBA3_MODULE('vfs_error_inject', + init_function='', + internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_error_inject'), + enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_error_inject')) ++ ++bld.SAMBA3_MODULE('vfs_freebsd', ++ subsystem='vfs', ++ source='vfs_freebsd.c', ++ deps='samba-util', ++ init_function='', ++ internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_freebsd'), ++ enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_freebsd')) ++ diff --git a/net/samba47/files/patch-vfs_freebsd.c b/net/samba47/files/patch-vfs_freebsd.c new file mode 100644 index 000000000000..8fcec59ae862 --- /dev/null +++ b/net/samba47/files/patch-vfs_freebsd.c @@ -0,0 +1,1785 @@ +--- /dev/null 2018-03-05 02:00:00 UTC ++++ source3/modules/vfs_freebsd.c 2018-03-05 02:04:19.982828000 +0100 +@@ -0,0 +1,1782 @@ ++/* ++ * This module implements VFS calls specific to FreeBSD ++ * ++ * Copyright (C) Timur I. Bakeyev, 2018 ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, see <http://www.gnu.org/licenses/>. ++ */ ++ ++#include "includes.h" ++ ++//#include "../source3/include/includes.h" ++#include "lib/util/tevent_unix.h" ++#include "lib/util/tevent_ntstatus.h" ++#include "system/filesys.h" ++ ++#include <sys/sysctl.h> ++ ++ ++#ifndef EXTATTR_MAXNAMELEN ++#define EXTATTR_MAXNAMELEN UINT8_MAX ++#endif ++ ++#define EXTATTR_NAMESPACE(NS) EXTATTR_NAMESPACE_ ## NS, \ ++ EXTATTR_NAMESPACE_ ## NS ## _STRING ".", \ ++ .data.len = (sizeof(EXTATTR_NAMESPACE_ ## NS ## _STRING ".") - 1) ++ ++#define EXTATTR_EMPTY 0x00 ++#define EXTATTR_USER 0x01 ++#define EXTATTR_SYSTEM 0x02 ++#define EXTATTR_SECURITY 0x03 ++#define EXTATTR_TRUSTED 0x04 ++ ++ ++static bool is_secure = true; ++static bool is_legacy = false; ++ ++typedef struct { ++ int namespace; ++ char name[EXTATTR_MAXNAMELEN+1]; ++ union { ++ uint16_t len; ++ uint16_t flags; ++ } data; ++} extattr_attr; ++ ++ ++/* XXX: This order doesn't match namespace ids order! */ ++static extattr_attr extattr[] = { ++ { EXTATTR_NAMESPACE(EMPTY) }, ++ { EXTATTR_NAMESPACE(SYSTEM) }, ++ { EXTATTR_NAMESPACE(USER) }, ++}; ++ ++typedef struct { ++ enum { ++ FILE, LINK, FDES ++ } method; ++ union { ++ const char *path; ++ int filedes; ++ } param; ++} extattr_arg; ++ ++ ++ ++static bool freebsd_in_jail(void) { ++ int val = 0; ++ size_t val_len = sizeof(val); ++ ++ if((sysctlbyname("security.jail.jailed", &val, &val_len, NULL, 0) != -1) && val == 1) { ++ return true; ++ } ++ return false; ++} ++ ++static uint16_t freebsd_map_attrname(const char *name) ++{ ++ if(name == NULL || name[0] == '\0') { ++ return EXTATTR_EMPTY; ++ } ++ ++ switch(name[0]) { ++ case 'u': ++ if(strncmp(name, "user.", 5) == 0) ++ return EXTATTR_USER; ++ break; ++ case 't': ++ if(strncmp(name, "trusted.", 8) == 0) ++ return EXTATTR_TRUSTED; ++ break; ++ case 's': ++ /* name[1] could be any character, including '\0' */ ++ switch(name[1]) { ++ case 'e': ++ if(strncmp(name, "security.", 9) == 0) ++ return EXTATTR_SECURITY; ++ break; ++ case 'y': ++ if(strncmp(name, "system.", 7) == 0) ++ return EXTATTR_SYSTEM; ++ break; ++ } ++ break; ++ } ++ return EXTATTR_USER; ++} ++ ++/* security, system, trusted or user */ ++static extattr_attr* freebsd_map_xattr(const char *name, extattr_attr *attr) ++{ ++ int attrnamespace = EXTATTR_NAMESPACE_EMPTY; ++ const char *attrname = name; ++ ++ if(name == NULL || name[0] == '\0') { ++ return NULL; ++ } ++ ++ if(attr == NULL) { ++ return NULL; ++ } ++ ++ uint16_t flags = freebsd_map_attrname(name); ++ ++ switch(flags) { ++ case EXTATTR_USER: ++ attrnamespace = EXTATTR_NAMESPACE_USER; ++ if(is_legacy) ++ attrname = name + 5; ++ break; ++ case EXTATTR_SECURITY: ++ case EXTATTR_TRUSTED: ++ attrnamespace = (is_secure) ? ++ EXTATTR_NAMESPACE_SYSTEM : ++ EXTATTR_NAMESPACE_USER; ++ break; ++ case EXTATTR_SYSTEM: ++ attrnamespace = (is_secure) ? ++ EXTATTR_NAMESPACE_SYSTEM : ++ EXTATTR_NAMESPACE_USER; ++ if (is_legacy) ++ attrname = name + 7; ++ break; ++ default: ++ /* Default to "user" namespace if nothing else was specified */ ++ attrnamespace = EXTATTR_NAMESPACE_USER; ++ flags = EXTATTR_USER; ++ } ++ ++ attr->namespace = attrnamespace; ++ attr->data.flags = flags; ++ strlcpy(attr->name, attrname, EXTATTR_MAXNAMELEN+1); ++ ++ return attr; ++} ++ ++static ssize_t extattr_size(extattr_arg arg, extattr_attr *attr) ++{ ++ ssize_t result; ++ ++ switch(arg.method) { ++#if defined(HAVE_EXTATTR_GET_FILE) ++ case FILE: ++ result = extattr_get_file(arg.param.path, attr->namespace, attr->name, NULL, 0); ++ break; ++#endif ++#if defined(HAVE_EXTATTR_GET_LINK) ++ case LINK: ++ result = extattr_get_link(arg.param.path, attr->namespace, attr->name, NULL, 0); ++ break; ++#endif ++#if defined(HAVE_EXTATTR_GET_FD) ++ case FDES: ++ result = extattr_get_fd(arg.param.filedes, attr->namespace, attr->name, NULL, 0); ++ break; ++#endif ++ default: ++ errno = ENOSYS; ++ return -1; ++ } ++ ++ if(result < 0) { ++ errno = EINVAL; ++ return -1; ++ } ++ ++ return result; ++} ++ ++ ++/* ++ * The list of names is returned as an unordered array of NULL-terminated ++ * character strings (attribute names are separated by NULL characters), ++ * like this: ++ * user.name1\0system.name1\0user.name2\0 ++ * ++ * Filesystems like ext2, ext3 and XFS which implement POSIX ACLs using ++ * extended attributes, might return a list like this: ++ * system.posix_acl_access\0system.posix_acl_default\0 ++ */ ++/* ++ * The extattr_list_file() returns a list of attributes present in the ++ * requested namespace. Each list entry consists of a single byte containing ++ * the length of the attribute name, followed by the attribute name. The ++ * attribute name is not terminated by ASCII 0 (nul). ++*/ ++ ++static ssize_t freebsd_extattr_list(extattr_arg arg, char *list, size_t size) ++{ ++ ssize_t list_size, total_size = 0; ++ char *p, *q, *list_end; ++ int len; ++ /* ++ Ignore all but user namespace when we are not root or in jail ++ See: https://bugzilla.samba.org/show_bug.cgi?id=10247 ++ */ ++ bool as_root = (geteuid() == 0); ++ ++ int ns = (is_secure && as_root) ? 1 : 2; ++ ++ /* Iterate through extattr(2) namespaces */ ++ for(; ns < ARRAY_SIZE(extattr); ns++) { ++ switch(arg.method) { ++#if defined(HAVE_EXTATTR_LIST_FILE) ++ case FILE: ++ list_size = extattr_list_file(arg.param.path, extattr[ns].namespace, list, size); ++ break; ++#endif ++#if defined(HAVE_EXTATTR_LIST_LINK) ++ case LINK: ++ list_size = extattr_list_link(arg.param.path, extattr[ns].namespace, list, size); ++ break; ++#endif ++#if defined(HAVE_EXTATTR_LIST_FD) ++ case FDES: ++ list_size = extattr_list_fd(arg.param.filedes, extattr[ns].namespace, list, size); ++ break; ++#endif ++ default: ++ errno = ENOSYS; ++ return -1; ++ } ++ /* Some error happend. Errno should be set by the previous call */ ++ if(list_size < 0) ++ return -1; ++ /* No attributes in this namespace */ ++ if(list_size == 0) ++ continue; ++ /* ++ Call with an empty buffer may be used to calculate ++ necessary buffer size. ++ */ ++ if(list == NULL) { ++ /* ++ XXX: Unfortunately, we can't say, how many attributes were ++ returned, so here is the potential problem with the emulation. ++ */ ++ if(is_legacy) { ++ /* ++ Take the worse case of one char attribute names - ++ two bytes per name plus one more for sanity. ++ */ ++ total_size += list_size + (list_size/2 + 1)*extattr[ns].data.len; ++ } ++ else { ++ total_size += list_size; ++ } ++ continue; ++ } ++ ++ if(is_legacy) { ++ /* Count necessary offset to fit namespace prefixes */ ++ int extra_len = 0; ++ uint16_t flags; ++ list_end = list + list_size; ++ for(list_size = 0, p = q = list; p < list_end; p += len) { ++ len = p[0] + 1; ++ (void)strlcpy(q, p + 1, len); ++ flags = freebsd_map_attrname(q); ++ /* Skip secure attributes for non-root user */ ++ if(!is_secure && !as_root && flags > EXTATTR_USER) { ++ continue; ++ } ++ if(flags <= EXTATTR_USER) { ++ /* Don't count trailing '\0' */ ++ extra_len += extattr[ns].data.len; ++ } ++ list_size += len; ++ q += len; ++ } ++ total_size += list_size + extra_len; ++ /* Buffer is too small to fit the results */ ++ if(total_size > size) { ++ errno = ERANGE; ++ return -1; ++ } ++ /* Shift results backwards, so we can prepend prefixes */ ++ list_end = list + extra_len; ++ p = (char*)memmove(list_end, list, list_size); ++ /* ++ We enter the loop with `p` pointing to the shifted list and ++ `extra_len` having the total margin between `list` and `p` ++ */ ++ for(list_end += list_size; p < list_end; p += len) { ++ len = strlen(p) + 1; ++ flags = freebsd_map_attrname(p); ++ if(flags <= EXTATTR_USER) { ++ /* Add namespace prefix */ ++ (void)strncpy(list, extattr[ns].name, extattr[ns].data.len); ++ list += extattr[ns].data.len; ++ } ++ /* Append attribute name */ ++ (void)strlcpy(list, p, len); ++ list += len; ++ } ++ } ++ else { ++ /* Convert UCSD strings into nul-terminated strings */ ++ for(list_end = list + list_size; list < list_end; list += len) { ++ len = list[0] + 1; ++ (void)strlcpy(list, list + 1, len); ++ } ++ total_size += list_size; ++ } ++ } ++ return total_size; ++} ++ ++/* ++static ssize_t freebsd_getxattr_size(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ const char *name) ++{ ++ extattr_arg arg = { FILE, smb_fname->base_name }; ++ extattr_attr attr; ++ ++ if(!freebsd_map_xattr(name, &attr)) { ++ errno = EINVAL; ++ return -1; ++ } ++ ++ if(!is_secure && geteuid() != 0 && attr.data.flags > EXTATTR_USER) { ++ errno = ENOATTR; ++ return -1; ++ } ++ ++ return extattr_size(arg, &attr); ++} ++*/ ++ ++/* VFS entries */ ++static ssize_t freebsd_getxattr(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ const char *name, ++ void *value, ++ size_t size) ++{ ++#if defined(HAVE_EXTATTR_GET_FILE) ++ extattr_arg arg = { FILE, .param.path = smb_fname->base_name }; ++ extattr_attr attr; ++ ssize_t res; ++ ++ if(!freebsd_map_xattr(name, &attr)) { ++ errno = EINVAL; ++ return -1; ++ } ++ ++ /* Filter out 'secure' entries */ ++ if(!is_secure && geteuid() != 0 && attr.data.flags > EXTATTR_USER) { ++ errno = ENOATTR; ++ return -1; ++ } ++ ++ /* ++ * The BSD implementation has a nasty habit of silently truncating ++ * the returned value to the size of the buffer, so we have to check ++ * that the buffer is large enough to fit the returned value. ++ */ ++ if((res=extattr_size(arg, &attr)) < 0) { ++ return -1; ++ } ++ ++ if (size == 0) { ++ return res; ++ } ++ else if (res > size) { ++ errno = ERANGE; ++ return -1; ++ } ++ ++ if((res=extattr_get_file(smb_fname->base_name, attr.namespace, attr.name, value, size)) >= 0) { ++ return res; ++ } ++ return -1; ++#else ++ errno = ENOSYS; ++ return -1; ++#endif ++} ++ ++ ++static ssize_t freebsd_fgetxattr(vfs_handle_struct *handle, ++ struct files_struct *fsp, const char *name, ++ void *value, size_t size) ++{ ++#if defined(HAVE_EXTATTR_GET_FD) ++ extattr_arg arg = { FDES, .param.filedes = fsp->fh->fd }; ++ extattr_attr attr; ++ ssize_t res; ++ ++ if(!freebsd_map_xattr(name, &attr)) { ++ errno = EINVAL; ++ return -1; ++ } ++ ++ /* Filter out 'secure' entries */ ++ if(!is_secure && geteuid() != 0 && attr.data.flags > EXTATTR_USER) { ++ errno = ENOATTR; ++ return -1; ++ } ++ ++ /* ++ * The BSD implementation has a nasty habit of silently truncating ++ * the returned value to the size of the buffer, so we have to check ++ * that the buffer is large enough to fit the returned value. ++ */ ++ if((res=extattr_size(arg, &attr)) < 0) { ++ return -1; ++ } ++ ++ if (size == 0) { ++ return res; ++ } ++ else if (res > size) { ++ errno = ERANGE; ++ return -1; ++ } ++ ++ if((res=extattr_get_fd(fsp->fh->fd, attr.namespace, attr.name, value, size)) >= 0) { ++ return res; ++ } ++ return -1; ++#else ++ errno = ENOSYS; ++ return -1; ++#endif ++} ++ ++ ++static ssize_t freebsd_listxattr(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ char *list, ++ size_t size) ++{ ++#if defined(HAVE_EXTATTR_LIST_FILE) ++ extattr_arg arg = { FILE, .param.path = smb_fname->base_name }; ++ ++ return freebsd_extattr_list(arg, list, size); ++#else ++ errno = ENOSYS; ++ return -1; ++#endif ++} ++ ++ ++static ssize_t freebsd_flistxattr(vfs_handle_struct *handle, ++ struct files_struct *fsp, char *list, ++ size_t size) ++{ ++#if defined(HAVE_EXTATTR_LIST_FD) ++ extattr_arg arg = { FDES, .param.filedes = fsp->fh->fd }; ++ ++ return freebsd_extattr_list(arg, list, size); ++#else ++ errno = ENOSYS; ++ return -1; ++#endif ++} ++ ++static int freebsd_removexattr(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ const char *name) ++{ ++#if defined(HAVE_EXTATTR_DELETE_FILE) ++ extattr_attr attr; ++ ++ if(!freebsd_map_xattr(name, &attr)) { ++ errno = EINVAL; ++ return -1; ++ } ++ ++ /* Filter out 'secure' entries */ ++ if(!is_secure && geteuid() != 0 && attr.data.flags > EXTATTR_USER) { ++ errno = ENOATTR; ++ return -1; ++ } ++ ++ return extattr_delete_file(smb_fname->base_name, attr.namespace, attr.name); ++#else ++ errno = ENOSYS; ++ return -1; ++#endif ++} ++ ++ ++static int freebsd_fremovexattr(vfs_handle_struct *handle, ++ struct files_struct *fsp, const char *name) ++{ ++#if defined(HAVE_EXTATTR_DELETE_FD) ++ extattr_attr attr; ++ ++ if(!freebsd_map_xattr(name, &attr)) { ++ errno = EINVAL; ++ return -1; ++ } ++ ++ /* Filter out 'secure' entries */ ++ if(!is_secure && geteuid() != 0 && attr.data.flags > EXTATTR_USER) { ++ errno = ENOATTR; ++ return -1; ++ } ++ ++ return extattr_delete_fd(fsp->fh->fd, attr.namespace, attr.name); ++#else ++ errno = ENOSYS; ++ return -1; ++#endif ++} ++ ++ ++static int freebsd_setxattr(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ const char *name, ++ const void *value, ++ size_t size, ++ int flags) ++{ ++#if defined(HAVE_EXTATTR_SET_FILE) ++ extattr_attr attr; ++ ssize_t res; ++ ++ if(!freebsd_map_xattr(name, &attr)) { ++ errno = EINVAL; ++ return -1; ++ } ++ ++ /* Filter out 'secure' entries */ ++ if(!is_secure && geteuid() != 0 && attr.data.flags > EXTATTR_USER) { ++ errno = ENOATTR; ++ return -1; ++ } ++ ++ if (flags) { ++ extattr_arg arg = { FILE, .param.path = smb_fname->base_name }; ++ /* Check attribute existence */ ++ res = extattr_size(arg, &attr); ++ if (res < 0) { ++ /* REPLACE attribute, that doesn't exist */ ++ if ((flags & XATTR_REPLACE) && errno == ENOATTR) { ++ errno = ENOATTR; ++ return -1; ++ } ++ /* Ignore other errors */ ++ } ++ else { ++ /* CREATE attribute, that already exists */ ++ if (flags & XATTR_CREATE) { ++ errno = EEXIST; ++ return -1; ++ } ++ } ++ } ++ res = extattr_set_file(smb_fname->base_name, attr.namespace, attr.name, value, size); ++ ++ return (res >= 0) ? 0 : -1; ++#else ++ errno = ENOSYS; ++ return -1; ++#endif ++} ++ ++ ++static int freebsd_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, ++ const char *name, const void *value, size_t size, ++ int flags) ++{ ++#if defined(HAVE_EXTATTR_SET_FD) ++ extattr_attr attr; ++ ssize_t res; ++ ++ if(!freebsd_map_xattr(name, &attr)) { ++ errno = EINVAL; ++ return -1; ++ } ++ ++ /* Filter out 'secure' entries */ ++ if(!is_secure && geteuid() != 0 && attr.data.flags > EXTATTR_USER) { ++ errno = ENOATTR; ++ return -1; ++ } ++ ++ if (flags) { ++ extattr_arg arg = { FDES, .param.filedes = fsp->fh->fd }; ++ /* Check attribute existence */ ++ res = extattr_size(arg, &attr); ++ if (res < 0) { ++ /* REPLACE attribute, that doesn't exist */ ++ if ((flags & XATTR_REPLACE) && errno == ENOATTR) { ++ errno = ENOATTR; ++ return -1; ++ } ++ /* Ignore other errors */ ++ } ++ else { ++ /* CREATE attribute, that already exists */ ++ if (flags & XATTR_CREATE) { ++ errno = EEXIST; ++ return -1; ++ } ++ } ++ } ++ ++ res = extattr_set_fd(fsp->fh->fd, attr.namespace, attr.name, value, size); ++ ++ return (res >= 0) ? 0 : -1; ++#else ++ errno = ENOSYS; ++ return -1; ++#endif ++} ++ ++ ++ ++ ++static int freebsd_connect(vfs_handle_struct *handle, const char *service, ++ const char *user) ++{ ++ return SMB_VFS_NEXT_CONNECT(handle, service, user); ++} ++ ++static void freebsd_disconnect(vfs_handle_struct *handle) ++{ ++ SMB_VFS_NEXT_DISCONNECT(handle); ++} ++ ++static uint64_t freebsd_disk_free(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ uint64_t *bsize, ++ uint64_t *dfree, ++ uint64_t *dsize) ++{ ++ return SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree, dsize); ++} ++ ++static int freebsd_get_quota(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ enum SMB_QUOTA_TYPE qtype, ++ unid_t id, ++ SMB_DISK_QUOTA *dq) ++{ ++ return SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, dq); ++} ++ ++static int freebsd_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, ++ unid_t id, SMB_DISK_QUOTA *dq) ++{ ++ return SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq); ++} ++ ++static int freebsd_get_shadow_copy_data(vfs_handle_struct *handle, ++ files_struct *fsp, ++ struct shadow_copy_data *shadow_copy_data, ++ bool labels) ++{ ++ return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, ++ labels); ++} ++ ++static int freebsd_statvfs(struct vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ struct vfs_statvfs_struct *statbuf) ++{ ++ return SMB_VFS_NEXT_STATVFS(handle, smb_fname, statbuf); ++} ++ ++static uint32_t freebsd_fs_capabilities(struct vfs_handle_struct *handle, ++ enum timestamp_set_resolution *p_ts_res) ++{ ++ return SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res); ++} ++ ++static NTSTATUS freebsd_get_dfs_referrals(struct vfs_handle_struct *handle, ++ struct dfs_GetDFSReferral *r) ++{ ++ return SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r); ++} ++ ++static DIR *freebsd_opendir(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ const char *mask, ++ uint32_t attr) ++{ ++ return SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr); ++} ++ ++static NTSTATUS freebsd_snap_check_path(struct vfs_handle_struct *handle, ++ TALLOC_CTX *mem_ctx, ++ const char *service_path, ++ char **base_volume) ++{ ++ return SMB_VFS_NEXT_SNAP_CHECK_PATH(handle, mem_ctx, service_path, ++ base_volume); ++} ++ ++static NTSTATUS freebsd_snap_create(struct vfs_handle_struct *handle, ++ TALLOC_CTX *mem_ctx, ++ const char *base_volume, ++ time_t *tstamp, ++ bool rw, ++ char **base_path, ++ char **snap_path) ++{ ++ return SMB_VFS_NEXT_SNAP_CREATE(handle, mem_ctx, base_volume, tstamp, ++ rw, base_path, snap_path); ++} ++ ++static NTSTATUS freebsd_snap_delete(struct vfs_handle_struct *handle, ++ TALLOC_CTX *mem_ctx, ++ char *base_path, ++ char *snap_path) ++{ ++ return SMB_VFS_NEXT_SNAP_DELETE(handle, mem_ctx, base_path, snap_path); ++} ++ ++static DIR *freebsd_fdopendir(vfs_handle_struct *handle, files_struct *fsp, ++ const char *mask, uint32_t attr) ++{ ++ return SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr); ++} ++ ++static struct dirent *freebsd_readdir(vfs_handle_struct *handle, ++ DIR *dirp, SMB_STRUCT_STAT *sbuf) ++{ ++ return SMB_VFS_NEXT_READDIR(handle, dirp, sbuf); ++} ++ ++static void freebsd_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset) ++{ ++ SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset); ++} ++ ++static long freebsd_telldir(vfs_handle_struct *handle, DIR *dirp) ++{ ++ return SMB_VFS_NEXT_TELLDIR(handle, dirp); ++} ++ ++static void freebsd_rewind_dir(vfs_handle_struct *handle, DIR *dirp) ++{ ++ SMB_VFS_NEXT_REWINDDIR(handle, dirp); ++} ++ ++static int freebsd_mkdir(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ mode_t mode) ++{ ++ return SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode); ++} ++ ++static int freebsd_rmdir(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname) ++{ ++ return SMB_VFS_NEXT_RMDIR(handle, smb_fname); ++} ++ ++static int freebsd_closedir(vfs_handle_struct *handle, DIR *dir) ++{ ++ return SMB_VFS_NEXT_CLOSEDIR(handle, dir); ++} ++ ++static int freebsd_open(vfs_handle_struct *handle, struct smb_filename *smb_fname, ++ files_struct *fsp, int flags, mode_t mode) ++{ ++ return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode); ++} ++ ++static NTSTATUS freebsd_create_file(struct vfs_handle_struct *handle, ++ struct smb_request *req, ++ uint16_t root_dir_fid, ++ struct smb_filename *smb_fname, ++ uint32_t access_mask, ++ uint32_t share_access, ++ uint32_t create_disposition, ++ uint32_t create_options, ++ uint32_t file_attributes, ++ uint32_t oplock_request, ++ struct smb2_lease *lease, ++ uint64_t allocation_size, ++ uint32_t private_flags, ++ struct security_descriptor *sd, ++ struct ea_list *ea_list, ++ files_struct ** result, int *pinfo, ++ const struct smb2_create_blobs *in_context_blobs, ++ struct smb2_create_blobs *out_context_blobs) ++{ ++ return SMB_VFS_NEXT_CREATE_FILE(handle, ++ req, ++ root_dir_fid, ++ smb_fname, ++ access_mask, ++ share_access, ++ create_disposition, ++ create_options, ++ file_attributes, ++ oplock_request, ++ lease, ++ allocation_size, ++ private_flags, ++ sd, ea_list, result, pinfo, ++ in_context_blobs, out_context_blobs); ++} ++ ++static int freebsd_close_fn(vfs_handle_struct *handle, files_struct *fsp) ++{ ++ return SMB_VFS_NEXT_CLOSE(handle, fsp); ++} ++ ++static ssize_t freebsd_vfs_read(vfs_handle_struct *handle, files_struct *fsp, ++ void *data, size_t n) ++{ ++ return SMB_VFS_NEXT_READ(handle, fsp, data, n); ++} ++ ++static ssize_t freebsd_pread(vfs_handle_struct *handle, files_struct *fsp, ++ void *data, size_t n, off_t offset) ++{ ++ return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset); ++} ++ ++struct freebsd_pread_state { ++ ssize_t ret; ++ struct vfs_aio_state vfs_aio_state; ++}; ++ ++static void freebsd_pread_done(struct tevent_req *subreq); ++ ++static struct tevent_req *freebsd_pread_send(struct vfs_handle_struct *handle, ++ TALLOC_CTX *mem_ctx, ++ struct tevent_context *ev, ++ struct files_struct *fsp, ++ void *data, size_t n, off_t offset) ++{ ++ struct tevent_req *req, *subreq; ++ struct freebsd_pread_state *state; ++ ++ req = tevent_req_create(mem_ctx, &state, struct freebsd_pread_state); ++ if (req == NULL) { ++ return NULL; ++ } ++ subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data, ++ n, offset); ++ if (tevent_req_nomem(subreq, req)) { ++ return tevent_req_post(req, ev); ++ } ++ tevent_req_set_callback(subreq, freebsd_pread_done, req); ++ return req; ++} ++ ++static void freebsd_pread_done(struct tevent_req *subreq) ++{ ++ struct tevent_req *req = ++ tevent_req_callback_data(subreq, struct tevent_req); ++ struct freebsd_pread_state *state = ++ tevent_req_data(req, struct freebsd_pread_state); ++ ++ state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state); ++ TALLOC_FREE(subreq); ++ tevent_req_done(req); ++} ++ ++static ssize_t freebsd_pread_recv(struct tevent_req *req, ++ struct vfs_aio_state *vfs_aio_state) ++{ ++ struct freebsd_pread_state *state = ++ tevent_req_data(req, struct freebsd_pread_state); ++ ++ if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) { ++ return -1; ++ } ++ *vfs_aio_state = state->vfs_aio_state; ++ return state->ret; ++} ++ ++static ssize_t freebsd_write(vfs_handle_struct *handle, files_struct *fsp, ++ const void *data, size_t n) ++{ ++ return SMB_VFS_NEXT_WRITE(handle, fsp, data, n); ++} ++ ++static ssize_t freebsd_pwrite(vfs_handle_struct *handle, files_struct *fsp, ++ const void *data, size_t n, off_t offset) ++{ ++ return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset); ++} ++ ++struct freebsd_pwrite_state { ++ ssize_t ret; ++ struct vfs_aio_state vfs_aio_state; ++}; ++ ++static void freebsd_pwrite_done(struct tevent_req *subreq); ++ ++static struct tevent_req *freebsd_pwrite_send(struct vfs_handle_struct *handle, ++ TALLOC_CTX *mem_ctx, ++ struct tevent_context *ev, ++ struct files_struct *fsp, ++ const void *data, ++ size_t n, off_t offset) ++{ ++ struct tevent_req *req, *subreq; ++ struct freebsd_pwrite_state *state; ++ ++ req = tevent_req_create(mem_ctx, &state, struct freebsd_pwrite_state); ++ if (req == NULL) { ++ return NULL; ++ } ++ subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data, ++ n, offset); ++ if (tevent_req_nomem(subreq, req)) { ++ return tevent_req_post(req, ev); ++ } ++ tevent_req_set_callback(subreq, freebsd_pwrite_done, req); ++ return req; ++} ++ ++static void freebsd_pwrite_done(struct tevent_req *subreq) ++{ ++ struct tevent_req *req = ++ tevent_req_callback_data(subreq, struct tevent_req); ++ struct freebsd_pwrite_state *state = ++ tevent_req_data(req, struct freebsd_pwrite_state); ++ ++ state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state); ++ TALLOC_FREE(subreq); ++ tevent_req_done(req); ++} ++ ++static ssize_t freebsd_pwrite_recv(struct tevent_req *req, ++ struct vfs_aio_state *vfs_aio_state) ++{ ++ struct freebsd_pwrite_state *state = ++ tevent_req_data(req, struct freebsd_pwrite_state); ++ ++ if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) { ++ return -1; ++ } ++ *vfs_aio_state = state->vfs_aio_state; ++ return state->ret; ++} ++ ++static off_t freebsd_lseek(vfs_handle_struct *handle, files_struct *fsp, ++ off_t offset, int whence) ++{ ++ return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence); ++} ++ ++static ssize_t freebsd_sendfile(vfs_handle_struct *handle, int tofd, ++ files_struct *fromfsp, const DATA_BLOB *hdr, ++ off_t offset, size_t n) ++{ ++ return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n); ++} ++ ++static ssize_t freebsd_recvfile(vfs_handle_struct *handle, int fromfd, ++ files_struct *tofsp, off_t offset, size_t n) ++{ ++ return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n); ++} ++ ++static int freebsd_rename(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname_src, ++ const struct smb_filename *smb_fname_dst) ++{ ++ return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst); ++} ++ ++static int freebsd_fsync(vfs_handle_struct *handle, files_struct *fsp) ++{ ++ return SMB_VFS_NEXT_FSYNC(handle, fsp); ++} ++ ++struct freebsd_fsync_state { ++ int ret; ++ struct vfs_aio_state vfs_aio_state; ++}; ++ ++static void freebsd_fsync_done(struct tevent_req *subreq); ++ ++static struct tevent_req *freebsd_fsync_send(struct vfs_handle_struct *handle, ++ TALLOC_CTX *mem_ctx, ++ struct tevent_context *ev, ++ struct files_struct *fsp) ++{ ++ struct tevent_req *req, *subreq; ++ struct freebsd_fsync_state *state; ++ ++ req = tevent_req_create(mem_ctx, &state, struct freebsd_fsync_state); ++ if (req == NULL) { ++ return NULL; ++ } ++ subreq = SMB_VFS_NEXT_FSYNC_SEND(state, ev, handle, fsp); ++ if (tevent_req_nomem(subreq, req)) { ++ return tevent_req_post(req, ev); ++ } ++ tevent_req_set_callback(subreq, freebsd_fsync_done, req); ++ return req; ++} ++ ++static void freebsd_fsync_done(struct tevent_req *subreq) ++{ ++ struct tevent_req *req = ++ tevent_req_callback_data(subreq, struct tevent_req); ++ struct freebsd_fsync_state *state = ++ tevent_req_data(req, struct freebsd_fsync_state); ++ ++ state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state); ++ TALLOC_FREE(subreq); ++ tevent_req_done(req); ++} ++ ++static int freebsd_fsync_recv(struct tevent_req *req, ++ struct vfs_aio_state *vfs_aio_state) ++{ ++ struct freebsd_fsync_state *state = ++ tevent_req_data(req, struct freebsd_fsync_state); ++ ++ if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) { ++ return -1; ++ } ++ *vfs_aio_state = state->vfs_aio_state; ++ return state->ret; ++} ++ ++static int freebsd_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname) ++{ ++ return SMB_VFS_NEXT_STAT(handle, smb_fname); ++} ++ ++static int freebsd_fstat(vfs_handle_struct *handle, files_struct *fsp, ++ SMB_STRUCT_STAT *sbuf) ++{ ++ return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf); ++} ++ ++static int freebsd_lstat(vfs_handle_struct *handle, ++ struct smb_filename *smb_fname) ++{ ++ return SMB_VFS_NEXT_LSTAT(handle, smb_fname); ++} ++ ++static uint64_t freebsd_get_alloc_size(struct vfs_handle_struct *handle, ++ struct files_struct *fsp, ++ const SMB_STRUCT_STAT *sbuf) ++{ ++ return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf); ++} ++ ++static int freebsd_unlink(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname) ++{ ++ return SMB_VFS_NEXT_UNLINK(handle, smb_fname); ++} ++ ++static int freebsd_chmod(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ mode_t mode) ++{ ++ return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode); ++} ++ ++static int freebsd_fchmod(vfs_handle_struct *handle, files_struct *fsp, ++ mode_t mode) ++{ ++ return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode); ++} ++ ++static int freebsd_chown(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ uid_t uid, ++ gid_t gid) ++{ ++ return SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid); ++} ++ ++static int freebsd_fchown(vfs_handle_struct *handle, files_struct *fsp, ++ uid_t uid, gid_t gid) ++{ ++ return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid); ++} ++ ++static int freebsd_lchown(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ uid_t uid, ++ gid_t gid) ++{ ++ return SMB_VFS_NEXT_LCHOWN(handle, smb_fname, uid, gid); ++} ++ ++static int freebsd_chdir(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname) ++{ ++ return SMB_VFS_NEXT_CHDIR(handle, smb_fname); ++} ++ ++static struct smb_filename *freebsd_getwd(vfs_handle_struct *handle, ++ TALLOC_CTX *ctx) ++{ ++ return SMB_VFS_NEXT_GETWD(handle, ctx); ++} ++ ++static int freebsd_ntimes(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ struct smb_file_time *ft) ++{ ++ return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft); ++} ++ ++static int freebsd_ftruncate(vfs_handle_struct *handle, files_struct *fsp, ++ off_t offset) ++{ ++ return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset); ++} ++ ++static int freebsd_fallocate(vfs_handle_struct *handle, files_struct *fsp, ++ uint32_t mode, off_t offset, off_t len) ++{ ++ return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len); ++} ++ ++static bool freebsd_lock(vfs_handle_struct *handle, files_struct *fsp, int op, ++ off_t offset, off_t count, int type) ++{ ++ return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type); ++} ++ ++static int freebsd_kernel_flock(struct vfs_handle_struct *handle, ++ struct files_struct *fsp, uint32_t share_mode, ++ uint32_t access_mask) ++{ ++ return SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask); ++} ++ ++static int freebsd_linux_setlease(struct vfs_handle_struct *handle, ++ struct files_struct *fsp, int leasetype) ++{ ++ return SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype); ++} ++ ++static bool freebsd_getlock(vfs_handle_struct *handle, files_struct *fsp, ++ off_t *poffset, off_t *pcount, int *ptype, ++ pid_t *ppid) ++{ ++ return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid); ++} ++ ++static int freebsd_symlink(vfs_handle_struct *handle, ++ const char *link_contents, ++ const struct smb_filename *new_smb_fname) ++{ ++ return SMB_VFS_NEXT_SYMLINK(handle, link_contents, new_smb_fname); ++} ++ ++static int freebsd_vfs_readlink(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ char *buf, ++ size_t bufsiz) ++{ ++ return SMB_VFS_NEXT_READLINK(handle, smb_fname, buf, bufsiz); ++} ++ ++static int freebsd_link(vfs_handle_struct *handle, ++ const struct smb_filename *old_smb_fname, ++ const struct smb_filename *new_smb_fname) ++{ ++ return SMB_VFS_NEXT_LINK(handle, old_smb_fname, new_smb_fname); ++} ++ ++static int freebsd_mknod(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ mode_t mode, ++ SMB_DEV_T dev) ++{ ++ return SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev); ++} ++ ++static struct smb_filename *freebsd_realpath(vfs_handle_struct *handle, ++ TALLOC_CTX *ctx, ++ const struct smb_filename *smb_fname) ++{ ++ return SMB_VFS_NEXT_REALPATH(handle, ctx, smb_fname); ++} ++ ++static int freebsd_chflags(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ uint flags) ++{ ++ return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags); ++} ++ ++static struct file_id freebsd_file_id_create(vfs_handle_struct *handle, ++ const SMB_STRUCT_STAT *sbuf) ++{ ++ return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf); ++} ++ ++struct freebsd_offload_read_state { ++ struct vfs_handle_struct *handle; ++ DATA_BLOB token; ++}; ++ ++static void freebsd_offload_read_done(struct tevent_req *subreq); ++ ++static struct tevent_req *freebsd_offload_read_send( ++ TALLOC_CTX *mem_ctx, ++ struct tevent_context *ev, ++ struct vfs_handle_struct *handle, ++ struct files_struct *fsp, ++ uint32_t fsctl, ++ uint32_t ttl, ++ off_t offset, ++ size_t to_copy) ++{ ++ struct tevent_req *req = NULL; ++ struct freebsd_offload_read_state *state = NULL; ++ struct tevent_req *subreq = NULL; ++ ++ req = tevent_req_create(mem_ctx, &state, struct freebsd_offload_read_state); ++ if (req == NULL) { ++ return NULL; ++ } ++ *state = (struct freebsd_offload_read_state) { ++ .handle = handle, ++ }; ++ ++ subreq = SMB_VFS_NEXT_OFFLOAD_READ_SEND(mem_ctx, ev, handle, fsp, ++ fsctl, ttl, offset, to_copy); ++ if (tevent_req_nomem(subreq, req)) { ++ return tevent_req_post(req, ev); ++ } ++ tevent_req_set_callback(subreq, freebsd_offload_read_done, req); ++ return req; ++} ++ ++static void freebsd_offload_read_done(struct tevent_req *subreq) ++{ ++ struct tevent_req *req = tevent_req_callback_data( ++ subreq, struct tevent_req); ++ struct freebsd_offload_read_state *state = tevent_req_data( ++ req, struct freebsd_offload_read_state); ++ NTSTATUS status; ++ ++ status = SMB_VFS_NEXT_OFFLOAD_READ_RECV(subreq, ++ state->handle, ++ state, ++ &state->token); ++ TALLOC_FREE(subreq); ++ if (tevent_req_nterror(req, status)) { ++ return; ++ } ++ ++ tevent_req_done(req); ++ return; ++} ++ ++static NTSTATUS freebsd_offload_read_recv(struct tevent_req *req, ++ struct vfs_handle_struct *handle, ++ TALLOC_CTX *mem_ctx, ++ DATA_BLOB *_token) ++{ ++ struct freebsd_offload_read_state *state = tevent_req_data( ++ req, struct freebsd_offload_read_state); ++ DATA_BLOB token; ++ NTSTATUS status; ++ ++ if (tevent_req_is_nterror(req, &status)) { ++ tevent_req_received(req); ++ return status; ++ } ++ ++ token = data_blob_talloc(mem_ctx, ++ state->token.data, ++ state->token.length); ++ ++ tevent_req_received(req); ++ ++ if (token.data == NULL) { ++ return NT_STATUS_NO_MEMORY; ++ } ++ ++ *_token = token; ++ return NT_STATUS_OK; ++} ++ ++struct freebsd_offload_write_state { ++ struct vfs_handle_struct *handle; ++ off_t copied; ++}; ++static void freebsd_offload_write_done(struct tevent_req *subreq); ++ ++static struct tevent_req *freebsd_offload_write_send(struct vfs_handle_struct *handle, ++ TALLOC_CTX *mem_ctx, ++ struct tevent_context *ev, ++ uint32_t fsctl, ++ DATA_BLOB *token, ++ off_t transfer_offset, ++ struct files_struct *dest_fsp, ++ off_t dest_off, ++ off_t num) ++{ ++ struct tevent_req *req; ++ struct tevent_req *subreq; ++ struct freebsd_offload_write_state *state; ++ ++ req = tevent_req_create(mem_ctx, &state, struct freebsd_offload_write_state); ++ if (req == NULL) { ++ return NULL; ++ } ++ ++ state->handle = handle; ++ subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, state, ev, ++ fsctl, token, transfer_offset, ++ dest_fsp, dest_off, num); ++ if (tevent_req_nomem(subreq, req)) { ++ return tevent_req_post(req, ev); ++ } ++ ++ tevent_req_set_callback(subreq, freebsd_offload_write_done, req); ++ return req; ++} ++ ++static void freebsd_offload_write_done(struct tevent_req *subreq) ++{ ++ struct tevent_req *req = tevent_req_callback_data( ++ subreq, struct tevent_req); ++ struct freebsd_offload_write_state *state ++ = tevent_req_data(req, struct freebsd_offload_write_state); ++ NTSTATUS status; ++ ++ status = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(state->handle, ++ subreq, ++ &state->copied); ++ TALLOC_FREE(subreq); ++ if (tevent_req_nterror(req, status)) { ++ return; ++ } ++ tevent_req_done(req); ++} ++ ++static NTSTATUS freebsd_offload_write_recv(struct vfs_handle_struct *handle, ++ struct tevent_req *req, ++ off_t *copied) ++{ ++ struct freebsd_offload_write_state *state ++ = tevent_req_data(req, struct freebsd_offload_write_state); ++ NTSTATUS status; ++ ++ *copied = state->copied; ++ if (tevent_req_is_nterror(req, &status)) { ++ tevent_req_received(req); ++ return status; ++ } ++ ++ tevent_req_received(req); ++ return NT_STATUS_OK; ++} ++ ++static NTSTATUS freebsd_get_compression(struct vfs_handle_struct *handle, ++ TALLOC_CTX *mem_ctx, ++ struct files_struct *fsp, ++ struct smb_filename *smb_fname, ++ uint16_t *_compression_fmt) ++{ ++ return SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname, ++ _compression_fmt); ++} ++ ++static NTSTATUS freebsd_set_compression(struct vfs_handle_struct *handle, ++ TALLOC_CTX *mem_ctx, ++ struct files_struct *fsp, ++ uint16_t compression_fmt) ++{ ++ return SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp, ++ compression_fmt); ++} ++ ++static NTSTATUS freebsd_streaminfo(struct vfs_handle_struct *handle, ++ struct files_struct *fsp, ++ const struct smb_filename *smb_fname, ++ TALLOC_CTX *mem_ctx, ++ unsigned int *num_streams, ++ struct stream_struct **streams) ++{ ++ return SMB_VFS_NEXT_STREAMINFO(handle, ++ fsp, ++ smb_fname, ++ mem_ctx, ++ num_streams, ++ streams); ++} ++ ++static int freebsd_get_real_filename(struct vfs_handle_struct *handle, ++ const char *path, ++ const char *name, ++ TALLOC_CTX *mem_ctx, char **found_name) ++{ ++ return SMB_VFS_NEXT_GET_REAL_FILENAME(handle, ++ path, name, mem_ctx, found_name); ++} ++ ++static const char *freebsd_connectpath(struct vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname) ++{ ++ return SMB_VFS_NEXT_CONNECTPATH(handle, smb_fname); ++} ++ ++static NTSTATUS freebsd_brl_lock_windows(struct vfs_handle_struct *handle, ++ struct byte_range_lock *br_lck, ++ struct lock_struct *plock, ++ bool blocking_lock) ++{ ++ return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, ++ br_lck, plock, blocking_lock); ++} ++ ++static bool freebsd_brl_unlock_windows(struct vfs_handle_struct *handle, ++ struct messaging_context *msg_ctx, ++ struct byte_range_lock *br_lck, ++ const struct lock_struct *plock) ++{ ++ return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck, plock); ++} ++ ++static bool freebsd_brl_cancel_windows(struct vfs_handle_struct *handle, ++ struct byte_range_lock *br_lck, ++ struct lock_struct *plock) ++{ ++ return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock); ++} ++ ++static bool freebsd_strict_lock_check(struct vfs_handle_struct *handle, ++ struct files_struct *fsp, ++ struct lock_struct *plock) ++{ ++ return SMB_VFS_NEXT_STRICT_LOCK_CHECK(handle, fsp, plock); ++} ++ ++static NTSTATUS freebsd_translate_name(struct vfs_handle_struct *handle, ++ const char *mapped_name, ++ enum vfs_translate_direction direction, ++ TALLOC_CTX *mem_ctx, char **pmapped_name) ++{ ++ return SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction, ++ mem_ctx, pmapped_name); ++} ++ ++static NTSTATUS freebsd_fsctl(struct vfs_handle_struct *handle, ++ struct files_struct *fsp, ++ TALLOC_CTX *ctx, ++ uint32_t function, ++ uint16_t req_flags, /* Needed for UNICODE ... */ ++ const uint8_t *_in_data, ++ uint32_t in_len, ++ uint8_t ** _out_data, ++ uint32_t max_out_len, uint32_t *out_len) ++{ ++ return SMB_VFS_NEXT_FSCTL(handle, ++ fsp, ++ ctx, ++ function, ++ req_flags, ++ _in_data, ++ in_len, _out_data, max_out_len, out_len); ++} ++ ++static NTSTATUS freebsd_readdir_attr(struct vfs_handle_struct *handle, ++ const struct smb_filename *fname, ++ TALLOC_CTX *mem_ctx, ++ struct readdir_attr_data **pattr_data) ++{ ++ return SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data); ++} ++ ++static NTSTATUS freebsd_get_dos_attributes(struct vfs_handle_struct *handle, ++ struct smb_filename *smb_fname, ++ uint32_t *dosmode) ++{ ++ return SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle, ++ smb_fname, ++ dosmode); ++} ++ ++static NTSTATUS freebsd_fget_dos_attributes(struct vfs_handle_struct *handle, ++ struct files_struct *fsp, ++ uint32_t *dosmode) ++{ ++ return SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle, ++ fsp, ++ dosmode); ++} ++ ++static NTSTATUS freebsd_set_dos_attributes(struct vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ uint32_t dosmode) ++{ ++ return SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle, ++ smb_fname, ++ dosmode); ++} ++ ++static NTSTATUS freebsd_fset_dos_attributes(struct vfs_handle_struct *handle, ++ struct files_struct *fsp, ++ uint32_t dosmode) ++{ ++ return SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle, ++ fsp, ++ dosmode); ++} ++ ++static NTSTATUS freebsd_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, ++ uint32_t security_info, ++ TALLOC_CTX *mem_ctx, ++ struct security_descriptor **ppdesc) ++{ ++ return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, mem_ctx, ++ ppdesc); ++} ++ ++static NTSTATUS freebsd_get_nt_acl(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ uint32_t security_info, ++ TALLOC_CTX *mem_ctx, ++ struct security_descriptor **ppdesc) ++{ ++ return SMB_VFS_NEXT_GET_NT_ACL(handle, ++ smb_fname, ++ security_info, ++ mem_ctx, ++ ppdesc); ++} ++ ++static NTSTATUS freebsd_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, ++ uint32_t security_info_sent, ++ const struct security_descriptor *psd) ++{ ++ return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd); ++} ++ ++static int freebsd_chmod_acl(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ mode_t mode) ++{ ++ return SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode); ++} ++ ++static int freebsd_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, ++ mode_t mode) ++{ ++ return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode); ++} ++ ++static SMB_ACL_T freebsd_sys_acl_get_file(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ SMB_ACL_TYPE_T type, ++ TALLOC_CTX *mem_ctx) ++{ ++ return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname, type, mem_ctx); ++} ++ ++static SMB_ACL_T freebsd_sys_acl_get_fd(vfs_handle_struct *handle, ++ files_struct *fsp, TALLOC_CTX *mem_ctx) ++{ ++ return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx); ++} ++ ++static int freebsd_sys_acl_blob_get_file(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ TALLOC_CTX *mem_ctx, ++ char **blob_description, ++ DATA_BLOB *blob) ++{ ++ return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, smb_fname, mem_ctx, ++ blob_description, blob); ++} ++ ++static int freebsd_sys_acl_blob_get_fd(vfs_handle_struct *handle, ++ files_struct *fsp, TALLOC_CTX *mem_ctx, ++ char **blob_description, DATA_BLOB *blob) ++{ ++ return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx, ++ blob_description, blob); ++} ++ ++static int freebsd_sys_acl_set_file(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname, ++ SMB_ACL_TYPE_T acltype, ++ SMB_ACL_T theacl) ++{ ++ return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, ++ acltype, theacl); ++} ++ ++static int freebsd_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, ++ SMB_ACL_T theacl) ++{ ++ return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl); ++} ++ ++static int freebsd_sys_acl_delete_def_file(vfs_handle_struct *handle, ++ const struct smb_filename *smb_fname) ++{ ++ return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, smb_fname); ++} ++ ++ ++static bool freebsd_aio_force(struct vfs_handle_struct *handle, ++ struct files_struct *fsp) ++{ ++ return SMB_VFS_NEXT_AIO_FORCE(handle, fsp); ++} ++ ++/* VFS operations structure */ ++ ++struct vfs_fn_pointers freebsd_fns = { ++ /* Disk operations */ ++ ++ .connect_fn = freebsd_connect, ++ .disconnect_fn = freebsd_disconnect, ++ .disk_free_fn = freebsd_disk_free, ++ .get_quota_fn = freebsd_get_quota, ++ .set_quota_fn = freebsd_set_quota, ++ .get_shadow_copy_data_fn = freebsd_get_shadow_copy_data, ++ .statvfs_fn = freebsd_statvfs, ++ .fs_capabilities_fn = freebsd_fs_capabilities, ++ .get_dfs_referrals_fn = freebsd_get_dfs_referrals, ++ .snap_check_path_fn = freebsd_snap_check_path, ++ .snap_create_fn = freebsd_snap_create, ++ .snap_delete_fn = freebsd_snap_delete, ++ ++ /* Directory operations */ ++ ++ .opendir_fn = freebsd_opendir, ++ .fdopendir_fn = freebsd_fdopendir, ++ .readdir_fn = freebsd_readdir, ++ .seekdir_fn = freebsd_seekdir, ++ .telldir_fn = freebsd_telldir, ++ .rewind_dir_fn = freebsd_rewind_dir, ++ .mkdir_fn = freebsd_mkdir, ++ .rmdir_fn = freebsd_rmdir, ++ .closedir_fn = freebsd_closedir, ++ ++ /* File operations */ ++ ++ .open_fn = freebsd_open, ++ .create_file_fn = freebsd_create_file, ++ .close_fn = freebsd_close_fn, ++ .read_fn = freebsd_vfs_read, ++ .pread_fn = freebsd_pread, ++ .pread_send_fn = freebsd_pread_send, ++ .pread_recv_fn = freebsd_pread_recv, ++ .write_fn = freebsd_write, ++ .pwrite_fn = freebsd_pwrite, ++ .pwrite_send_fn = freebsd_pwrite_send, ++ .pwrite_recv_fn = freebsd_pwrite_recv, ++ .lseek_fn = freebsd_lseek, ++ .sendfile_fn = freebsd_sendfile, ++ .recvfile_fn = freebsd_recvfile, ++ .rename_fn = freebsd_rename, ++ .fsync_fn = freebsd_fsync, ++ .fsync_send_fn = freebsd_fsync_send, ++ .fsync_recv_fn = freebsd_fsync_recv, ++ .stat_fn = freebsd_stat, ++ .fstat_fn = freebsd_fstat, ++ .lstat_fn = freebsd_lstat, ++ .get_alloc_size_fn = freebsd_get_alloc_size, ++ .unlink_fn = freebsd_unlink, ++ .chmod_fn = freebsd_chmod, ++ .fchmod_fn = freebsd_fchmod, ++ .chown_fn = freebsd_chown, ++ .fchown_fn = freebsd_fchown, ++ .lchown_fn = freebsd_lchown, ++ .chdir_fn = freebsd_chdir, ++ .getwd_fn = freebsd_getwd, ++ .ntimes_fn = freebsd_ntimes, ++ .ftruncate_fn = freebsd_ftruncate, ++ .fallocate_fn = freebsd_fallocate, ++ .lock_fn = freebsd_lock, ++ .kernel_flock_fn = freebsd_kernel_flock, ++ .linux_setlease_fn = freebsd_linux_setlease, ++ .getlock_fn = freebsd_getlock, ++ .symlink_fn = freebsd_symlink, ++ .readlink_fn = freebsd_vfs_readlink, ++ .link_fn = freebsd_link, ++ .mknod_fn = freebsd_mknod, ++ .realpath_fn = freebsd_realpath, ++ .chflags_fn = freebsd_chflags, ++ .file_id_create_fn = freebsd_file_id_create, ++ .offload_read_send_fn = freebsd_offload_read_send, ++ .offload_read_recv_fn = freebsd_offload_read_recv, ++ .offload_write_send_fn = freebsd_offload_write_send, ++ .offload_write_recv_fn = freebsd_offload_write_recv, ++ .get_compression_fn = freebsd_get_compression, ++ .set_compression_fn = freebsd_set_compression, ++ ++ .streaminfo_fn = freebsd_streaminfo, ++ .get_real_filename_fn = freebsd_get_real_filename, ++ .connectpath_fn = freebsd_connectpath, ++ .brl_lock_windows_fn = freebsd_brl_lock_windows, ++ .brl_unlock_windows_fn = freebsd_brl_unlock_windows, ++ .brl_cancel_windows_fn = freebsd_brl_cancel_windows, ++ .strict_lock_check_fn = freebsd_strict_lock_check, ++ .translate_name_fn = freebsd_translate_name, ++ .fsctl_fn = freebsd_fsctl, ++ .readdir_attr_fn = freebsd_readdir_attr, ++ ++ /* DOS attributes. */ ++ .get_dos_attributes_fn = freebsd_get_dos_attributes, ++ .fget_dos_attributes_fn = freebsd_fget_dos_attributes, ++ .set_dos_attributes_fn = freebsd_set_dos_attributes, ++ .fset_dos_attributes_fn = freebsd_fset_dos_attributes, ++ ++ /* NT ACL operations. */ ++ ++ .fget_nt_acl_fn = freebsd_fget_nt_acl, ++ .get_nt_acl_fn = freebsd_get_nt_acl, ++ .fset_nt_acl_fn = freebsd_fset_nt_acl, ++ ++ /* POSIX ACL operations. */ ++ ++ .chmod_acl_fn = freebsd_chmod_acl, ++ .fchmod_acl_fn = freebsd_fchmod_acl, ++ ++ .sys_acl_get_file_fn = freebsd_sys_acl_get_file, ++ .sys_acl_get_fd_fn = freebsd_sys_acl_get_fd, ++ .sys_acl_blob_get_file_fn = freebsd_sys_acl_blob_get_file, ++ .sys_acl_blob_get_fd_fn = freebsd_sys_acl_blob_get_fd, ++ .sys_acl_set_file_fn = freebsd_sys_acl_set_file, ++ .sys_acl_set_fd_fn = freebsd_sys_acl_set_fd, ++ .sys_acl_delete_def_file_fn = freebsd_sys_acl_delete_def_file, ++ ++ /* EA operations. */ ++ .getxattr_fn = freebsd_getxattr, ++ .fgetxattr_fn = freebsd_fgetxattr, ++ .listxattr_fn = freebsd_listxattr, ++ .flistxattr_fn = freebsd_flistxattr, ++ .removexattr_fn = freebsd_removexattr, ++ .fremovexattr_fn = freebsd_fremovexattr, ++ .setxattr_fn = freebsd_setxattr, ++ .fsetxattr_fn = freebsd_fsetxattr, ++ ++ /* aio operations */ ++ .aio_force_fn = freebsd_aio_force, ++}; ++ ++static_decl_vfs; ++NTSTATUS vfs_freebsd_init(TALLOC_CTX *ctx) ++{ ++ ++ if(freebsd_in_jail()) ++ is_secure = false; ++ ++ return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "freebsd", ++ &freebsd_fns); ++} diff --git a/net/samba47/files/samba_server.in b/net/samba47/files/samba_server.in index c28ccebc695e..629b550f0f37 100644 --- a/net/samba47/files/samba_server.in +++ b/net/samba47/files/samba_server.in @@ -31,7 +31,7 @@ rcvar=${name}_enable samba_server_config_default="%%SAMBA4_CONFDIR%%/%%SAMBA4_CONFIG%%" smbcontrol_command="%%PREFIX%%/bin/smbcontrol" # Custom commands -extra_commands="reload status" +extra_commands="reload status configtest" start_precmd="samba_server_prestart" restart_precmd="samba_server_checkconfig" @@ -39,6 +39,7 @@ reload_precmd="samba_server_checkconfig" start_cmd="samba_server_cmd" stop_cmd="samba_server_cmd" status_cmd="samba_server_cmd" +configtest_cmd="samba_server_checkconfig" reload_cmd="samba_server_reload_cmd" rcvar_cmd="samba_server_rcvar_cmd" @@ -61,10 +62,6 @@ samba_server_prestart() { if [ -d "${samba_server_privatedir}" -o ! -e "${samba_server_privatedir}" ]; then install -d -m 0700 "${samba_server_privatedir}" fi -# # Remove smbd.pid before starting up samba(needed for s3fs) -# if [ -e "${samba_server_piddir}/smbd.pid" ] ; then -# rm -f "${samba_server_piddir}/smbd.pid" -# fi samba_server_checkconfig } |