samba.git
4 years agoVERSION: Disable GIT_SNAPSHOT for the 4.10.13 release. samba-4.10.13
Karolin Seeger [Thu, 23 Jan 2020 15:17:03 +0000 (16:17 +0100)]
VERSION: Disable GIT_SNAPSHOT for the 4.10.13 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoWHATSNEW: Add release notes for Samba 4.10.13.
Karolin Seeger [Thu, 23 Jan 2020 15:15:55 +0000 (16:15 +0100)]
WHATSNEW: Add release notes for Samba 4.10.13.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoscript/release.sh: make it possible to run from a git worktree
Stefan Metzmacher [Tue, 21 Jan 2020 18:25:00 +0000 (19:25 +0100)]
script/release.sh: make it possible to run from a git worktree

.git is a regular file in that case.

Also check that script/release.sh is present as a relative path
to ensure we're called from the expected location.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 648f94d2031c6e758bdf54089d1e710c265ca732)

4 years agoVERSION: Bump version up to 4.10.13.
Karolin Seeger [Tue, 21 Jan 2020 10:05:28 +0000 (11:05 +0100)]
VERSION: Bump version up to 4.10.13.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoMerge tag 'samba-4.10.12' into v4-10-test
Karolin Seeger [Tue, 21 Jan 2020 10:05:05 +0000 (11:05 +0100)]
Merge tag 'samba-4.10.12' into v4-10-test

samba: tag release samba-4.10.12

4 years agoctdb-tests: Skip some tests that don't work with IPv6
Martin Schwenke [Thu, 28 Nov 2019 03:00:58 +0000 (14:00 +1100)]
ctdb-tests: Skip some tests that don't work with IPv6

See the comments added to the tests.

It may be possible to rewrite these so they do something sane for
IPv6... some other time.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14227
RN: Fix IPv6 issues (NFS connection tracking, tests)

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Jan  3 00:00:55 UTC 2020 on sn-devel-184

(backported from commit 9edf15afc219a1a782ec1e4d29909361bbabc744)

Signed-off-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(v4-10-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-10-test): Tue Jan 14 12:46:17 UTC 2020 on sn-devel-144

4 years agoVERSION: Disable GIT_SNAPSHOT for the 4.10.12 release. samba-4.10.12
Karolin Seeger [Thu, 9 Jan 2020 11:51:27 +0000 (12:51 +0100)]
VERSION: Disable GIT_SNAPSHOT for the 4.10.12 release.

o CVE-2019-14902: Replication of ACLs set to inherit down a subtree on AD
                  Directory not automatic.
o CVE-2019-14907: Crash after failed character conversion at log level 3 or
                  above.
o CVE-2019-19344: Use after free during DNS zone scavenging in Samba AD DC.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoWHATSNEW: Add release notes for Samba 4.11.5.
Karolin Seeger [Thu, 9 Jan 2020 11:48:31 +0000 (12:48 +0100)]
WHATSNEW: Add release notes for Samba 4.11.5.

o CVE-2019-14902: Replication of ACLs set to inherit down a subtree on AD
                  Directory not automatic.
o CVE-2019-14907: Crash after failed character conversion at log level 3 or
                  above.
o CVE-2019-19344: Use after free during DNS zone scavenging in Samba AD DC.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoctdb-scripts: Strip square brackets when gathering connection info
Martin Schwenke [Fri, 13 Dec 2019 00:09:04 +0000 (11:09 +1100)]
ctdb-scripts: Strip square brackets when gathering connection info

ss added square brackets around IPv6 addresses in versions > 4.12.0
via commit aba9c23a6e1cb134840c998df14888dca469a485.  CentOS 7 added
this feature somewhere mid-release.  So, backward compatibility is
obviously needed.

As per the comment protocol/protocol_util.c should probably print and
parse such square brackets.  However, for backward compatibility the
brackets would have to be stripped in both places in
update_tickles()...  or added to the ss output when missing.  Best to
leave this until we have a connection tracking daemon.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14227

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 693080abe4d8bec96280af5a6aa668251a98ec5d)

4 years agolibrpc: Fix string length checking in ndr_pull_charset_to_null()
Andreas Schneider [Mon, 16 Dec 2019 14:50:17 +0000 (15:50 +0100)]
librpc: Fix string length checking in ndr_pull_charset_to_null()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14219

Pair-Programmed-With: Guenther Deschner <gd@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit f11e207e01c52566c47e350ff240fe95392de0c3)

4 years agoupgradedns: ensure lmdb lock files linked
Gary Lockyer [Thu, 19 Dec 2019 03:31:46 +0000 (16:31 +1300)]
upgradedns: ensure lmdb lock files linked

Ensure that the '-lock' files for the dns partitions as well as the data
files are linked when running
  samba_dnsupgrade --dns-backend=BIND9_DLZ
failure to create these links can cause corruption of the corresponding
data file.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14199

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 0bd479140c18ab79479ced4f25f366744c3afe18)

4 years agotest upgradedns: ensure lmdb lock files linked
Gary Lockyer [Thu, 19 Dec 2019 03:31:24 +0000 (16:31 +1300)]
test upgradedns: ensure lmdb lock files linked

Add tests to check that the '-lock' files for the dns partitions as well as
the data files are linked when running
    samba_dnsupgrade --dns-backend=BIND9_DLZ
failure to create these links can cause corruption of the corresponding
data file.

Changes to python/samba/tests/__init__.py adding run_command manually
copied from commit b27817d491794a292278832e3f59f955f418a6cb

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14199

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit f0cebbe4dd0317e2abfcbe252977383e6f37f3bd)

4 years agodocs-xml/winbindnssinfo: clarify interaction with idmap_ad etc.
Björn Jacke [Tue, 7 Jan 2020 09:21:18 +0000 (10:21 +0100)]
docs-xml/winbindnssinfo: clarify interaction with idmap_ad etc.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14122
RN: docs: clarify interaction between winbind nss info and idmap backend

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Jan  8 15:37:46 UTC 2020 on sn-devel-184

