nivanova/samba-autobuild/.git
2 years agowinbindd: Remove a misleading comment
Volker Lendecke [Fri, 27 Oct 2017 12:01:41 +0000 (14:01 +0200)]
winbindd: Remove a misleading comment

The reality is a bit more complex than this comment indicates. We should never
suggest anywhere that we can connect to domains that we don't have a direct
trust account to. For the member case, it's "our" domain, and for the DC case,
it's the direct trusts. Everything else is pure luck.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Oct 28 00:31:58 CEST 2017 on sn-devel-144

2 years agoprinting: Avoid an "extern current_user"
Volker Lendecke [Wed, 4 Oct 2017 11:30:13 +0000 (13:30 +0200)]
printing: Avoid an "extern current_user"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoprinting: Avoid an "extern current_user"
Volker Lendecke [Wed, 4 Oct 2017 11:27:43 +0000 (13:27 +0200)]
printing: Avoid an "extern current_user"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Fix the memory hierarchy in the unix token
Volker Lendecke [Wed, 4 Oct 2017 13:04:01 +0000 (15:04 +0200)]
smbd: Fix the memory hierarchy in the unix token

"groups" should hang off the token itself, not its parent

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolib: Use all_zero where appropriate
Volker Lendecke [Thu, 19 Oct 2017 15:52:31 +0000 (17:52 +0200)]
lib: Use all_zero where appropriate

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Remove an indentation level in smb2_negprot
Volker Lendecke [Thu, 19 Oct 2017 06:13:59 +0000 (08:13 +0200)]
smbd: Remove an indentation level in smb2_negprot

Do an early return. Best viewed with "git show -b"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosamba: Fix CID 1420179 Code maintainability issues UNUSED_VALUE
Volker Lendecke [Thu, 26 Oct 2017 19:13:52 +0000 (21:13 +0200)]
samba: Fix CID 1420179 Code maintainability issues UNUSED_VALUE

I don't think pid is used at all here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosamba: Fix CID 1420180 Null pointer dereferences
Volker Lendecke [Thu, 26 Oct 2017 19:08:14 +0000 (21:08 +0200)]
samba: Fix CID 1420180 Null pointer dereferences

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos4:pyparam: Fix resource leaks on error
Andreas Schneider [Wed, 25 Oct 2017 17:25:20 +0000 (19:25 +0200)]
s4:pyparam: Fix resource leaks on error

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos4:torture: Avoid useless strdup in libsmbclient test
Andreas Schneider [Wed, 25 Oct 2017 17:23:02 +0000 (19:23 +0200)]
s4:torture: Avoid useless strdup in libsmbclient test

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmbclient: Use const for the user
Andreas Schneider [Wed, 25 Oct 2017 17:22:34 +0000 (19:22 +0200)]
libsmbclient: Use const for the user

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agotestprogs: Update the kpasswd setpassword test
Andreas Schneider [Fri, 20 Oct 2017 06:58:21 +0000 (08:58 +0200)]
testprogs: Update the kpasswd setpassword test

This has been fixed with b81ca4f9dcbb378a95fb3ac31bfd9a1cbe505d7d

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Oct 27 15:22:43 CEST 2017 on sn-devel-144

2 years agos4:kdc: Pass down the task to get access to model_ops for kpasswd server
Andreas Schneider [Thu, 19 Oct 2017 15:32:15 +0000 (17:32 +0200)]
s4:kdc: Pass down the task to get access to model_ops for kpasswd server

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3:modules: Check correct variable for NULL in posixacl_xattr
Andreas Schneider [Wed, 25 Oct 2017 17:55:32 +0000 (19:55 +0200)]
s3:modules: Check correct variable for NULL in posixacl_xattr

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Oct 27 04:54:22 CEST 2017 on sn-devel-144

2 years agos3:passdb: Make sure the salt is fully initialized before passing
Andreas Schneider [Wed, 25 Oct 2017 17:50:57 +0000 (19:50 +0200)]
s3:passdb: Make sure the salt is fully initialized before passing

Otherwise the magic member is not initialized.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3:secrets: Do not leak memory of pw and old_pw
Andreas Schneider [Wed, 25 Oct 2017 17:30:28 +0000 (19:30 +0200)]
s3:secrets: Do not leak memory of pw and old_pw

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3:vfs_glusterfs: Use SAFE_FREE
Andreas Schneider [Thu, 26 Oct 2017 06:05:20 +0000 (08:05 +0200)]
s3:vfs_glusterfs: Use SAFE_FREE

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Oct 26 17:31:40 CEST 2017 on sn-devel-144

