Update port to the latest 4.8.9 version

Sponsored by:	CyberSecure
This commit is contained in:
Timur I. Bakeyev
2019-02-09 00:36:32 +00:00
parent 5a9e0ffbe4
commit d3e50c7b96
12 changed files with 927 additions and 2079 deletions

View File

@@ -13,7 +13,6 @@ COMMENT= Free SMB/CIFS and AD/DC server and client for Unix
LICENSE= GPLv3
BROKEN_powerpc64= fails to compile: auth.idl:107: Unable to determine origin of type struct cli_credentials
IGNORE_NONTHREAD_PYTHON= needs port lang/python${PYTHON_SUFFIX} to be build with THREADS support
CONFLICTS_INSTALL?= samba4-4.0.* samba4[1-79]-4.* p5-Parse-Pidl-4.*
@@ -21,12 +20,11 @@ CONFLICTS_INSTALL?= samba4-4.0.* samba4[1-79]-4.* p5-Parse-Pidl-4.*
EXTRA_PATCHES+= ${PATCHDIR}/0001-Zfs-provision-1.patch:-p1
EXTRA_PATCHES+= ${PATCHDIR}/0001-Freenas-master-mdns-fixes-22.patch:-p1
EXTRA_PATCHES+= ${PATCHDIR}/0001-audit.patch:-p1
EXTRA_PATCHES+= ${PATCHDIR}/0001-bug-13175.patch:-p1
EXTRA_PATCHES+= ${PATCHDIR}/0001-bug-228462.patch:-p1
SAMBA4_BASENAME= samba
SAMBA4_PORTNAME= ${SAMBA4_BASENAME}4
SAMBA4_VERSION= 4.8.7
SAMBA4_VERSION= 4.8.9
SAMBA4_DISTNAME= ${SAMBA4_BASENAME}-${SAMBA4_VERSION:S|.p|pre|:S|.r|rc|:S|.t|tp|:S|.a|alpha|}
WRKSRC?= ${WRKDIR}/${DISTNAME}
@@ -69,11 +67,9 @@ CONFIGURE_ARGS+= --mandir="${MANPREFIX}/man" \
--with-logfilebase="${SAMBA4_LOGDIR}"
# XXX: Flags
CONFIGURE_ENV+= PTHREAD_LDFLAGS="-lpthread"
CPPFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib
USES= cpe compiler waf pkgconfig perl5 \
iconv shebangfix
USES= compiler:c++11-lang cpe iconv \
localbase:ldflags perl5 pkgconfig shebangfix waf
USE_PERL5= build
USE_LDCONFIG= ${SAMBA4_LIBDIR}
WAF_CMD= buildtools/bin/waf
@@ -97,7 +93,7 @@ OPTIONS_DEFINE+= DEVELOPER MANDOC
OPTIONS_DEFINE_amd64= AESNI
OPTIONS_DEFAULT_amd64= AESNI
OPTIONS_DEFINE+= CLUSTER CUPS GPGME NTVFS SPOTLIGHT
OPTIONS_DEFINE+= CLUSTER CUPS GLUSTERFS GPGME NTVFS SPOTLIGHT
#OPTIONS_DEFINE+= MEMORY_DEBUG
OPTIONS_SINGLE= GSSAPI
@@ -105,7 +101,7 @@ OPTIONS_SINGLE= GSSAPI
OPTIONS_SINGLE_GSSAPI= GSSAPI_BUILTIN GSSAPI_MIT
OPTIONS_RADIO= DNS ZEROCONF
OPTIONS_RADIO_DNS= NSUPDATE BIND911
OPTIONS_RADIO_DNS= NSUPDATE BIND911 BIND912
OPTIONS_RADIO_ZEROCONF= MDNSRESPONDER AVAHI
##############################################################################
AD_DC_DESC= Active Directory Domain Controller
@@ -130,6 +126,7 @@ UTMP_DESC= UTMP accounting
GSSAPI_BUILTIN_DESC= GSSAPI support via bundled Heimdal
BIND911_DESC= Use Bind 9.11 as AD DC DNS server frontend
BIND912_DESC= Use Bind 9.12 as AD DC DNS server frontend
NSUPDATE_DESC= Use samba NSUPDATE utility for AD DC
##############################################################################
# XXX: Unconditional dependencies which can't be switched off(if present in
@@ -272,13 +269,16 @@ CONFIGURE_ARGS+= \
${ICONV_CONFIGURE_BASE}
##############################################################################
BIND911_RUN_DEPENDS= bind911>=9.11.0.0:dns/bind911
BIND912_RUN_DEPENDS= bind911>=9.12.0.0:dns/bind912
NSUPDATE_RUN_DEPENDS= samba-nsupdate:dns/samba-nsupdate
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
##############################################################################
DEBUG_CONFIGURE_ON= --verbose --enable-debug
DEBUG_MAKE_ARGS= --verbose
@@ -509,7 +509,8 @@ SAMBA4_SUB= SAMBA4_LOGDIR="${SAMBA4_LOGDIR}" \
SAMBA4_BINDDNSDIR="${SAMBA4_BINDDNSDIR}" \
SAMBA4_PRIVATEDIR="${SAMBA4_PRIVATEDIR}" \
SAMBA4_CONFDIR="${SAMBA4_CONFDIR}" \
SAMBA4_CONFIG="${SAMBA4_CONFIG}"
SAMBA4_CONFIG="${SAMBA4_CONFIG}" \
SAMBA4_SERVICES="${SAMBA4_SERVICES}"
PLIST_SUB+= ${SAMBA4_SUB}
SUB_LIST+= ${SAMBA4_SUB}