(cherry picked from commit 55fbd4c05b477e95920b53b94eda2572e075e6e1)

4 years agolibsmbclient: If over SMB1 first try to do a posix stat on the file.
Andreas Schneider [Mon, 25 Nov 2019 10:11:13 +0000 (11:11 +0100)]
libsmbclient: If over SMB1 first try to do a posix stat on the file.

Disable in future, if server doesn't support this.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14101

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Dec 19 15:44:25 UTC 2019 on sn-devel-184

(cherry picked from commit 8b04590e4d8f817ad6d194bb9d622c18734e3011)

4 years agos3:libsmb: Add a setup_stat_from_stat_ex() function
Andreas Schneider [Mon, 25 Nov 2019 10:10:49 +0000 (11:10 +0100)]
s3:libsmb: Add a setup_stat_from_stat_ex() function

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14101

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit b3e3cb3bbd86a53b48ee009adf811d48dd50dc8b)

4 years agos3:libsmb: Return a 'struct stat' buffer for SMBC_getatr()
Andreas Schneider [Mon, 25 Nov 2019 10:09:52 +0000 (11:09 +0100)]
s3:libsmb: Return a 'struct stat' buffer for SMBC_getatr()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14101

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 0fe9dc5219beaf605da9c7922053f7324507b50e)

4 years agos3:libsmb: Add try_posixinfo to SMBSRV struct. Only enable for SMB1 with UNIX for...
Andreas Schneider [Mon, 25 Nov 2019 10:06:57 +0000 (11:06 +0100)]
s3:libsmb: Add try_posixinfo to SMBSRV struct. Only enable for SMB1 with UNIX for now.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14101

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit bf9a3a7aa1913238ae2c997ce00369d0dbae3a08)

4 years agos3:libsmb: Generate the inode only based on the path component
Andreas Schneider [Wed, 18 Dec 2019 12:27:26 +0000 (13:27 +0100)]
s3:libsmb: Generate the inode only based on the path component

Currently we use the full smb url which includes also username and
password.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14101

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit ea51a426e506bd6456814ecddcb63441859f9d89)

4 years agos3: libsmb: Move setting all struct stat fields into setup_stat().
Jeremy Allison [Fri, 18 Oct 2019 17:48:55 +0000 (10:48 -0700)]
s3: libsmb: Move setting all struct stat fields into setup_stat().

That way we only have one place where a struct stat is synthesised
for libsmbclient callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 1f0715c0e5e6ff371e3b393a0b35222c8b6f49bc)

4 years agos3: libsmb: Move setting st->st_ino into setup_stat.
Jeremy Allison [Fri, 18 Oct 2019 16:34:02 +0000 (09:34 -0700)]
s3: libsmb: Move setting st->st_ino into setup_stat.

Signed-off-by: Puran Chand <pchand@vmware.com>
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 7d3b4f47be0359b496087fc40f89b815c7958dd6)

4 years agos3: libsmb: Change generate_inode()/setup_stat() to modern coding standards.
Jeremy Allison [Fri, 18 Oct 2019 16:24:38 +0000 (09:24 -0700)]
s3: libsmb: Change generate_inode()/setup_stat() to modern coding standards.

Change setup_stat() to be void. It doesn't return anything. Export
so it can be used by upcoming smbc_readdirplus2() call.

Remove unused SMBCCTX *context parameters.
Remove unused talloc_stackframe().

Signed-off-by: Puran Chand <pchand@vmware.com>
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit d44a84295b46cc6c540a9730a615a59c1f22a277)

4 years agoCVE-2019-19344 kcc dns scavenging: Fix use after free in dns_tombstone_records_zone
Gary Lockyer [Mon, 16 Dec 2019 00:57:47 +0000 (13:57 +1300)]
CVE-2019-19344 kcc dns scavenging: Fix use after free in dns_tombstone_records_zone

ldb_msg_add_empty reallocates the underlying element array, leaving
old_el pointing to freed memory.

This patch takes two defensive copies of the ldb message, and performs
the updates on them rather than the ldb messages in the result.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14050

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoCVE-2019-14907 lib/util: Do not print the failed to convert string into the logs
Andrew Bartlett [Fri, 29 Nov 2019 07:58:47 +0000 (20:58 +1300)]
CVE-2019-14907 lib/util: Do not print the failed to convert string into the logs

The string may be in another charset, or may be sensitive and
certainly may not be terminated.  It is not safe to just print.

Found by Robert Święcki using a fuzzer he wrote for smbd.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14208
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
(adapted from master commit)

4 years agoCVE-2019-14907 lib/util/charset: clang: Fix Value stored to 'reason' is never read...
Noel Power [Fri, 24 May 2019 13:37:00 +0000 (13:37 +0000)]
CVE-2019-14907 lib/util/charset: clang: Fix Value stored to 'reason' is never read warning

Fixes:

lib/util/charset/convert_string.c:301:5: warning: Value stored to 'reason' is never read <--[clang]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer gary@catalyst.net.nz
(cherry picked from commit add47e288bc80c1bf45765d1588a9fa5998ea677)

4 years agoCVE-2019-14902 dsdb: Change basis of descriptor module deferred processing to be...
Andrew Bartlett [Thu, 12 Dec 2019 01:44:57 +0000 (14:44 +1300)]
CVE-2019-14902 dsdb: Change basis of descriptor module deferred processing to be GUIDs

We can not process on the basis of a DN, as the DN may have changed in a rename,
not only that this module can see, but also from repl_meta_data below.

Therefore remove all the complex tree-based change processing, leaving only
a tree-based sort of the possible objects to be changed, and a single
stopped_dn variable containing the DN to stop processing below (after
a no-op change).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12497

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agoCVE-2019-14902 repl_meta_data: Set renamed = true (and so do SD inheritance) after...
Andrew Bartlett [Fri, 6 Dec 2019 05:26:42 +0000 (18:26 +1300)]
CVE-2019-14902 repl_meta_data: Set renamed = true (and so do SD inheritance) after any rename