2 years agoctdb-tests: Process-exists unit tests should wait until PID is registered
Martin Schwenke [Wed, 25 Oct 2017 01:15:23 +0000 (12:15 +1100)]
ctdb-tests: Process-exists unit tests should wait until PID is registered

Otherwise the client registration can race with the check in the test.

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

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): Thu Oct 26 13:32:24 CEST 2017 on sn-devel-144

2 years agoctdb-tests: Wait for fake_ctdbd to start, fail if it doesn't
Martin Schwenke [Wed, 25 Oct 2017 06:52:04 +0000 (17:52 +1100)]
ctdb-tests: Wait for fake_ctdbd to start, fail if it doesn't

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-tests: Skip starting fake_ctdbd when current node is disconnected
Martin Schwenke [Wed, 25 Oct 2017 10:43:56 +0000 (21:43 +1100)]
ctdb-tests: Skip starting fake_ctdbd when current node is disconnected

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-tests: Wait for ctdb_eventd to start, fail if it doesn't
Martin Schwenke [Wed, 25 Oct 2017 07:52:10 +0000 (18:52 +1100)]
ctdb-tests: Wait for ctdb_eventd to start, fail if it doesn't

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-tests: Allow wait_until() to be used in unit tests
Martin Schwenke [Wed, 25 Oct 2017 01:04:49 +0000 (12:04 +1100)]
ctdb-tests: Allow wait_until() to be used in unit tests

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agos3:vfs_glusterfs: Fix a double free in vfs_gluster_getwd()
Andreas Schneider [Wed, 25 Oct 2017 17:39:34 +0000 (19:39 +0200)]
s3:vfs_glusterfs: Fix a double free in vfs_gluster_getwd()

Found by cppcheck.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct 26 09:34:40 CEST 2017 on sn-devel-144

2 years agolinked attribute tests: correct add_all_at_once test
Douglas Bagnall [Tue, 24 Oct 2017 23:57:09 +0000 (12:57 +1300)]
linked attribute tests: correct add_all_at_once test

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Oct 26 05:36:11 CEST 2017 on sn-devel-144

2 years agolinked_attribute tests: helper assert function for expected LdbError
Douglas Bagnall [Tue, 24 Oct 2017 22:57:50 +0000 (11:57 +1300)]
linked_attribute tests: helper assert function for expected LdbError

The logic involved in asserting that a function raises an LdbError with
a particular error value has shown itself to be too complicated for me
to repeat too often.

To test this function, you would want a put a test in a bit like this:

    def test_assertRaisesLdbError(self):
        for i in [1, 2, ldb.ERR_ENTRY_ALREADY_EXISTS, 999]:
            def f(*args, **kwargs):
                raise ldb.LdbError(i, 'msg %s' % i)
            self.assertRaisesLdbError(i, 'a message', f, 'la la', la='la')

            def f2(*args, **kwargs):
                raise ldb.LdbError(i + 1, 'msg %s' % i)
            def f3(*args, **kwargs):
                pass
            for f in (f2, f3):
                try:
                    self.assertRaisesLdbError(i, 'a message', f, 'la la', la='la')
                except AssertionError as e:
                    print i, e, f
                    pass
                else:
                    print i, f
                    self.fail('assertRaisesLdbError() failed to fail!')

..but a self-testing test-tester is getting a too meta to run in every
autobuild.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: use check_parsed_dn_duplicates() more widely
Douglas Bagnall [Tue, 24 Oct 2017 23:31:08 +0000 (12:31 +1300)]
replmd: use check_parsed_dn_duplicates() more widely

replmd_add_fix_la() was already making the same check; here we move it
a bit earlier.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolinked attribute tests: fix logic for add test
Douglas Bagnall [Tue, 24 Oct 2017 23:17:05 +0000 (12:17 +1300)]
linked attribute tests: fix logic for add test

We were ensuring that when we got an LdbError it was the right type,
but we weren't ensuring we got one at all.

The new test doesn't fail.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolinked attribute tests: ensure duplicate deletes fail
Douglas Bagnall [Tue, 24 Oct 2017 23:13:57 +0000 (12:13 +1300)]
linked attribute tests: ensure duplicate deletes fail

We can't remove the same thing twice in the same message.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: check for duplicate values in MOD_REPLACE case
Douglas Bagnall [Tue, 24 Oct 2017 21:12:09 +0000 (10:12 +1300)]
replmd: check for duplicate values in MOD_REPLACE case

Because we already have a sorted parsed_dn list, this is a simple
linear scan.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolinked attribute tests: test against duplicates in replace
Douglas Bagnall [Tue, 24 Oct 2017 21:54:42 +0000 (10:54 +1300)]
linked attribute tests: test against duplicates in replace