View File

@@ -1,3 +1,3 @@
TIMESTAMP = 1543311377
SHA256 (samba-4.8.7.tar.gz) = 0f6f67932e8bb23ab83b43070037ac452f9fc5f20763857d2b67e209ee7cd362
SIZE (samba-4.8.7.tar.gz) = 17724232
TIMESTAMP = 1549652430
SHA256 (samba-4.8.9.tar.gz) = ad2acf6bed436c125314a054f0589308eb664ac3d96cfb02d05e654a44e09c80
SIZE (samba-4.8.9.tar.gz) = 17750151

View File

@@ -1,143 +0,0 @@
From 60bdced298831b2750ce785e01891e4aeb79f0dc Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow@samba.org>
Date: Fri, 18 May 2018 13:14:57 +0200
Subject: [PATCH 1/2] s3:smbd: make psbuf arg to make_default_acl_posix() const
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13175
Signed-off-by: Ralph Boehme <slow@samba.org>
---
source3/smbd/posix_acls.c | 8 ++++----
source3/smbd/proto.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index 8d42535d877..6396f818176 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -4779,7 +4779,7 @@ int posix_sys_acl_blob_get_fd(vfs_handle_struct *handle,
static NTSTATUS make_default_acl_posix(TALLOC_CTX *ctx,
const char *name,
- SMB_STRUCT_STAT *psbuf,
+ const SMB_STRUCT_STAT *psbuf,
struct security_descriptor **ppdesc)
{
struct dom_sid owner_sid, group_sid;
@@ -4886,7 +4886,7 @@ static NTSTATUS make_default_acl_posix(TALLOC_CTX *ctx,
static NTSTATUS make_default_acl_windows(TALLOC_CTX *ctx,
const char *name,
- SMB_STRUCT_STAT *psbuf,
+ const SMB_STRUCT_STAT *psbuf,
struct security_descriptor **ppdesc)
{
struct dom_sid owner_sid, group_sid;
@@ -4958,7 +4958,7 @@ static NTSTATUS make_default_acl_windows(TALLOC_CTX *ctx,
static NTSTATUS make_default_acl_everyone(TALLOC_CTX *ctx,
const char *name,
- SMB_STRUCT_STAT *psbuf,
+ const SMB_STRUCT_STAT *psbuf,
struct security_descriptor **ppdesc)
{
struct dom_sid owner_sid, group_sid;
@@ -5022,7 +5022,7 @@ NTSTATUS make_default_filesystem_acl(
TALLOC_CTX *ctx,
enum default_acl_style acl_style,
const char *name,
- SMB_STRUCT_STAT *psbuf,
+ const SMB_STRUCT_STAT *psbuf,
struct security_descriptor **ppdesc)
{
NTSTATUS status;
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index bee7acadeea..262338d81e4 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -819,7 +819,7 @@ NTSTATUS make_default_filesystem_acl(
TALLOC_CTX *ctx,
enum default_acl_style acl_style,
const char *name,
- SMB_STRUCT_STAT *psbuf,
+ const SMB_STRUCT_STAT *psbuf,
struct security_descriptor **ppdesc);
/* The following definitions come from smbd/process.c */
--
2.13.6
From 0918370e20156e4a21a0c244b963b672ed6b46b1 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow@samba.org>
Date: Tue, 5 Dec 2017 08:28:28 +0100
Subject: [PATCH 2/2] vfs_zfsacl: return synthesized ACL when ZFS return
ENOTSUP
This allows accessing the ZFS .snapshots directory where ZFS returns
ENOTSUP when calling acl(".snapshots").
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13175
Signed-off-by: Ralph Boehme <slow@samba.org>
---
source3/modules/vfs_zfsacl.c | 36 ++++++++++++++++++++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c
index 0bc4ba6604f..43e41f95c1a 100644
--- a/source3/modules/vfs_zfsacl.c
+++ b/source3/modules/vfs_zfsacl.c
@@ -238,7 +238,20 @@ static NTSTATUS zfsacl_fget_nt_acl(struct vfs_handle_struct *handle,
fsp->fsp_name, &pacl);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(frame);
- return status;
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
+ return status;
+ }
+
+ status = make_default_filesystem_acl(mem_ctx,
+ DEFAULT_ACL_POSIX,
+ fsp->fsp_name->base_name,
+ &fsp->fsp_name->st,
+ ppdesc);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ (*ppdesc)->type |= SEC_DESC_DACL_PROTECTED;
+ return NT_STATUS_OK;
}
status = smb_fget_nt_acl_nfs4(fsp, NULL, security_info, mem_ctx,
@@ -260,7 +273,26 @@ static NTSTATUS zfsacl_get_nt_acl(struct vfs_handle_struct *handle,
status = zfs_get_nt_acl_common(handle->conn, frame, smb_fname, &pacl);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(frame);
- return status;
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
+ return status;
+ }
+
+ if (!VALID_STAT(smb_fname->st)) {
+ DBG_ERR("No stat info for [%s]\n",
+ smb_fname_str_dbg(smb_fname));
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ status = make_default_filesystem_acl(mem_ctx,
+ DEFAULT_ACL_POSIX,
+ smb_fname->base_name,
+ &smb_fname->st,
+ ppdesc);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ (*ppdesc)->type |= SEC_DESC_DACL_PROTECTED;
+ return NT_STATUS_OK;
}
status = smb_get_nt_acl_nfs4(handle->conn,
--
2.13.6

View File

@@ -13,25 +13,13 @@ FreeBSD Bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=228462
Signed-off-by: Ralph Boehme <slow@samba.org>
---
source3/modules/vfs_fruit.c | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index df3cd0c899e..d84e6991036 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -485,8 +485,9 @@ static int adouble_path(TALLOC_CTX *ctx,
struct smb_filename **ppsmb_fname_out);
static AfpInfo *afpinfo_new(TALLOC_CTX *ctx);
static ssize_t afpinfo_pack(const AfpInfo *ai, char *buf);
-static AfpInfo *afpinfo_unpack(TALLOC_CTX *ctx, const void *data);
-
+static AfpInfo *afpinfo_unpack(TALLOC_CTX *ctx,
+ const void *data,
+ const struct smb_filename *smb_fname);
/**
* Return a pointer to an AppleDouble entry
@@ -2073,13 +2074,17 @@ static ssize_t afpinfo_pack(const AfpInfo *ai, char *buf)
@@ -2350,6 +2350,8 @@ static ssize_t afpinfo_pack(const AfpInf
return AFP_INFO_SIZE;
}
@@ -40,17 +28,7 @@ index df3cd0c899e..d84e6991036 100644
/**
* Unpack a buffer into a AfpInfo structure
*
* Buffer size must be at least AFP_INFO_SIZE
* Returns allocated AfpInfo struct
**/
-static AfpInfo *afpinfo_unpack(TALLOC_CTX *ctx, const void *data)
+static AfpInfo *afpinfo_unpack(TALLOC_CTX *ctx,
+ const void *data,
+ const struct smb_filename *smb_fname)
{
AfpInfo *ai = talloc_zero(ctx, AfpInfo);
if (ai == NULL) {
@@ -2092,10 +2097,21 @@ static AfpInfo *afpinfo_unpack(TALLOC_CTX *ctx, const void *data)
@@ -2369,10 +2371,20 @@ static AfpInfo *afpinfo_unpack(TALLOC_CT
memcpy(ai->afpi_FinderInfo, (const char *)data + 16,
sizeof(ai->afpi_FinderInfo));
@@ -58,8 +36,7 @@ index df3cd0c899e..d84e6991036 100644
- || ai->afpi_Version != AFP_Version) {
- DEBUG(1, ("Bad AfpInfo signature or version\n"));
+ if (ai->afpi_Signature != AFP_Signature) {
+ DBG_WARNING("Bad signature [%x] on [%s]\n",
+ ai->afpi_Signature, smb_fname_str_dbg(smb_fname));
+ DBG_WARNING("Bad AFP signature [%x]\n", ai->afpi_Signature);
+
+ if (ai->afpi_Signature != BROKEN_FREEBSD_AFP_Signature) {
+ DBG_ERR("Bad AfpInfo signature\n");
@@ -75,100 +52,20 @@ index df3cd0c899e..d84e6991036 100644
}
return ai;
@@ -4222,7 +4238,7 @@ static ssize_t fruit_pwrite_meta_stream(vfs_handle_struct *handle,
size_t nwritten;
bool ok;
- ai = afpinfo_unpack(talloc_tos(), data);
+ ai = afpinfo_unpack(talloc_tos(), data, fsp->fsp_name);
if (ai == NULL) {
return -1;
}
@@ -4260,7 +4276,7 @@ static ssize_t fruit_pwrite_meta_netatalk(vfs_handle_struct *handle,
int ret;
bool ok;
- ai = afpinfo_unpack(talloc_tos(), data);
+ ai = afpinfo_unpack(talloc_tos(), data, fsp->fsp_name);
if (ai == NULL) {
return -1;
}
--
2.16.3
From 83ce03a278ec9d15b595f4daf8da1641d27ebdd6 Mon Sep 17 00:00:00 2001
From: "Timur I. Bakeyev" <timur@iXsystems.com>
Date: Fri, 1 Jun 2018 01:35:58 +0800
Subject: [PATCH 2/2] vfs_streams_xattr: don't append 0 byte when creating
xattr
Upstream Samba always appends an internal 0-byte to xattrs to cope
with filesytems or systems that don't support 0-byte sized xattrs.
An older patch already remove this behaviour from the read and write
code paths, but didn't remove it from the create codepath.
FreeBSD Bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=228462
Signed-off-by: Ralph Boehme <slow@samba.org>
---
source3/modules/vfs_streams_xattr.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c
index 8714007cb8d..5f3dfb30beb 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -476,19 +476,13 @@ static int streams_xattr_open(vfs_handle_struct *handle,
/*
* The attribute does not exist or needs to be truncated
*/
-
- /*
- * Darn, xattrs need at least 1 byte
- */
- char null = '\0';
-
DEBUG(10, ("creating or truncating attribute %s on file %s\n",
xattr_name, smb_fname->base_name));
ret = SMB_VFS_SETXATTR(fsp->conn,
smb_fname,
xattr_name,
- &null, sizeof(null),
+ NULL, 0,
flags & O_EXCL ? XATTR_CREATE : 0);
if (ret != 0) {
goto fail;
--
2.16.3
From daa9930fc10459f0567931622e2ffbb636e365f0 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow@samba.org>
Date: Sat, 19 May 2018 01:35:45 +0200
Subject: [PATCH] vfs_fruit: fixup broken AFP_Signatures
FreeBSD Bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=228462
Signed-off-by: Ralph Boehme <slow@samba.org>
---
source3/modules/vfs_fruit.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index d92049cc899..0594fd7a538 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -3935,10 +3935,16 @@ static ssize_t fruit_pread_meta_stream(vfs_handle_struct *handle,
@@ -4171,9 +4183,20 @@ static ssize_t fruit_pread_meta_stream(v
{
ssize_t nread;
int ret;
+ char *p = (char *)data;
nread = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
if (nread == n) {
- if (nread == -1 || nread == n) {
+
+ if (nread == -1) {
+ return -1;
+ }
+
+ if (nread == n) {
+ if (offset == 0 && nread > 3 && p[0] == 0 && p[1] == 'F' && p[2] == 'P') {
+ DBG_NOTICE("Fixing AFP_Info of [%s]\n",
+ fsp_str_dbg(fsp));
@@ -177,6 +74,3 @@ index d92049cc899..0594fd7a538 100644
return nread;
}
--
2.17.0

View File

@@ -0,0 +1,29 @@
--- python/samba/provision/sambadns.py.orig 2018-01-17 09:08:39 UTC
+++ python/samba/provision/sambadns.py
@@ -937,6 +937,7 @@ def create_named_conf(paths, realm, dnsd
bind9_9 = '#'
bind9_10 = '#'
bind9_11 = '#'
+ bind9_12 = '#'
if bind_info.upper().find('BIND 9.8') != -1:
bind9_8 = ''
elif bind_info.upper().find('BIND 9.9') != -1:
@@ -945,6 +946,8 @@ def create_named_conf(paths, realm, dnsd
bind9_10 = ''
elif bind_info.upper().find('BIND 9.11') != -1:
bind9_11 = ''
+ elif bind_info.upper().find('BIND 9.12') != -1:
+ bind9_12 = ''
elif bind_info.upper().find('BIND 9.7') != -1:
raise ProvisioningError("DLZ option incompatible with BIND 9.7.")
else:
@@ -955,7 +958,8 @@ def create_named_conf(paths, realm, dnsd
"BIND9_8" : bind9_8,
"BIND9_9" : bind9_9,
"BIND9_10" : bind9_10,
- "BIND9_11" : bind9_11
+ "BIND9_11" : bind9_11,
+ "BIND9_12" : bind9_12
})

View File

@@ -0,0 +1,18 @@
--- source3/lib/sysquotas_4B.c.orig 2019-01-28 03:56:23 UTC
+++ source3/lib/sysquotas_4B.c
@@ -141,7 +141,14 @@ static int sys_quotactl_4B(const char *
/* ENOTSUP means quota support is not compiled in. EINVAL
* means that quotas are not configured (commonly).
*/
- if (errno != ENOTSUP && errno != EINVAL) {
+ if (errno != ENOTSUP && errno != EINVAL
+/*
+ * FreeBSD 12 between r336017 and r342928 wrongfuly return ENOENT for the not enabled qoutas on ZFS.
+ */
+#if defined(__FreeBSD__) && ((__FreeBSD_version >= 1102503 && __FreeBSD_version <= 1102506) || (__FreeBSD_version >= 1200072 && __FreeBSD_version <= 1200503) || (__FreeBSD_version >= 1300000 && __FreeBSD_version <= 1300009))
+ && errno != ENOENT
+#endif
+ ) {
DEBUG(0, ("failed to %s quota for %s ID %u on %s: %s\n",
(cmd & QCMD(Q_GETQUOTA, 0)) ? "get" : "set",
(cmd & QCMD(0, GRPQUOTA)) ? "group" : "user",

View File

@@ -0,0 +1,798 @@
--- /dev/null 2018-11-29 02:13:13 UTC
+++ source3/modules/vfs_freebsd.c
@@ -0,0 +1,795 @@
+/*
+ * 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 "lib/util/tevent_unix.h"
+#include "lib/util/tevent_ntstatus.h"
+#include "system/filesys.h"
+
+#include <sys/sysctl.h>
+
+static int vfs_freebsd_debug_level = DBGC_VFS;
+
+#undef DBGC_CLASS
+#define DBGC_CLASS vfs_freebsd_debug_level
+
+#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
+
+enum extattr_mode {
+ FREEBSD_EXTATTR_SECURE,
+ FREEBSD_EXTATTR_COMPAT,
+ FREEBSD_EXTATTR_LEGACY
+};
+
+typedef struct {
+ int namespace;
+ char name[EXTATTR_MAXNAMELEN+1];
+ union {
+ uint16_t len;
+ uint16_t flags;
+ } data;
+} extattr_attr;
+
+typedef struct {
+ enum {
+ EXTATTR_FILE, EXTATTR_LINK, EXTATTR_FDES
+ } method;
+ union {
+ const char *path;
+ int filedes;
+ } param;
+} extattr_arg;
+
+static const struct enum_list extattr_mode_param[] = {
+ { FREEBSD_EXTATTR_SECURE, "secure" }, /* */
+ { FREEBSD_EXTATTR_COMPAT, "compat" }, /* */
+ { FREEBSD_EXTATTR_LEGACY, "legacy" }, /* */
+ { -1, NULL }
+};
+
+
+/* */
+struct freebsd_handle_data {
+ enum extattr_mode extattr_mode;
+};
+
+
+/* XXX: This order doesn't match namespace ids order! */
+static extattr_attr extattr[] = {
+ { EXTATTR_NAMESPACE(EMPTY) },
+ { EXTATTR_NAMESPACE(SYSTEM) },
+ { EXTATTR_NAMESPACE(USER) },
+};
+
+
+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(enum extattr_mode extattr_mode, 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(extattr_mode == FREEBSD_EXTATTR_LEGACY)
+ attrname = name + 5;
+ break;
+ case EXTATTR_SECURITY:
+ case EXTATTR_TRUSTED:
+ attrnamespace = (extattr_mode == FREEBSD_EXTATTR_SECURE) ?
+ EXTATTR_NAMESPACE_SYSTEM :
+ EXTATTR_NAMESPACE_USER;
+ break;
+ case EXTATTR_SYSTEM:
+ attrnamespace = (extattr_mode == FREEBSD_EXTATTR_SECURE) ?
+ EXTATTR_NAMESPACE_SYSTEM :
+ EXTATTR_NAMESPACE_USER;
+ if (extattr_mode == FREEBSD_EXTATTR_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 EXTATTR_FILE:
+ result = extattr_get_file(arg.param.path, attr->namespace, attr->name, NULL, 0);
+ break;
+#endif
+#if defined(HAVE_EXTATTR_GET_LINK)
+ case EXTATTR_LINK:
+ result = extattr_get_link(arg.param.path, attr->namespace, attr->name, NULL, 0);
+ break;
+#endif
+#if defined(HAVE_EXTATTR_GET_FD)
+ case EXTATTR_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, enum extattr_mode extattr_mode, 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 = (extattr_mode == FREEBSD_EXTATTR_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 EXTATTR_FILE:
+ list_size = extattr_list_file(arg.param.path, extattr[ns].namespace, list, size);
+ break;
+#endif
+#if defined(HAVE_EXTATTR_LIST_LINK)
+ case EXTATTR_LINK:
+ list_size = extattr_list_link(arg.param.path, extattr[ns].namespace, list, size);
+ break;
+#endif
+#if defined(HAVE_EXTATTR_LIST_FD)
+ case EXTATTR_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(extattr_mode == FREEBSD_EXTATTR_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(extattr_mode == FREEBSD_EXTATTR_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(extattr_mode != FREEBSD_EXTATTR_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)
+{
+ struct freebsd_handle_data *data;
+ extattr_arg arg = { EXTATTR_FILE, smb_fname->base_name };
+ extattr_attr attr;
+
+
+ SMB_VFS_HANDLE_GET_DATA(handle, data,
+ struct freebsd_handle_data,
+ return -1);
+
+ if(!freebsd_map_xattr(data->extattr_mode, name, &attr)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if(data->extattr_mode != FREEBSD_EXTATTR_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)
+ struct freebsd_handle_data *data;
+ extattr_arg arg = { EXTATTR_FILE, .param.path = smb_fname->base_name };
+ extattr_attr attr;
+ ssize_t res;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, data,
+ struct freebsd_handle_data,
+ return -1);
+
+ if(!freebsd_map_xattr(data->extattr_mode, name, &attr)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* Filter out 'secure' entries */
+ if(data->extattr_mode != FREEBSD_EXTATTR_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)
+ struct freebsd_handle_data *data;
+ extattr_arg arg = { EXTATTR_FDES, .param.filedes = fsp->fh->fd };
+ extattr_attr attr;
+ ssize_t res;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, data,
+ struct freebsd_handle_data,
+ return -1);
+
+ if(!freebsd_map_xattr(data->extattr_mode, name, &attr)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* Filter out 'secure' entries */
+ if(data->extattr_mode != FREEBSD_EXTATTR_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)
+ struct freebsd_handle_data *data;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, data,
+ struct freebsd_handle_data,
+ return -1);
+
+ extattr_arg arg = { EXTATTR_FILE, .param.path = smb_fname->base_name };
+
+ return freebsd_extattr_list(arg, data->extattr_mode, 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)
+ struct freebsd_handle_data *data;
+ extattr_arg arg = { EXTATTR_FDES, .param.filedes = fsp->fh->fd };
+
+ SMB_VFS_HANDLE_GET_DATA(handle, data,
+ struct freebsd_handle_data,
+ return -1);
+
+ return freebsd_extattr_list(arg, data->extattr_mode, 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)
+ struct freebsd_handle_data *data;
+ extattr_attr attr;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, data,
+ struct freebsd_handle_data,
+ return -1);
+
+
+ /* Filter out 'secure' entries */
+ if(data->extattr_mode != FREEBSD_EXTATTR_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)
+ struct freebsd_handle_data *data;
+ extattr_attr attr;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, data,
+ struct freebsd_handle_data,
+ return -1);
+
+ if(!freebsd_map_xattr(data->extattr_mode, name, &attr)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* Filter out 'secure' entries */
+ if(data->extattr_mode != FREEBSD_EXTATTR_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)
+ struct freebsd_handle_data *data;
+ extattr_attr attr;
+ ssize_t res;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, data,
+ struct freebsd_handle_data,
+ return -1);
+
+ if(!freebsd_map_xattr(data->extattr_mode, name, &attr)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* Filter out 'secure' entries */
+ if(data->extattr_mode != FREEBSD_EXTATTR_SECURE && geteuid() != 0 && attr.data.flags > EXTATTR_USER) {
+ errno = ENOATTR;
+ return -1;
+ }
+
+ if (flags) {
+ extattr_arg arg = { EXTATTR_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)
+ struct freebsd_handle_data *data;
+ extattr_attr attr;
+ ssize_t res;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, data,
+ struct freebsd_handle_data,
+ return -1);
+
+ if(!freebsd_map_xattr(data->extattr_mode, name, &attr)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* Filter out 'secure' entries */
+ if(data->extattr_mode != FREEBSD_EXTATTR_SECURE && geteuid() != 0 && attr.data.flags > EXTATTR_USER) {
+ errno = ENOATTR;
+ return -1;
+ }
+
+ if (flags) {
+ extattr_arg arg = { EXTATTR_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)
+{
+ struct freebsd_handle_data *data;
+ int enumval, saved_errno;
+
+ int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+
+ if (ret < 0) {
+ return ret;
+ }
+
+ data = talloc_zero(handle->conn, struct freebsd_handle_data);
+ if (!data) {
+ saved_errno = errno;
+ SMB_VFS_NEXT_DISCONNECT(handle);
+ DEBUG(0, ("talloc_zero() failed\n"));
+ errno = saved_errno;
+ return -1;
+ }
+
+ enumval = lp_parm_enum(SNUM(handle->conn), "freebsd",
+ "extattr mode", extattr_mode_param, FREEBSD_EXTATTR_LEGACY);
+ if (enumval == -1) {
+ saved_errno = errno;
+ SMB_VFS_NEXT_DISCONNECT(handle);
+ DBG_DEBUG("value for freebsd: 'extattr mode' is unknown\n");
+ errno = saved_errno;
+ return -1;
+ }
+
+ if(freebsd_in_jail()) {
+ enumval = FREEBSD_EXTATTR_COMPAT;
+ DBG_WARNING("running in jail, enforcing 'compat' mode\n");
+ }
+
+ data->extattr_mode = (enum extattr_mode)enumval;
+
+ SMB_VFS_HANDLE_SET_DATA(handle, data, NULL,
+ struct freebsd_handle_data,
+ return -1);
+
+ DBG_DEBUG("connect to service[%s] with '%s' extattr mode\n",
+ service, extattr_mode_param[data->extattr_mode].name);
+
+ return 0;
+}
+
+static void freebsd_disconnect(vfs_handle_struct *handle)
+{
+ SMB_VFS_NEXT_DISCONNECT(handle);
+}
+
+/* VFS operations structure */
+
+struct vfs_fn_pointers freebsd_fns = {
+ /* Disk operations */
+
+ .connect_fn = freebsd_connect,
+ .disconnect_fn = freebsd_disconnect,
+
+ /* 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,
+};
+
+static_decl_vfs;
+NTSTATUS vfs_freebsd_init(TALLOC_CTX *ctx)
+{
+ NTSTATUS ret;
+
+ ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "freebsd",
+ &freebsd_fns);
+
+ if (!NT_STATUS_IS_OK(ret)) {
+ return ret;
+ }
+
+ vfs_freebsd_debug_level = debug_add_class("freebsd");
+ if (vfs_freebsd_debug_level == -1) {
+ vfs_freebsd_debug_level = DBGC_VFS;
+ DEBUG(0, ("vfs_freebsd: Couldn't register custom debugging class!\n"));
+ } else {
+ DEBUG(10, ("vfs_freebsd: Debug class number of 'fileid': %d\n", vfs_freebsd_debug_level));
+ }
+
+ return ret;
+}

View File

@@ -1,4 +1,4 @@
--- source3/modules/vfs_streams_xattr.c.orig 2018-08-11 23:00:01 UTC
--- source3/modules/vfs_streams_xattr.c.orig 2018-11-08 07:58:08 UTC
+++ source3/modules/vfs_streams_xattr.c
@@ -1,10 +1,10 @@
/*
@@ -141,9 +141,9 @@
if (sbuf->st_ex_size == -1) {
TALLOC_FREE(smb_fname_base);
SET_STAT_INVALID(*sbuf);
@@ -453,10 +508,10 @@ static int streams_xattr_open(vfs_handle
pipe_fds[1] = -1;
fakefd = pipe_fds[0];
@@ -441,10 +496,10 @@ static int streams_xattr_open(vfs_handle
goto fail;
}
- status = get_ea_value(talloc_tos(), handle->conn, NULL,
- smb_fname, xattr_name, &ea);
@@ -153,9 +153,30 @@
- DEBUG(10, ("get_ea_value returned %s\n", nt_errstr(status)));
+ DEBUG(10, ("get_xattr_value returned %s\n", nt_errstr(status)));
if (!NT_STATUS_IS_OK(status)
&& !NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
@@ -625,8 +680,8 @@ static int streams_xattr_rename(vfs_hand
if (!NT_STATUS_IS_OK(status)) {
if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
@@ -475,19 +530,13 @@ static int streams_xattr_open(vfs_handle
/*
* The attribute does not exist or needs to be truncated
*/
-
- /*
- * Darn, xattrs need at least 1 byte
- */
- char null = '\0';
-
DEBUG(10, ("creating or truncating attribute %s on file %s\n",
xattr_name, smb_fname->base_name));
ret = SMB_VFS_SETXATTR(fsp->conn,
smb_fname,
xattr_name,
- &null, sizeof(null),
+ NULL, 0,
flags & O_EXCL ? XATTR_CREATE : 0);
if (ret != 0) {
goto fail;
@@ -643,8 +692,8 @@ static int streams_xattr_rename(vfs_hand
}
/* read the old stream */
@@ -166,7 +187,7 @@
if (!NT_STATUS_IS_OK(status)) {
errno = ENOENT;
goto fail;
@@ -713,14 +768,13 @@ static NTSTATUS walk_xattr_streams(vfs_h
@@ -731,14 +780,13 @@ static NTSTATUS walk_xattr_streams(vfs_h
continue;
}
@@ -183,7 +204,7 @@
names[i],
smb_fname->base_name,
nt_errstr(status)));
@@ -782,16 +836,17 @@ struct streaminfo_state {
@@ -800,16 +848,17 @@ struct streaminfo_state {
NTSTATUS status;
};
@@ -204,7 +225,7 @@
state->status = NT_STATUS_NO_MEMORY;
return false;
}
@@ -911,14 +966,17 @@ static ssize_t streams_xattr_pwrite(vfs_
@@ -929,14 +978,17 @@ static ssize_t streams_xattr_pwrite(vfs_
files_struct *fsp, const void *data,
size_t n, off_t offset)
{
@@ -225,7 +246,7 @@
if (sio == NULL) {
return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
@@ -928,6 +986,8 @@ static ssize_t streams_xattr_pwrite(vfs_
@@ -946,6 +998,8 @@ static ssize_t streams_xattr_pwrite(vfs_
return -1;
}
@@ -234,7 +255,7 @@
/* Create an smb_filename with stream_name == NULL. */
smb_fname_base = synthetic_smb_fname(talloc_tos(),
sio->base,
@@ -935,39 +995,55 @@ static ssize_t streams_xattr_pwrite(vfs_
@@ -953,39 +1007,55 @@ static ssize_t streams_xattr_pwrite(vfs_
NULL,
fsp->fsp_name->flags);
if (smb_fname_base == NULL) {
@@ -311,7 +332,7 @@
if (ret == -1) {
return -1;
@@ -980,15 +1056,17 @@ static ssize_t streams_xattr_pread(vfs_h
@@ -998,15 +1068,17 @@ static ssize_t streams_xattr_pread(vfs_h
files_struct *fsp, void *data,
size_t n, off_t offset)
{
@@ -334,7 +355,7 @@
if (sio == NULL) {
return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
@@ -998,6 +1076,8 @@ static ssize_t streams_xattr_pread(vfs_h
@@ -1016,6 +1088,8 @@ static ssize_t streams_xattr_pread(vfs_h
return -1;
}
@@ -343,7 +364,7 @@
/* Create an smb_filename with stream_name == NULL. */
smb_fname_base = synthetic_smb_fname(talloc_tos(),
sio->base,
@@ -1005,31 +1085,35 @@ static ssize_t streams_xattr_pread(vfs_h
@@ -1023,31 +1097,35 @@ static ssize_t streams_xattr_pread(vfs_h
NULL,
fsp->fsp_name->flags);
if (smb_fname_base == NULL) {
@@ -392,7 +413,7 @@
}
struct streams_xattr_pread_state {
@@ -1196,16 +1280,18 @@ static int streams_xattr_ftruncate(struc
@@ -1214,16 +1292,18 @@ static int streams_xattr_ftruncate(struc
struct files_struct *fsp,
off_t offset)
{
@@ -418,7 +439,7 @@
if (sio == NULL) {
return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
@@ -1215,6 +1301,8 @@ static int streams_xattr_ftruncate(struc
@@ -1233,6 +1313,8 @@ static int streams_xattr_ftruncate(struc
return -1;
}
@@ -427,7 +448,7 @@
/* Create an smb_filename with stream_name == NULL. */
smb_fname_base = synthetic_smb_fname(talloc_tos(),
sio->base,
@@ -1222,40 +1310,46 @@ static int streams_xattr_ftruncate(struc
@@ -1240,40 +1322,46 @@ static int streams_xattr_ftruncate(struc
NULL,
fsp->fsp_name->flags);
if (smb_fname_base == NULL) {
@@ -490,7 +511,7 @@
if (ret == -1) {
return -1;
@@ -1273,9 +1367,9 @@ static int streams_xattr_fallocate(struc
@@ -1291,9 +1379,9 @@ static int streams_xattr_fallocate(struc
struct stream_io *sio =
(struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp);

View File

@@ -0,0 +1,11 @@
--- source4/setup/named.conf.dlz.orig 2018-01-14 22:41:59 UTC
+++ source4/setup/named.conf.dlz
@@ -21,5 +21,8 @@ dlz "AD DNS Zone" {
# For BIND 9.11.x
${BIND9_11} database "dlopen ${MODULESDIR}/bind9/dlz_bind9_11.so";
+
+ # For BIND 9.12.x
+ ${BIND9_12} database "dlopen ${MODULESDIR}/bind9/dlz_bind9_12.so";
};

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@
#
# PROVIDE: samba_server
# REQUIRE: NETWORKING SERVERS DAEMON ldconfig resolv ntpd
# REQUIRE: NETWORKING SERVERS DAEMON ldconfig resolv ntpd %%SAMBA4_SERVICES%%
# BEFORE: LOGIN
# KEYWORD: shutdown
#

View File

@@ -208,6 +208,7 @@ lib/samba4/private/libcli-spoolss-samba4.so
lib/samba4/private/libcliauth-samba4.so
lib/samba4/private/libcluster-samba4.so
lib/samba4/private/libcmdline-credentials-samba4.so
lib/samba4/private/libcmdline-contexts-samba4.so
%%GSSAPI_BUILTIN%%lib/samba4/private/libcom_err-samba4.so.0
lib/samba4/private/libcommon-auth-samba4.so
%%AD_DC%%lib/samba4/private/libdb-glue-samba4.so
@@ -254,6 +255,7 @@ lib/samba4/private/libnpa-tstream-samba4.so
lib/samba4/private/libnss-info-samba4.so
%%AD_DC%%lib/samba4/private/libpac-samba4.so
lib/samba4/private/libpopt-samba3-samba4.so
lib/samba4/private/libpopt-samba3-cmdline-samba4.so
lib/samba4/private/libprinting-migrate-samba4.so
lib/samba4/private/libregistry-samba4.so
lib/samba4/private/libreplace-samba4.so
@@ -378,6 +380,7 @@ lib/shared-modules/vfs/extd_audit.so
lib/shared-modules/vfs/fake_perms.so
lib/shared-modules/vfs/fruit.so
lib/shared-modules/vfs/full_audit.so
lib/shared-modules/vfs/glusterfs_fuse.so
lib/shared-modules/vfs/linux_xfs_sgid.so
lib/shared-modules/vfs/media_harmony.so
lib/shared-modules/vfs/netatalk.so
@@ -1182,6 +1185,7 @@ man/man8/vfs_fileid.8.gz
man/man8/vfs_fruit.8.gz
man/man8/vfs_full_audit.8.gz
man/man8/vfs_glusterfs.8.gz
man/man8/vfs_glusterfs_fuse.8.gz
man/man8/vfs_linux_xfs_sgid.8.gz
man/man8/vfs_media_harmony.8.gz
man/man8/vfs_netatalk.8.gz