Previously if there was a conflict, but the incoming object would still
win, this was not marked as a rename, and so inheritence was not done.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12497

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agoCVE-2019-14902 repl_meta_data: Fix issue where inherited Security Descriptors were...
Andrew Bartlett [Tue, 26 Nov 2019 02:50:35 +0000 (15:50 +1300)]
CVE-2019-14902 repl_meta_data: Fix issue where inherited Security Descriptors were not replicated.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12497

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agoCVE-2019-14902 repl_meta_data: schedule SD propagation to a renamed DN
Andrew Bartlett [Fri, 6 Dec 2019 05:05:54 +0000 (18:05 +1300)]
CVE-2019-14902 repl_meta_data: schedule SD propagation to a renamed DN

We need to check the SD of the parent if we rename, it is not the same as an incoming SD change.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12497

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agoCVE-2019-14902 dsdb: Ensure we honour both change->force_self and change->force_children
Andrew Bartlett [Fri, 6 Dec 2019 04:54:23 +0000 (17:54 +1300)]
CVE-2019-14902 dsdb: Ensure we honour both change->force_self and change->force_children

If we are renaming a DN we can be in a situation where we need to

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12497

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agoCVE-2019-14902 dsdb: Add comments explaining why SD propagation needs to be done...
Andrew Bartlett [Tue, 26 Nov 2019 03:17:32 +0000 (16:17 +1300)]
CVE-2019-14902 dsdb: Add comments explaining why SD propagation needs to be done here

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12497

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agoCVE-2019-14902 dsdb: Explain that descriptor_sd_propagation_recursive() is proctected...
Andrew Bartlett [Tue, 26 Nov 2019 02:44:32 +0000 (15:44 +1300)]
CVE-2019-14902 dsdb: Explain that descriptor_sd_propagation_recursive() is proctected by a transaction

This means we can trust the DB did not change between the two search
requests.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12497

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest: Add test to confirm ACL inheritence really happens
Andrew Bartlett [Sun, 15 Dec 2019 22:29:27 +0000 (11:29 +1300)]
selftest: Add test to confirm ACL inheritence really happens

While we have a seperate test (sec_descriptor.py) that confirms inheritance in
general we want to lock in these specific patterns as this test covers
rename.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agoCVE-2019-14902 selftest: Add test for a special case around replicated renames
Andrew Bartlett [Tue, 10 Dec 2019 02:16:24 +0000 (15:16 +1300)]
CVE-2019-14902 selftest: Add test for a special case around replicated renames

It appears Samba is currently string-name based in the ACL inheritence code.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12497

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agoCVE-2019-14902 selftest: Add test for replication of inherited security descriptors
Andrew Bartlett [Thu, 28 Nov 2019 04:16:16 +0000 (17:16 +1300)]
CVE-2019-14902 selftest: Add test for replication of inherited security descriptors

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12497

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agoVERSION: Re-enable GIT_SNAPSHOT.
Karolin Seeger [Thu, 9 Jan 2020 11:49:43 +0000 (12:49 +0100)]
VERSION: Re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoVERSION: Bump version up to 4.10.12.
Karolin Seeger [Mon, 16 Dec 2019 08:03:42 +0000 (09:03 +0100)]
VERSION: Bump version up to 4.10.12.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Autobuild-User(v4-10-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-10-test): Mon Dec 16 11:27:12 UTC 2019 on sn-devel-144

(cherry picked from commit bbeb73b40b885364a9ccf9108d4a930eaba0686c)

4 years agos3: VFS: glusterfs: Reset nlinks for symlink entries during readdir
Anoop C S [Tue, 12 Nov 2019 14:28:43 +0000 (19:58 +0530)]
s3: VFS: glusterfs: Reset nlinks for symlink entries during readdir

On receiving an already initialized stat_ex buffer for readdir() call we
invoke readdirplus() GlusterFS API, an optimized variant of readdir(),
which then returns stat information along with dir entry result. But for
symlink entries we don't know if link or target info is needed. In that
case it is better to leave this decision back to caller by resetting
nlinks value inside stat information to make it invalid.

This was also preventing us from displaying msdfs link as directories
inside the share.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14182

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Günther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Dec 17 21:53:07 UTC 2019 on sn-devel-184

(cherry picked from commit fca2d3e0d1fa5af59e7b729f7c1d126f7b81e149)

Autobuild-User(v4-10-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-10-test): Thu Dec 19 13:46:00 UTC 2019 on sn-devel-144

4 years agoAvoiding bad call flags with python 3.8, using METH_NOARGS instead of zero.
Torsten Fohrer [Sun, 15 Dec 2019 15:58:40 +0000 (16:58 +0100)]
Avoiding bad call flags with python 3.8, using METH_NOARGS instead of zero.

(C) SBE network solutions GmbH

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14209

Signed-off-by: Torsten Fohrer <torsten.fohrer@sbe.de>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Dec 18 14:33:58 UTC 2019 on sn-devel-184

(cherry picked from commit f0eb1e623f76d3dbd0c22f96cabebd1041c147df)

4 years agopygpo: use correct method flags
Douglas Bagnall [Mon, 2 Dec 2019 22:17:26 +0000 (11:17 +1300)]
pygpo: use correct method flags

The METH_KEYWORDS argument must always be combined with METH_VARARGS.

In Python up to 3.7 this was checked at runtime, and as we had no callers to
get_unix_path() in Python we never noticed. In Python 3.8 it is checked at
import time, and everyone notices even if they aren't directly using GPOs.

Found and reported by Val Kulkov.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14209
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 12cccf3447333dfd4f5e437cd57ca5ec68724fdd)

4 years agoVERSION: Bump version up to 4.10.12.
Karolin Seeger [Mon, 16 Dec 2019 08:03:42 +0000 (09:03 +0100)]
VERSION: Bump version up to 4.10.12.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Autobuild-User(v4-10-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-10-test): Mon Dec 16 11:27:12 UTC 2019 on sn-devel-144