We should not be able to introduce duplicate links using MOD_REPLACE.
It turns out we could and weren't testing.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:scripting: Fix ntstatus_gen.h generation on 32bit
Andreas Schneider [Wed, 25 Oct 2017 15:37:24 +0000 (17:37 +0200)]
s4:scripting: Fix ntstatus_gen.h generation on 32bit

The hex() function results in different output on 32bit systems. It adds
a L for long for some numbers. Thus we have a different header file.

This patch makes sure we have a consistent file generation on different
paltforms.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Wed Oct 25 22:28:39 CEST 2017 on sn-devel-144

2 years agos3: smbclient: Test we can rename with a name containing.
Jeremy Allison [Mon, 23 Oct 2017 22:40:04 +0000 (15:40 -0700)]
s3: smbclient: Test we can rename with a name containing.

Samba always allowed this anyway, but it's a good place
to ensure we don't regress.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Oct 24 23:32:58 CEST 2017 on sn-devel-144

2 years agos3: smbclient: Ensure we call client_clean_name() before all operations on remote...
Jeremy Allison [Fri, 20 Oct 2017 22:09:38 +0000 (15:09 -0700)]
s3: smbclient: Ensure we call client_clean_name() before all operations on remote pathnames.

This allows names containing .. components to be resolved on the client side
before being sent to the server. Relative names work in SMB1 but not in SMB2.
Fix both client.c and clitar.c

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3: client: Add new utility function client_clean_name().
Jeremy Allison [Sat, 21 Oct 2017 00:08:08 +0000 (00:08 +0000)]
s3: client: Add new utility function client_clean_name().

Correctly canonicalizes a remote pathname removing '..'
elements before sending to a remote server. '..' elements
work in SMB1 pathnames, but not in SMB2.

Not yet used.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agoctdb-client: Fix CID 1419820
Amitay Isaacs [Wed, 18 Oct 2017 05:16:27 +0000 (16:16 +1100)]
ctdb-client: Fix CID 1419820

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Oct 23 19:45:08 CEST 2017 on sn-devel-144

2 years agoctdb-tools: Drop duplicate output from dbstatistics
Amitay Isaacs [Fri, 13 Oct 2017 01:57:08 +0000 (12:57 +1100)]
ctdb-tools: Drop duplicate output from dbstatistics

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2 years agopython: Port tests of samba.messaging to Python 3 compatible form.
Lumir Balhar [Thu, 14 Sep 2017 07:31:17 +0000 (09:31 +0200)]
python: Port tests of samba.messaging to Python 3 compatible form.

Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Oct 23 15:40:48 CEST 2017 on sn-devel-144

2 years agopython: Port samba.messaging module to Python 3 compatible form.
Lumir Balhar [Thu, 14 Sep 2017 07:30:28 +0000 (09:30 +0200)]
python: Port samba.messaging module to Python 3 compatible form.

Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agoxattr.idl: Don't generate an interface table
Volker Lendecke [Tue, 15 Aug 2017 06:25:34 +0000 (08:25 +0200)]
xattr.idl: Don't generate an interface table

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sun Oct 22 21:40:16 CEST 2017 on sn-devel-144

2 years agonfs4acls: Don't generate an interface table for nfs4acls.idl
Volker Lendecke [Tue, 15 Aug 2017 06:17:22 +0000 (08:17 +0200)]
nfs4acls: Don't generate an interface table for nfs4acls.idl

Nobody uses the function nfs4acl_test.

It took a while to figure out how to get this to build. The "uuid" line in the
idl file triggers pidl to generate the function table entry, which in turn then
triggers tables.pl to register this interface
./bin/default/source4/librpc/gen_ndr/tables.c. We could for example do the same
with xattr_parse_DOSATTRIB. Nobody uses this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agonfs4acls: Slightly simplify smb_add_ace4
Volker Lendecke [Tue, 15 Aug 2017 04:02:13 +0000 (06:02 +0200)]
nfs4acls: Slightly simplify smb_add_ace4

The comment was a bit confusing to me, it took a few seconds too many to figure
out *why* setting NULL is not required. Remove it :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agonfs4acls: Fix a debug message
Volker Lendecke [Tue, 15 Aug 2017 03:58:05 +0000 (05:58 +0200)]
nfs4acls: Fix a debug message

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3/smbd: update some more DEBUG macros in smbd_smb2_create_send
Ralph Boehme [Sat, 22 Jul 2017 17:34:25 +0000 (19:34 +0200)]
s3/smbd: update some more DEBUG macros in smbd_smb2_create_send

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): Sat Oct 21 18:08:46 CEST 2017 on sn-devel-144

2 years agos3/smbd: use early returns in smbd_smb2_create_send
Ralph Boehme [Fri, 21 Jul 2017 16:59:55 +0000 (18:59 +0200)]
s3/smbd: use early returns in smbd_smb2_create_send