4 years agos3: smbd: Only set xconn->smb1.negprot.done = true after supported_protocols[protocol...
Jeremy Allison [Tue, 26 Nov 2019 20:53:09 +0000 (12:53 -0800)]
s3: smbd: Only set xconn->smb1.negprot.done = true after supported_protocols[protocol].proto_reply_fn() succeeds.

Otherwise we can end up with negprot.done set, but
without smbXsrv_connection_init_tables() being called.

This can cause a client self-crash.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14205

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Dec  4 21:27:24 UTC 2019 on sn-devel-184

(cherry picked from commit 8db0c1bff6f42feabd2e4d9dfb13ae12cc29607b)

4 years agopython: tests. Add test for fuzzing smbd crash bug.
Jeremy Allison [Tue, 3 Dec 2019 01:23:21 +0000 (17:23 -0800)]
python: tests. Add test for fuzzing smbd crash bug.

Mark knownfail for now.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14205

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 46899ecf836d350c0c29b615869851da7d0ad6fb)

4 years agos3: smbd: Ensure we exit if supported_protocols[protocol].proto_reply_fn() fails.
Jeremy Allison [Tue, 26 Nov 2019 20:46:16 +0000 (12:46 -0800)]
s3: smbd: Ensure we exit if supported_protocols[protocol].proto_reply_fn() fails.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14205

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit e84910d919e02feab2a297fccbbf95f333e32119)

4 years agos3: smbd: Change (*proto_reply_fn()) to return an NTSTATUS.
Jeremy Allison [Tue, 26 Nov 2019 20:43:25 +0000 (12:43 -0800)]
s3: smbd: Change (*proto_reply_fn()) to return an NTSTATUS.

That way the caller can know if the negprot really
succeeded or not.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14205

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit f4caa4159bd3db5127e114718e606867348a4f47)

4 years agos3: smbd: Change reply_smb20xx() to return NTSTATUS.
Jeremy Allison [Tue, 26 Nov 2019 20:21:06 +0000 (12:21 -0800)]
s3: smbd: Change reply_smb20xx() to return NTSTATUS.

Not yet used.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14205

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 836219c479b047403d2b0839a6b92ad637dbaea0)

4 years agos3: smbd: Ensure we exit on smbd_smb2_process_negprot() fail.
Jeremy Allison [Tue, 26 Nov 2019 20:17:29 +0000 (12:17 -0800)]
s3: smbd: Ensure we exit on smbd_smb2_process_negprot() fail.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14205

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit a2d81d77c111379cbb6bd732c717307974eace0a)

4 years agos3: smbd: Allow smbd_smb2_process_negprot() to return NTSTATUS as it can fail.
Jeremy Allison [Tue, 26 Nov 2019 20:14:29 +0000 (12:14 -0800)]
s3: smbd: Allow smbd_smb2_process_negprot() to return NTSTATUS as it can fail.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14205

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 868bc05cf5d575e20edcce241e3af1d0fa6d9824)

4 years agos3: smbd: SMB2 - Ensure we use the correct session_id if encrypting an interim response.
Jeremy Allison [Thu, 7 Nov 2019 20:02:13 +0000 (12:02 -0800)]
s3: smbd: SMB2 - Ensure we use the correct session_id if encrypting an interim response.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14189

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit eae1a45d09ef54dd6b59803eedca672ae9433902)

4 years agoMerge tag 'samba-4.10.11' into v4-10-test
Karolin Seeger [Tue, 10 Dec 2019 09:24:44 +0000 (10:24 +0100)]
Merge tag 'samba-4.10.11' into v4-10-test

samba: tag release samba-4.10.11

4 years agoheimdal-build: avoid hard-coded /usr/include/heimdal in asn1_compile-generated code.
Uri Simchoni [Sun, 20 Oct 2019 18:36:11 +0000 (21:36 +0300)]
heimdal-build: avoid hard-coded /usr/include/heimdal in asn1_compile-generated code.

This fixes a cross-compilation issue, as cross-compilers (rightly)
complain if host include directories are in the include path.

The fix is taken from buildroot (https://github.com/buildroot/buildroot/blob/8b11b96f41a6ffa76556c9bf03a863955871ee57/package/samba4/0006-heimdal_build-wscript_build-do-not-add-host-include-.patch) where it was applied by Bernd Kuhls <bernd.kuhls@t-online.de>.

This reverts some of 3fe2bfddda6149f6bf7402720226e9285f479fef, but
building Samba's bundled Heimdal with a system roken is not supported
anyway.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13856

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sun Dec  1 10:22:01 UTC 2019 on sn-devel-184

(cherry picked from commit 27fc062d7ea2207242d5a2c9933f3de5fa206488)

Autobuild-User(v4-10-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-10-test): Tue Dec  3 15:06:08 UTC 2019 on sn-devel-144

4 years agoVERSION: Disable GIT_SNAPSHOT for the 4.10.11 release. samba-4.10.11
Karolin Seeger [Tue, 3 Dec 2019 11:54:00 +0000 (12:54 +0100)]
VERSION: Disable GIT_SNAPSHOT for the 4.10.11 release.

o CVE-2019-14861: Samba AD DC zone-named record Denial of Service in DNS
                  management server (dnsserver).
o CVE-2019-14870: DelegationNotAllowed not being enforced in protocol transition
                  on Samba AD DC.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoWHATSNEW: Add release notes for Samba 4.10.11.
Karolin Seeger [Tue, 3 Dec 2019 11:52:58 +0000 (12:52 +0100)]
WHATSNEW: Add release notes for Samba 4.10.11.

o CVE-2019-14861: Samba AD DC zone-named record Denial of Service in DNS
                  management server (dnsserver).
o CVE-2019-14870: DelegationNotAllowed not being enforced in protocol transition
                  on Samba AD DC.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoCVE-2019-14870: mit-kdc: enforce delegation_not_allowed flag
Isaac Boukris [Thu, 21 Nov 2019 10:12:48 +0000 (11:12 +0100)]
CVE-2019-14870: mit-kdc: enforce delegation_not_allowed flag

Signed-off-by: Isaac Boukris <iboukris@samba.org>
4 years agoCVE-2019-14870: heimdal: enforce delegation_not_allowed in S4U2Self
Isaac Boukris [Mon, 28 Oct 2019 00:54:09 +0000 (02:54 +0200)]
CVE-2019-14870: heimdal: enforce delegation_not_allowed in S4U2Self

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
4 years agoCVE-2019-14870: heimdal: add S4U test for delegation_not_allowed
Isaac Boukris [Wed, 30 Oct 2019 14:59:16 +0000 (15:59 +0100)]
CVE-2019-14870: heimdal: add S4U test for delegation_not_allowed

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
4 years agosamba-tool: add user-sensitive command to set not-delegated flag
Isaac Boukris [Sun, 27 Oct 2019 12:02:00 +0000 (14:02 +0200)]
samba-tool: add user-sensitive command to set not-delegated flag

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
4 years agos4-torture: Reduce flapping in SambaToolDrsTests.test_samba_tool_replicate_local
Andrew Bartlett [Thu, 31 Oct 2019 17:53:56 +0000 (06:53 +1300)]
s4-torture: Reduce flapping in SambaToolDrsTests.test_samba_tool_replicate_local

This test often flaps in Samba 4.9 (where more tests and DCs run in the environment)
with obj_1 being 3.  This is quite OK, we just need to see some changes get
replicated, not 0 changes.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit 4ae0f9ce0f5ada99cf1d236377e5a1234c879ae3)