Now that we have the nice smbd_smb2_create_after_exec() and
smbd_smb2_create_finish() functions, use early returns for the create
replay and durable handle reconnect case.

No change in behaviour, best viewed with

$ git show -w COMMIT

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: factor out smbd_smb2_create_after_exec from smbd_smb2_create_send
Ralph Boehme [Thu, 20 Jul 2017 14:14:31 +0000 (16:14 +0200)]
s3/smbd: factor out smbd_smb2_create_after_exec from smbd_smb2_create_send

No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: factor out smbd_smb2_create_before_exec from smbd_smb2_create_send
Ralph Boehme [Thu, 20 Jul 2017 14:14:31 +0000 (16:14 +0200)]
s3/smbd: factor out smbd_smb2_create_before_exec from smbd_smb2_create_send

No change in behaviour, best viewed with:

$ git show --diff-algorithm=histogram COMMIT

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: remove all stack variables of smbd_smb2_create_send into smbd_smb2_create_state
Ralph Boehme [Fri, 21 Jul 2017 16:02:05 +0000 (18:02 +0200)]
s3/smbd: remove all stack variables of smbd_smb2_create_send into smbd_smb2_create_state

This allows factoring out smbd_smb2_create_after|before_exec() in the
next steps.

Moving all variable in one big fell swoop instead of one per commit,
because if I'd miss to adjust a variable access the commit wouldn't
compile.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: move create ctx extraction and validation to a helper func
Ralph Boehme [Thu, 20 Jul 2017 10:51:37 +0000 (12:51 +0200)]
s3/smbd: move create ctx extraction and validation to a helper func

No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: move create contexts into smbd_smb2_create_state
Ralph Boehme [Thu, 20 Jul 2017 10:15:19 +0000 (12:15 +0200)]
s3/smbd: move create contexts into smbd_smb2_create_state

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: remove unneeded args from smbd_smb2_create_finish
Ralph Boehme [Thu, 20 Jul 2017 09:29:46 +0000 (11:29 +0200)]
s3/smbd: remove unneeded args from smbd_smb2_create_finish

The previous commits moved all arguments into smbd_smb2_create_state.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: move info into smbd_smb2_create_state
Ralph Boehme [Sat, 22 Jul 2017 16:49:50 +0000 (18:49 +0200)]
s3/smbd: move info into smbd_smb2_create_state

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: add in_create_disposition to smbd_smb2_create_state
Ralph Boehme [Sat, 22 Jul 2017 16:47:17 +0000 (18:47 +0200)]
s3/smbd: add in_create_disposition to smbd_smb2_create_state

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: add in_oplock_level to smbd_smb2_create_state
Ralph Boehme [Sat, 22 Jul 2017 16:43:33 +0000 (18:43 +0200)]
s3/smbd: add in_oplock_level to smbd_smb2_create_state

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: move requested_oplock_level into smbd_smb2_create_state
Ralph Boehme [Sat, 22 Jul 2017 16:40:16 +0000 (18:40 +0200)]
s3/smbd: move requested_oplock_level into smbd_smb2_create_state

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: move replay_operation into smbd_smb2_create_state
Ralph Boehme [Sat, 22 Jul 2017 16:32:50 +0000 (18:32 +0200)]
s3/smbd: move replay_operation into smbd_smb2_create_state

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: move result into smbd_smb2_create_state
Ralph Boehme [Sat, 22 Jul 2017 13:31:05 +0000 (15:31 +0200)]
s3/smbd: move result into smbd_smb2_create_state

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: leverage early return added in the previous commit
Ralph Boehme [Wed, 19 Jul 2017 17:07:55 +0000 (19:07 +0200)]
s3/smbd: leverage early return added in the previous commit

Now that the other cases handled in the if/else blocks do early returns,
we can move the logic handling file opens out of the final else block.

No change in behaviour, best viewed with

$ git show -w COMMIT

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: factor out smbd_smb2_create_finish from smbd_smb2_create_send
Ralph Boehme [Wed, 19 Jul 2017 17:04:46 +0000 (19:04 +0200)]
s3/smbd: factor out smbd_smb2_create_finish from smbd_smb2_create_send

No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: modernize a DEBUG statement
Ralph Boehme [Fri, 21 Jul 2017 13:34:02 +0000 (15:34 +0200)]
s3/smbd: modernize a DEBUG statement

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: move some setup code in smbd_smb2_create_send a few lines up
Ralph Boehme [Thu, 20 Jul 2017 04:03:34 +0000 (06:03 +0200)]
s3/smbd: move some setup code in smbd_smb2_create_send a few lines up