4 years agoCVE-2019-14861: Test to demonstrate the bug
Andrew Bartlett [Tue, 29 Oct 2019 22:50:57 +0000 (11:50 +1300)]
CVE-2019-14861: Test to demonstrate the bug

This test does not fail every time, but when it does it casues a segfault which
takes out the rpc_server master process, as this hosts the dnsserver pipe.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14138

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agoCVE-2019-14861: s4-rpc/dnsserver: Avoid crash in ldb_qsort() via dcesrv_DnssrvEnumRec...
Andrew Bartlett [Tue, 29 Oct 2019 01:15:36 +0000 (14:15 +1300)]
CVE-2019-14861: s4-rpc/dnsserver: Avoid crash in ldb_qsort() via dcesrv_DnssrvEnumRecords)

dns_name_compare() had logic to put @ and the top record in the tree being
enumerated first, but if a domain had both then this would break the
older qsort() implementation in ldb_qsort() and cause a read of memory
before the base pointer.

By removing this special case (not required as the base pointer
is already seperatly located, no matter were it is in the
returned records) the crash is avoided.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14138

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agoCVE-2019-14861: s4-rpc_server: Remove special case for @ in dns_build_tree()
Andrew Bartlett [Sun, 20 Oct 2019 23:12:10 +0000 (12:12 +1300)]
CVE-2019-14861: s4-rpc_server: Remove special case for @ in dns_build_tree()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14138

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agoCVE-2019-14861: s4-rpc/dnsserver: Confirm sort behaviour in dcesrv_DnssrvEnumRecords
Andrew Bartlett [Tue, 29 Oct 2019 04:25:28 +0000 (17:25 +1300)]
CVE-2019-14861: s4-rpc/dnsserver: Confirm sort behaviour in dcesrv_DnssrvEnumRecords

The sort behaviour for child records is not correct in Samba so
we add a flapping entry.

(patch differs from master patch due to addtional flapping entry
for python2)

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14138

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agoVERSION: Re-enable GIT_SNAPSHOT.
Karolin Seeger [Tue, 3 Dec 2019 11:49:48 +0000 (12:49 +0100)]
VERSION: Re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
4 years agoVERSION: Bump version up to 4.10.11.
Karolin Seeger [Tue, 29 Oct 2019 10:12:31 +0000 (11:12 +0100)]
VERSION: Bump version up to 4.10.11.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
(cherry picked from commit f86e09dcd48fa837e15439fcc10eac1b8dec862b)

4 years agoctdb-tcp: Close inflight connecting TCP sockets after fork
Volker Lendecke [Thu, 7 Nov 2019 14:26:01 +0000 (15:26 +0100)]
ctdb-tcp: Close inflight connecting TCP sockets after fork

Commit c68b6f96f26 changed the talloc hierarchy such that outgoing TCP sockets
while sitting in the async connect() syscall are not freed via
ctdb_tcp_shutdown() anymore, they are hanging off a longer-running structure.
Free this structure as well.

If an outgoing TCP socket leaks into a long-running child process (possibly the
recovery daemon), this connection will never be closed as seen by the
destination node. Because with recent changes incoming connections will not be
accepted as long as any incoming connection is alive, with that socket leak
into the recovery daemon we will never again be able to successfully connect to
the node that is affected by this leak. Further attempts to connect will be
discarded by the destination as long as the recovery daemon keeps this socket
alive.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175
RN: Avoid communication breakdown on node reconnect

Signed-off-by: Martin Schwenke <martin@meltin.net>
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit a6d99d9e5c5bc58e6d56be7a6c1dbc7c8d1a882f)

Autobuild-User(v4-10-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-10-test): Mon Nov 25 14:56:53 UTC 2019 on sn-devel-144

4 years agoctdb-tcp: Drop tracking of file descriptor for incoming connections
Martin Schwenke [Tue, 29 Oct 2019 06:28:22 +0000 (17:28 +1100)]
ctdb-tcp: Drop tracking of file descriptor for incoming connections

This file descriptor is owned by the incoming queue.  It will be
closed when the queue is torn down.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit bf47bc18bb8a94231870ef821c0352b7a15c2e28)

4 years agoctdb-tcp: Avoid orphaning the TCP incoming queue
Martin Schwenke [Tue, 29 Oct 2019 04:29:11 +0000 (15:29 +1100)]
ctdb-tcp: Avoid orphaning the TCP incoming queue