This is just one of the last steps before splitting out large code parts
into _before() and _after() functions. No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: add tevent context to smbd_smb2_create_state
Ralph Boehme [Fri, 21 Jul 2017 14:23:53 +0000 (16:23 +0200)]
s3/smbd: add tevent context to smbd_smb2_create_state

...and use it in everywhere in smbd_smb2_create_send().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3/smbd: use struct initializer for smbd_smb2_create_state
Ralph Boehme [Thu, 20 Jul 2017 04:49:46 +0000 (06:49 +0200)]
s3/smbd: use struct initializer for smbd_smb2_create_state

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agolib: Remove fncall.c
Volker Lendecke [Wed, 18 Oct 2017 15:15:53 +0000 (17:15 +0200)]
lib: Remove fncall.c

This was meant as a nice wrapper around pthreadpool_add_job.

pthreadpool_tevent_job_send does the same thing. The
getaddrinfo_send/recv was the only example and can easily be re-added on
top of pthreadpool_tevent_job_send.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Oct 21 00:04:59 CEST 2017 on sn-devel-144

2 years agolib: Remove unused getaddinfo_send/recv
Volker Lendecke [Wed, 18 Oct 2017 15:13:04 +0000 (17:13 +0200)]
lib: Remove unused getaddinfo_send/recv

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agotorture: Remove GETADDRINFO test
Volker Lendecke [Wed, 18 Oct 2017 15:11:21 +0000 (17:11 +0200)]
torture: Remove GETADDRINFO test

This was the only user of getaddrinfo_send and not run anyway

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Simplify cleanupdb a bit
Volker Lendecke [Wed, 18 Oct 2017 14:56:49 +0000 (16:56 +0200)]
smbd: Simplify cleanupdb a bit

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: cleanupdb.c is used in smbd only
Volker Lendecke [Wed, 18 Oct 2017 15:02:56 +0000 (17:02 +0200)]
smbd: cleanupdb.c is used in smbd only

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agovfs_glusterfs: Fix exporting subdirs with shadow_copy2
Michael Adam [Fri, 20 Oct 2017 12:55:10 +0000 (14:55 +0200)]
vfs_glusterfs: Fix exporting subdirs with shadow_copy2

Since the glusterfs vfs module does not operate on a
locally mounted path, but on a "virtual" path starting
at the volume root, some assumptions of the code about
the vfs connect path fail. One example is the shadow_copy2
module which tries to detect the mount point from the
connectpath. In order to circumvent this problem, this
patch forces the "shadow:mountpoint" option to "/", which
skips the mount-point-detection code.

This patch will only have an effect if both the glusterfs
and the shadow_copy2 module are listed in vfs objects
in the right order, i.e. first shadow_copy2, and then
glusterfs.

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

Pair-Programmed-With: Anoop C S <anoopcs@redhat.com>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoselftest: Print link meta-data when developer debugging is used
Tim Beale [Tue, 26 Sep 2017 22:21:48 +0000 (11:21 +1300)]
selftest: Print link meta-data when developer debugging is used

For Windows, DRS is the only way to see the RMD_VERSION of a link, or to
tell what inactive links the DC. Add some debug to display this
information. By default, this debug is turned off.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Oct 20 08:01:35 CEST 2017 on sn-devel-144

2 years agoreplmd: Remove unnecessary replmd_build_la_val() param
Tim Beale [Thu, 28 Sep 2017 03:13:05 +0000 (16:13 +1300)]
replmd: Remove unnecessary replmd_build_la_val() param

replmd_build_la_val() is creating a new link attribute. In this case,
the RMD_ORIGINATING_USN and RMD_LOCAL_USN are always going to be the
same thing, so we don't need to pass them in as 2 separate parameters.

This isn't required for any bug fix, but is just a general code
tidy-up.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Get rid of duplicated replmd_build_la_val() code
Tim Beale [Thu, 28 Sep 2017 02:48:58 +0000 (15:48 +1300)]
replmd: Get rid of duplicated replmd_build_la_val() code

replmd_build_la_val() and replmd_set_la_val() are pretty much identical.
Keep the replmd_build_la_val() API (as it makes it clearer we're
creating a new linked attribute), but replace the code with a call to
replmd_set_la_val().

This isn't required for any bug fix, but is just a general tidy-up to
avoid code duplication.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Fix RMD_VERSION inital value to match Windows
Tim Beale [Thu, 28 Sep 2017 02:09:34 +0000 (15:09 +1300)]
replmd: Fix RMD_VERSION inital value to match Windows