CTDB's incoming queue handling does not check whether an existing
queue exists, so can overwrite the pointer to the queue.  This used to
be harmless until commit c68b6f96f26664459187ab2fbd56767fb31767e0
changed the read callback to use a parent structure as the callback
data.  Instead of cleaning up an orphaned queue on disconnect, as
before, this will now free the new queue.

At first glance it doesn't seem possible that 2 incoming connections
from the same node could be processed before the intervening
disconnect.  However, the incoming connections and disconnect occur on
different file descriptors.  The queue can become orphaned on node A
when the following sequence occurs:

1. Node A comes up
2. Node A accepts an incoming connection from node B
3. Node B processes a timeout before noticing that outgoing the queue is writable
4. Node B tears down the outgoing connection to node A
5. Node B initiates a new connection to node A
6. Node A accepts an incoming connection from node B

Node A processes then the disconnect of the old incoming connection
from (2) but tears down the new incoming connection from (6).  This
then occurs until the originally affected node is restarted.

However, due to the number of outgoing connection attempts and
associated teardowns, this induces the same behaviour on the
corresponding incoming queue on all nodes that node A attempts to
connect to.  Therefore, other nodes become affected and need to be
restarted too.

As a result, the whole cluster probably needs to be restarted to
recover from this situation.

The problem can occur any time CTDB is started on a node.

The fix is to avoid accepting new incoming connections when a queue
for incoming connections is already present.  The connecting node will
simply retry establishing its outgoing connection.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit d0baad257e511280ff3e5c7372c38c43df841070)

4 years agoctdb-tcp: Check incoming queue to see if incoming connection is up
Martin Schwenke [Tue, 29 Oct 2019 04:25:26 +0000 (15:25 +1100)]
ctdb-tcp: Check incoming queue to see if incoming connection is up

This makes it consistent with the reverse case.  Also, in_fd will soon
be removed.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit e62b3a05a874db13a848573d2e2fb1c157393b9c)

4 years agos3: libsmb: Ensure return from net_share_enum_rpc() sets cli->raw_status on error.
Jeremy Allison [Thu, 31 Oct 2019 21:38:35 +0000 (14:38 -0700)]
s3: libsmb: Ensure return from net_share_enum_rpc() sets cli->raw_status on error.

Convert net_share_enum_rpc() to return an NTSTATUS and ensure the
status is set correctly on error so SMBC_errno() can return it.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14176

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Nov  5 12:36:48 UTC 2019 on sn-devel-184

(cherry picked from commit ff47cc661d432a9337ade9a232a4f49164652812)

4 years agos3: utils: smbtree. Ensure we don't call cli_RNetShareEnum() on an SMB1 connection.
Jeremy Allison [Tue, 29 Oct 2019 19:11:49 +0000 (12:11 -0700)]
s3: utils: smbtree. Ensure we don't call cli_RNetShareEnum() on an SMB1 connection.

Last unprotected call of cli_RNetShareEnum(). Not a libsmbclient
bug here but might as well fix the last caller as part of the
fix for the bug.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14174

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit f30b8b3aa1309e9daeb9a3601b537dead81e5dbb)

Autobuild-User(v4-10-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-10-test): Mon Nov 18 12:55:39 UTC 2019 on sn-devel-144

4 years agos3: libsmb: Ensure we don't call cli_RNetShareEnum() on an SMB1 connection.
Jeremy Allison [Tue, 29 Oct 2019 19:11:01 +0000 (12:11 -0700)]
s3: libsmb: Ensure we don't call cli_RNetShareEnum() on an SMB1 connection.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14174

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 1cfcad6283da855d3e97237a7a6fd6f4d2436ee2)

4 years agos3:printing: Fix %J substition
Ralph Boehme [Thu, 31 Oct 2019 11:46:38 +0000 (12:46 +0100)]
s3:printing: Fix %J substition

print_run_command() uses lp_print_command() which internally performs basic
substition by calling talloc_sub_basic(). As a result. any of the variables in
the "basic set", including "%J" are already substituted.

To prevent the unwanted subtitution, we declare all affected configuration
options as const, which disabled the basic substition.

As a result print_run_command() can run manual substitution on all characters,
including %J, in the variadic argument list *before* calling lp_string() to run
basic substition which we had disabled before with the const.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13745

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Nov  7 16:01:21 UTC 2019 on sn-devel-184

(cherry picked from commit 8846887a55b0c97a1639fc6ecb228941cf16b8f2)

4 years agos3:printing: add a DEBUG statement
Ralph Boehme [Thu, 31 Oct 2019 11:03:31 +0000 (12:03 +0100)]
s3:printing: add a DEBUG statement

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13745

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit ede00779ab2d881e061adb9d861879e8c68e272b)

4 years agos3:lib: factor out talloc_sub_advanced() from talloc_sub_full()
Ralph Boehme [Thu, 31 Oct 2019 10:57:39 +0000 (11:57 +0100)]
s3:lib: factor out talloc_sub_advanced() from talloc_sub_full()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13745

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 41ab92b62fbf029374b89f9d0ddf7578981f37cf)

4 years agos3: rename talloc_sub_advanced() to talloc_sub_full()
Ralph Boehme [Thu, 31 Oct 2019 11:45:44 +0000 (12:45 +0100)]
s3: rename talloc_sub_advanced() to talloc_sub_full()

We currently have the following substitution functions:

  talloc_sub_basic()
  talloc_sub_advanced()

talloc_sub_basic() currently substitutes a subset of talloc_sub_advanced().

We'll need a function X that only substitutes what talloc_sub_advanced()
substitutes *without* what talloc_sub_basic() does.

To get there rename talloc_sub_advanced() to talloc_sub_full(). A subsequent
commit will then bring back talloc_sub_advanced() as described above.

Examples with fictional replacement letters A and B. Currently:

  talloc_sub_basic:    A
  talloc_sub_advanced: AB

New:

  talloc_sub_basic:    A
  talloc_sub_advanced:  B
  talloc_sub_full:     AB

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13745

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(backported from commit 4736623c24503b3ca09c76c9dbb134ef833b2f80)

4 years agos3: remove unused function standard_sub_advanced()
Ralph Boehme [Thu, 31 Oct 2019 09:19:13 +0000 (10:19 +0100)]
s3: remove unused function standard_sub_advanced()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13745

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit a591de28659919d2afd7ed55106cded6a0d9ab35)

4 years agos3: replace standard_sub_advanced with talloc_sub_advanced in one place
Ralph Boehme [Thu, 31 Oct 2019 11:44:45 +0000 (12:44 +0100)]
s3: replace standard_sub_advanced with talloc_sub_advanced in one place

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13745

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 81ae199bb72886f2f1ed87b22b4c75b6b99c72f6)

4 years agos3:printing: fix a long line
Ralph Boehme [Thu, 31 Oct 2019 11:43:25 +0000 (12:43 +0100)]
s3:printing: fix a long line

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13745

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit dcb555c06a6341871b691dab3758e7de04110282)

4 years agolib/adouble: pass filesize to ad_unpack()
Ralph Boehme [Thu, 24 Oct 2019 15:15:18 +0000 (17:15 +0200)]
lib/adouble: pass filesize to ad_unpack()

ad_unpack() needs the filesize, not the capped IO size we're using in the caller
to read up to "size" bystem from the ._ AppleDouble file.

This fixes a regression introduced by bdc257a1cbac7e8c73a084b618ba642476807483
for bug 13968.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14171
RN: vfs_fruit returns capped resource fork length

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Oct 30 14:52:34 UTC 2019 on sn-devel-184

(backported from commit f3df83a2c346d945487a27a9d258ee6331ea7dbb)

Autobuild-User(v4-10-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-10-test): Fri Nov  8 14:01:11 UTC 2019 on sn-devel-144

4 years agolib/adouble: drop ad_data reallocate logic
Ralph Boehme [Fri, 25 Oct 2019 13:21:32 +0000 (15:21 +0200)]
lib/adouble: drop ad_data reallocate logic

Simply set the buffer size to AD_XATTR_MAX_HDR_SIZE. When reading the
AppleDouble file, read up to AD_XATTR_MAX_HDR_SIZE from the file.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14171

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(backported from commit 9a3da6bebcdb924ca2027337544d79ac2088677e)

4 years agovfs_fruit: README.Coding fix: multi-line if expression
Ralph Boehme [Thu, 24 Oct 2019 15:26:08 +0000 (17:26 +0200)]
vfs_fruit: README.Coding fix: multi-line if expression

Also remove a TAB.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14171

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(backported from commit baaaf59e948df625b01fa8b6317ab5c3babb4e8f)

4 years agovfs_fruit: fix a long line
Ralph Boehme [Thu, 24 Oct 2019 15:17:28 +0000 (17:17 +0200)]
vfs_fruit: fix a long line

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14171

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(backported from commit f0c8ac47a4608eabeae334d39885aab98198b753)

4 years agotorture: expand test "vfs.fruit.resource fork IO" to check size
Ralph Boehme [Fri, 25 Oct 2019 13:41:40 +0000 (15:41 +0200)]
torture: expand test "vfs.fruit.resource fork IO" to check size

Reveals a bug where the resource fork size is capped at 65454 bytes.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14171

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit b63069db9fb6efb33b7b917cd5b0ee06b0da9cdc)

4 years agos3:smbd: Fix sync dosmode fallback in async dosmode codepath
Ralph Boehme [Mon, 5 Aug 2019 09:11:14 +0000 (11:11 +0200)]
s3:smbd: Fix sync dosmode fallback in async dosmode codepath

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14070
RN: Fix sync dosmode fallback in async dosmode codepath

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Aug  6 15:40:18 UTC 2019 on sn-devel-184

(cherry picked from commit 5d4aa6e867044e6b58b45acde32ac35e1d0a7765)

4 years agos3:smbd: Incomplete conversion of former parametric options
Ralph Boehme [Mon, 5 Aug 2019 08:59:22 +0000 (10:59 +0200)]
s3:smbd: Incomplete conversion of former parametric options

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14069
RN: Incomplete conversion of former parametric options

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(backported from commit ea17bd5539eb0be7a446b99c8b6baa4aa1ab273f)

4 years agos3: remove now unneeded call to cmdline_messaging_context()
Ralph Boehme [Sat, 4 May 2019 10:12:48 +0000 (12:12 +0200)]
s3: remove now unneeded call to cmdline_messaging_context()

This was only needed as dbwrap_open() had a bug where it asked for the ctdb
connection before initializing messaging. The previous commit fixed that so we
can now safely remove the calls to cmdline_messaging_context() from all tools
that don't use messaging.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13925

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct 24 09:33:47 UTC 2019 on sn-devel-184

(cherry picked from commit 9471508391fd3bcf199b1e94f8d9ee2b956e8f8e)

4 years agos3:dbwrap: initialize messaging before getting the ctdb connection
Ralph Boehme [Sat, 4 May 2019 10:12:04 +0000 (12:12 +0200)]
s3:dbwrap: initialize messaging before getting the ctdb connection

This is a better fix for bug #13465.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13925

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit ca95d7f41b683b4d7ac59ed6ee709d44abfe2019)

4 years agolibnet_join: add SPNs for additional-dns-hostnames entries
Isaac Boukris [Fri, 13 Sep 2019 07:56:10 +0000 (10:56 +0300)]
libnet_join: add SPNs for additional-dns-hostnames entries

and set msDS-AdditionalDnsHostName to the specified list.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14116

Signed-off-by: Isaac Boukris <iboukris@redhat.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Oct 25 10:43:08 UTC 2019 on sn-devel-184

Autobuild-User(v4-10-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-10-test): Tue Nov  5 14:31:48 UTC 2019 on sn-devel-144

4 years agodocs-xml: add "additional dns hostnames" smb.conf option
Isaac Boukris [Tue, 17 Sep 2019 18:38:07 +0000 (21:38 +0300)]
docs-xml: add "additional dns hostnames" smb.conf option

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14116