The initial value for RMD_VERSION is one on Windows. The MS-DRSR spec
states the following in section 5.11 AttributeStamp:

  dwVersion: A 32-bit integer. Set to 1 when a value for the attribute is
  set for the first time. On each subsequent originating update, if the
  current value of dwVersion is less than 0xFFFFFFFF, then increment it
  by 1; otherwise set it to 0

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Remove static values passed to replmd_build_la_val()
Tim Beale [Thu, 28 Sep 2017 02:01:21 +0000 (15:01 +1300)]
replmd: Remove static values passed to replmd_build_la_val()

replmd_build_la_val() is used to populate a new link attribute value
from scratch. The version parameter is always passed in as the initial
value (zero), and deleted is always passed in as false.

For cases (like replication) where we want to set version/deleted to
something other than the defaults, we can use replmd_set_la_val()
instead.

This patch changes these 2 parameters to variables instead.

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoselftest: Add test for initial link attribute RMD_VERSION value
Tim Beale [Thu, 28 Sep 2017 01:42:08 +0000 (14:42 +1300)]
selftest: Add test for initial link attribute RMD_VERSION value

While testing link conflicts I noticed that links on Windows start from
a different RMD_VERSION compared to Samba. This adds a simple test to
highlight the problem.

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Small refactor to replmd_check_singleval_la_conflict()
Tim Beale [Wed, 27 Sep 2017 23:10:11 +0000 (12:10 +1300)]
replmd: Small refactor to replmd_check_singleval_la_conflict()

Now that the code is all in one place we can refactor it to make it
slightly more readable.

- added more code comments
- tweaked the 'no conflict' return logic to try to make what it's checking
  for more obvious
- removed conflict_pdn (we can just use active_pdn instead)
- added a placeholder variable and tweaked a parameter name

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Change replmd_check_singleval_la_conflict() logic flow
Tim Beale [Wed, 27 Sep 2017 23:01:34 +0000 (12:01 +1300)]
replmd: Change replmd_check_singleval_la_conflict() logic flow

Return immediately if there's no conflict, which reduces nesting.

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Move link conflict handling into separate function
Tim Beale [Wed, 27 Sep 2017 21:22:55 +0000 (10:22 +1300)]
replmd: Move link conflict handling into separate function

Link conflict handling is a corner-case. The logic in
replmd_process_linked_attribute() is already reasonably busy/complex.
Split out the handling of link conflicts into a separate function so
that it doesn't detract from the core replmd_process_linked_attribute()
logic too much.

This refactor should not alter functionality.

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Handle single-valued conflicts for an existing link
Tim Beale [Wed, 27 Sep 2017 20:42:14 +0000 (09:42 +1300)]
replmd: Handle single-valued conflicts for an existing link

Currently the code only handles the case where the received link
attribute is a new link (i.e. pdn == NULL). As well as this, we need to
handle the case where the conflicting link already exists, i.e. it's a
deleted link that has been re-added on another DC.

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Mark link conflicts as inactive correctly
Tim Beale [Wed, 27 Sep 2017 03:37:59 +0000 (16:37 +1300)]
replmd: Mark link conflicts as inactive correctly

The previous patch to handle link conflicts was simply overriding the
received information and marking the link as deleted. We should be doing
this as a separate operation to make it clear what has happened, and so
that the new (i.e. inactive) link details get replicated out.

This patch changes it so that when a conflict occurs, we immediately
overwrite the received information to mark it as deleted, and to update
the version/USN/timestamp/originating_invocation_id to make it clear
that this is a new change.

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Use replmd_set_la_val() when adding new links
Tim Beale [Wed, 27 Sep 2017 03:23:29 +0000 (16:23 +1300)]
replmd: Use replmd_set_la_val() when adding new links

replmd_set_la_val() and replmd_build_la_val() are almost identical. When
we were processing the replicated link attributes we were calling one
function if the link was new, and a different one if the link existed.
I think we should be able to get away with using replmd_set_la_val() in
both cases.

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Fix talloc inconsistency in replmd_set_la_val()
Tim Beale [Thu, 28 Sep 2017 03:19:29 +0000 (16:19 +1300)]
replmd: Fix talloc inconsistency in replmd_set_la_val()

All the other talloc_asprintf()s in this function use the mem_ctx, but
for some reason the vstring was using the dsdb_dn->dn. This probably
isn't a big deal, but might have unintentional side-effects.

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Make replmd_set_la_val() closer to replmd_build_la_val()
Tim Beale [Thu, 28 Sep 2017 02:58:16 +0000 (15:58 +1300)]
replmd: Make replmd_set_la_val() closer to replmd_build_la_val()

These two functions are almost identical. The main difference between
them is the RMD_ADDTIME. replmd_set_la_val() tries to use the
RMD_ADDTIME of the old_dsdb_dn. Whereas replmd_build_la_val() always
uses the time passed in.