Signed-off-by: Isaac Boukris <iboukris@redhat.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 years agolibnet_join_set_machine_spn: simplify adding uniq spn to array
Isaac Boukris [Wed, 18 Sep 2019 20:15:57 +0000 (23:15 +0300)]
libnet_join_set_machine_spn: simplify adding uniq spn to array

and do not skip adding a fully qualified spn to netbios-aliases
in case a short spn already existed.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14116

Signed-off-by: Isaac Boukris <iboukris@redhat.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 years agolibnet_join_set_machine_spn: simplify memory handling
Isaac Boukris [Wed, 18 Sep 2019 18:29:47 +0000 (21:29 +0300)]
libnet_join_set_machine_spn: simplify memory handling

and avoid a possible memory leak when passing null to
add_string_to_array() as mem_ctx.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14116

Signed-off-by: Isaac Boukris <iboukris@redhat.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 years agolibnet_join_set_machine_spn: improve style and make a bit room for indentation
Isaac Boukris [Wed, 18 Sep 2019 17:00:34 +0000 (20:00 +0300)]
libnet_join_set_machine_spn: improve style and make a bit room for indentation

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14116

Signed-off-by: Isaac Boukris <iboukris@redhat.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 years agolibnet_join: build dnsHostName from netbios name and lp_dnsdomain()
Isaac Boukris [Thu, 29 Aug 2019 21:22:15 +0000 (00:22 +0300)]
libnet_join: build dnsHostName from netbios name and lp_dnsdomain()

This make the join process much more reliable, and avoids "Constraint
violation" error when the fqdn returned from getaddrinfo has already
got assigned an SPN.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14116

Signed-off-by: Isaac Boukris <iboukris@redhat.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 years agos4:dirsync: fix interaction of dirsync and extended_dn controls
Stefan Metzmacher [Fri, 4 Oct 2019 12:57:40 +0000 (14:57 +0200)]
s4:dirsync: fix interaction of dirsync and extended_dn controls

Azure AD connect reports discovery errors:
  reference-value-not-ldap-conformant
for attributes member and manager.
The key is that it sends the LDAP_SERVER_EXTENDED_DN_OID without
an ExtendedDNRequestValue blob, which means the flag value should
be treated as 0 and the HEX string format should be used.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14153
RN: Prevent azure ad connect from reporting discovery errors:
reference-value-not-ldap-conformant

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Oct 24 11:06:58 UTC 2019 on sn-devel-184

(cherry picked from commit d0f566c4ad32d69a1cf896e2dde56fc2489bb7fc)

4 years agos4:tests/dirsync: add tests for dirsync with extended_dn
Stefan Metzmacher [Tue, 22 Oct 2019 10:12:32 +0000 (12:12 +0200)]
s4:tests/dirsync: add tests for dirsync with extended_dn

This demonstrates a problems that the extended_dn returned
by the dirsync module always uses the SDDL format for GUID/SID
components.

Azure AD connect reports discovery errors:
  reference-value-not-ldap-conformant
for attributes member and manager.
The key is that it sends the LDAP_SERVER_EXTENDED_DN_OID without
an ExtendedDNRequestValue blob, which means the flag value should
be treated as 0 and the HEX string format should be used.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14153

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 6d43d82b49c8cd47da2f1489fe8b52d5a873a19c)

4 years agoreplace: Only link libnsl and libsocket if requrired
Andreas Schneider [Mon, 21 Oct 2019 15:08:08 +0000 (17:08 +0200)]
replace: Only link libnsl and libsocket if requrired

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14168

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Oct 23 08:23:13 UTC 2019 on sn-devel-184

(cherry picked from commit 263bec1b8d0744da73dd92e4a361fb7430289ab3)

Autobuild-User(v4-10-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-10-test): Mon Nov  4 11:35:33 UTC 2019 on sn-devel-144

4 years agos3: torture: Ensure SMB1 cli_qpathinfo2() doesn't return an inode number.
Jeremy Allison [Thu, 17 Oct 2019 19:41:08 +0000 (12:41 -0700)]
s3: torture: Ensure SMB1 cli_qpathinfo2() doesn't return an inode number.

Piggyback on existing tests, ensure we don't regress on:

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14161

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 8e55a8562951924e4b1aad5a6d67fc8b309590c1)

4 years agos3: libsmb: Ensure SMB1 cli_qpathinfo2() doesn't return an inode number.
Jeremy Allison [Thu, 17 Oct 2019 18:39:02 +0000 (11:39 -0700)]
s3: libsmb: Ensure SMB1 cli_qpathinfo2() doesn't return an inode number.

The info level it uses doesn't return that, previously we
were using the field that is returned as the EA size as
the inode number (which is usually zero, so the code in
libsmbclient would then synthesize an inode number from
a hash of the pathname, which is all it can do for SMB1).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14161

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit d495074ee27a5f528d5156a69800ee58d799b1eb)

4 years agowscript: Remove checks for shm_open and shmget
Christof Schmitt [Wed, 24 Apr 2019 17:16:30 +0000 (10:16 -0700)]
wscript: Remove checks for shm_open and shmget

Commit 74a16a1094278 "s3:smbprofile: Replace sysv shmem with tdb"
removed the usage of the shared memory segment for profiling data. As
there are no other users of shared memory segments, remove the configure
check for these functions.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14140

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 94f2ed3eb35b94d5152578dbb6d5ee8f2fa2da69)

4 years agowaf: print the library name in which we search for a function
Björn Jacke [Mon, 11 Feb 2019 09:03:00 +0000 (10:03 +0100)]
waf: print the library name in which we search for a function

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 7058a88cbe3c1a2ad272b6debc1c9d09a259d116)

4 years agoVERSION: Bump version up to 4.10.11.
Karolin Seeger [Tue, 29 Oct 2019 10:12:31 +0000 (11:12 +0100)]
VERSION: Bump version up to 4.10.11.

Signed-off-by: Karolin Seeger <kseeger@samba.org>