Change replmd_set_la_val() so it can accept a NULL old_dsdb_dn (i.e. if
it's a new linked attribute that's being set). If so, it'll end up using
the nttime parameter passed in, same as replmd_build_la_val() does.

Also update replmd_process_linked_attribute (which used to use
replmd_build_la_val()) to now pass in a NULL old_dsdb_dn. There
shouldn't be a difference in behaviour either way, but this exercises
the code change.

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Handle conflicts for single-valued link attributes better
Tim Beale [Wed, 27 Sep 2017 00:44:29 +0000 (13:44 +1300)]
replmd: Handle conflicts for single-valued link attributes better

If 2 DCs independently set a single-valued linked attribute to differing
values, Samba should be able to resolve this problem when replication
occurs.

If the received information is better, then we want to set the existing
link attribute in our DB as inactive.

If our own information is better, then we still want to add the received
link attribute, but mark it as inactive so that it doesn't clobber our
own link.

This still isn't a complete solution. When we add the received attribute
as inactive, we really should be incrementing the version, updating the
USN, etc. Also this only deals with the case where the received link is
completely new (i.e. a received link conflicting with an existing
inactive link isn't handled).

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Partial fix for single-valued link conflict
Tim Beale [Mon, 18 Sep 2017 23:59:58 +0000 (11:59 +1200)]
replmd: Partial fix for single-valued link conflict

This is the first part of the fix for resolving a single-valued link
conflict.

When processing the replication data for a linked attribute, if we don't
find a match for the link target value, check if the link is a
single-valued attribute and it currently has an active link. If so, then
use the active link instead.

This change means we delete the existing active link (and backlink)
before adding the new link. This prevents the failure in the subsequent
dsdb_check_single_valued_link() check that was happening previously
(because the link would end up with 2 active values).

This is only a partial fix. It stops replication from failing completely
if we ever hit this situation (which means the test is no longer
hitting an assertion when replicating). However, ideally the existing
active link should be retained and just marked as deleted (with this
change, the existing link is overwritten completely).

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoselftest: Add conflict test where the single-valued link already exists
Tim Beale [Wed, 27 Sep 2017 01:43:53 +0000 (14:43 +1300)]
selftest: Add conflict test where the single-valued link already exists

As well as testing scenarios where both variants of the link are new, we
should also check the case where the received link already exists on the
DC as an inactive (i.e. previously deleted) link.

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoselftest: Add test for deleted single-valued link conflict
Tim Beale [Tue, 26 Sep 2017 00:55:11 +0000 (13:55 +1300)]
selftest: Add test for deleted single-valued link conflict

Currently we're only testing the case where the links have been modified
independently on 2 different DCs and both the links are active. We also
want to test the case where one link is active and the other is deleted.

Technically, this isn't really a conflict - the links involve different
target DNs, and the end result is still only one active link.

It's still probably worth having these tests to prove that fixing bug
13055 doesn't break anything.

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoselftest: Make sure single-link conflict retains the deleted link
Tim Beale [Tue, 19 Sep 2017 01:41:02 +0000 (13:41 +1200)]
selftest: Make sure single-link conflict retains the deleted link

There should only ever be one active value for a single-valued link
attribute. When a conflict occurs the 'losing' value should still be
present, but should be marked as deleted.

This change is just making the test criteria stricter to make sure that
we fix the bug correctly.

Note that the only way to query the deleted link attributes present
is to send a DRS request.

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Remove unused originating_usn variable
Tim Beale [Mon, 18 Sep 2017 04:39:44 +0000 (16:39 +1200)]
replmd: Remove unused originating_usn variable

The previous refactor makes it obvious that we aren't actually using
this variable for anything.

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Refactor logic to check if replicated link is newer
Tim Beale [Mon, 18 Sep 2017 04:33:30 +0000 (16:33 +1200)]
replmd: Refactor logic to check if replicated link is newer

This is precursor work for supporting single-link conflicts.

Split out the code to check if the link update is newer. It's now safe
to call this from the main codepath. This also means we can combine the 2
calls to get the seqnum into a single common call.

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplmd: Refactor adding the backlink in replmd_process_linked_attribute()
Tim Beale [Mon, 18 Sep 2017 01:47:56 +0000 (13:47 +1200)]
replmd: Refactor adding the backlink in replmd_process_linked_attribute()

The code to add the backlink is the same in both the 'if' and the 'else'
case, so move it outside the if-else block.

(We're going to rework this block of code quite a bit in order to
support single-value linked attribute conflicts, aka bug #13055).

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

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoreplace: Link to -lbsd when building replace.c by hand
Andrew Bartlett [Sat, 14 Oct 2017 09:38:18 +0000 (22:38 +1300)]
replace: Link to -lbsd when building replace.c by hand

This ensures that we correctly detect HAVE_IFACE_GETIFADDRS
et al, which are based on a "build the source" style test.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agos3:cli_netlogon: let rpccli_connect_netlogon() retry once after NT_STATUS_NETWORK_ACC...
Stefan Metzmacher [Wed, 18 Oct 2017 11:36:59 +0000 (13:36 +0200)]
s3:cli_netlogon: let rpccli_connect_netlogon() retry once after NT_STATUS_NETWORK_ACCESS_DENIED

Otherwise we could easily endup with an endless loop.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:cli_netlogon: make sure rpccli_connect_netlogon only returns NT_STATUS_OK on success
Stefan Metzmacher [Wed, 18 Oct 2017 11:36:59 +0000 (13:36 +0200)]
s3:cli_netlogon: make sure rpccli_connect_netlogon only returns NT_STATUS_OK on success

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:tests: Fix the smblcient utimes test in Europe
Andreas Schneider [Thu, 19 Oct 2017 16:03:27 +0000 (18:03 +0200)]
s3:tests: Fix the smblcient utimes test in Europe

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Oct 20 03:37:31 CEST 2017 on sn-devel-144

2 years agos4:smbd: Add missing unistd.h include to fix build of process_prefork
Andreas Schneider [Thu, 19 Oct 2017 15:27:23 +0000 (17:27 +0200)]
s4:smbd: Add missing unistd.h include to fix build of process_prefork

error: implicit declaration of function ‘getpgrp’; did you mean ‘getpt’?
[-Werror=implicit-function-declaration]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agonwrap: Fix strotoul checks for NSS_WRAPPER_MAX_HOSTENTS
Douglas Bagnall [Thu, 19 Oct 2017 08:56:15 +0000 (10:56 +0200)]
nwrap: Fix strotoul checks for NSS_WRAPPER_MAX_HOSTENTS

The env and endptr pointers need to be dereferenced, but that is not
enough: we don't really want to regard an empty string (*env == '\0')
as a valid number.

Found by GCC 8.0.0 20170705 (experimental).

[2095/4103] Compiling lib/nss_wrapper/nss_wrapper.c
../lib/nss_wrapper/nss_wrapper.c: In function "nwrap_init":
../lib/nss_wrapper/nss_wrapper.c:1571:13: warning: comparison between pointer and zero character constant [-Wpointer-compare]
   if (((env != '\0') && (endptr == '\0')) ||
                ^~
                ../lib/nss_wrapper/nss_wrapper.c:1571:9: note: did you mean to dereference the pointer?
   if (((env != '\0') && (endptr == '\0')) ||
            ^
            ../lib/nss_wrapper/nss_wrapper.c:1571:33: warning: comparison between pointer and zero character constant [-Wpointer-compare]
   if (((env != '\0') && (endptr == '\0')) ||
                                    ^~
                                    ../lib/nss_wrapper/nss_wrapper.c:1571:26: note: did you mean to dereference the pointer?
   if (((env != '\0') && (endptr == '\0')) ||

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Oct 19 16:42:17 CEST 2017 on sn-devel-144

2 years agopython: use communicate to fix Popen deadlock
Joe Guo [Fri, 15 Sep 2017 04:13:26 +0000 (16:13 +1200)]
python: use communicate to fix Popen deadlock

`Popen.wait()` will deadlock when using stdout=PIPE and/or stderr=PIPE and the
child process generates large output to a pipe such that it blocks waiting for
the OS pipe buffer to accept more data. Use communicate() to avoid that.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Oct 19 09:27:16 CEST 2017 on sn-devel-144

2 years agopython: add a failed test to show Popen deadlock
Joe Guo [Fri, 15 Sep 2017 03:31:34 +0000 (15:31 +1200)]
python: add a failed test to show Popen deadlock

`Popen.wait()` will deadlock when using stdout=PIPE and/or stderr=PIPE and the
child process generates large output to a pipe such that it blocks waiting for
the OS pipe buffer to accept more data. Use communicate() to avoid that.

This patch is commited to show the issue, a fix patch will come later.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosource4/smbd: replace DEBUG( with DBG_
Gary Lockyer [Sun, 10 Sep 2017 23:39:39 +0000 (11:39 +1200)]
source4/smbd: replace DEBUG( with DBG_

Update the debug logging to use the currently preferred debug macros

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2 years agoselftest: set ad_dc process model to prefork
Gary Lockyer [Tue, 5 Sep 2017 00:31:52 +0000 (12:31 +1200)]
selftest: set ad_dc process model to prefork

Set the process model for ad_dc to prefork, so that the pre-fork gets
exercised during self test.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>