timbeale/samba-autobuild/.git
4 years agoWHATSNEW.txt: reindex performance, Bind9 logging master
Gary Lockyer [Thu, 6 Jun 2019 22:01:14 +0000 (10:01 +1200)]
WHATSNEW.txt: reindex performance, Bind9 logging

Add entries for:
  Reindex performance improvements
  Bind9 logging
  LDAP referrals

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Tim Beale <timbeale@catalyst.net.nz>
4 years agoRevert TestCaseInSubDir parts of "downgradedatabase: blackbox test"
Andrew Bartlett [Fri, 31 May 2019 00:47:13 +0000 (12:47 +1200)]
Revert TestCaseInSubDir parts of "downgradedatabase: blackbox test"

This reverts part of commit 74d15c9bf76f0a2fb5fa7b7b1d80971d10c4fe45.

TestCaseInSubDir should not have been modified in this way, instead
the downgradedatabase test should have removed the files it created
specifically (this is part of the test, it shows the right files were
created).

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jun  7 21:08:12 UTC 2019 on sn-devel-184

4 years agoselftest: Specifically remove files generated by provision
Andrew Bartlett [Fri, 31 May 2019 01:06:59 +0000 (13:06 +1200)]
selftest: Specifically remove files generated by provision

This allows the changes in 74d15c9bf76f0a2fb5fa7b7b1d80971d10c4fe45 to
be reverted, and aligns this test with others that use TestCaseInTempDir.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 years agopy3: Remove unused PyInt_AsSsize_t macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 04:04:19 +0000 (06:04 +0200)]
py3: Remove unused PyInt_AsSsize_t macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Jun  6 13:26:05 UTC 2019 on sn-devel-184

4 years agopy3: Remove unused PyInt_AsUnsignedLongLongMask macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 04:02:49 +0000 (06:02 +0200)]
py3: Remove unused PyInt_AsUnsignedLongLongMask macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopy3: Remove unused PyInt_AS_LONG macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 04:02:02 +0000 (06:02 +0200)]
py3: Remove unused PyInt_AS_LONG macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopy3: Remove unused PyInt_FromSize_t macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 04:01:16 +0000 (06:01 +0200)]
py3: Remove unused PyInt_FromSize_t macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopy3: Remove unused PyInt_FromSsize_t macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 04:00:41 +0000 (06:00 +0200)]
py3: Remove unused PyInt_FromSsize_t macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopy3: Remove unused PyInt_FromString macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 03:59:56 +0000 (05:59 +0200)]
py3: Remove unused PyInt_FromString macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopy3: Remove unused PyInt_CheckExact macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 03:59:17 +0000 (05:59 +0200)]
py3: Remove unused PyInt_CheckExact macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopy3: Remove unused PY_DESC_PY3_STRING macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 03:57:43 +0000 (05:57 +0200)]
py3: Remove unused PY_DESC_PY3_STRING macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopy3: Remove unused PyStr_AsUTF8String macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 03:54:36 +0000 (05:54 +0200)]
py3: Remove unused PyStr_AsUTF8String macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopy3: Remove unused PyStr_Decode macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 03:53:44 +0000 (05:53 +0200)]
py3: Remove unused PyStr_Decode macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopy3: Remove unused PyStr_InternFromString macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 03:52:54 +0000 (05:52 +0200)]
py3: Remove unused PyStr_InternFromString macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopy3: Remove unused PyStr_InternInPlace macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 03:52:07 +0000 (05:52 +0200)]
py3: Remove unused PyStr_InternInPlace macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopy3: Remove unused PyStr_Format macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 03:50:49 +0000 (05:50 +0200)]
py3: Remove unused PyStr_Format macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopy3: Remove unused PyStr_Concat macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 03:50:19 +0000 (05:50 +0200)]
py3: Remove unused PyStr_Concat macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopy3: Remove unused PyStr_CheckExact macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 03:48:07 +0000 (05:48 +0200)]
py3: Remove unused PyStr_CheckExact macro from py3compat.h

Now that we are no longer developing new py2/py3 compatible code we can remove
any aspects of this header we do not use.  This will make the eventual removal
easier.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopy3: Remove unused IS_PY3 macro from py3compat.h
Andrew Bartlett [Thu, 6 Jun 2019 03:46:27 +0000 (05:46 +0200)]
py3: Remove unused IS_PY3 macro from py3compat.h

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopy3: Remove Python2 side of py3compat.h
Andrew Bartlett [Wed, 5 Jun 2019 15:13:00 +0000 (17:13 +0200)]
py3: Remove Python2 side of py3compat.h

This is unused as we do not support building python modules (etc) under py2.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agotests blackbox ndrdump: Clean up pep8 warnings
Gary Lockyer [Tue, 4 Jun 2019 22:34:17 +0000 (10:34 +1200)]
tests blackbox ndrdump: Clean up pep8 warnings

Clean up the test code and remove the pep8 warnings

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Jun  6 04:58:18 UTC 2019 on sn-devel-184

4 years agontprinting.idl: remove decode functions
Gary Lockyer [Tue, 4 Jun 2019 01:07:06 +0000 (13:07 +1200)]
ntprinting.idl: remove decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agowinsrepl.idl: remove unused decode functions
Gary Lockyer [Mon, 3 Jun 2019 23:46:05 +0000 (11:46 +1200)]
winsrepl.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosasl_helpers.idl: remove unused decode functions
Gary Lockyer [Mon, 3 Jun 2019 23:45:40 +0000 (11:45 +1200)]
sasl_helpers.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agontp_signd.idl: remove unused decode functions
Gary Lockyer [Mon, 3 Jun 2019 23:44:46 +0000 (11:44 +1200)]
ntp_signd.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosecurity.idl: remove unused decode functions
Gary Lockyer [Mon, 3 Jun 2019 23:44:17 +0000 (11:44 +1200)]
security.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopreg.idl: remove unused decode functions
Gary Lockyer [Mon, 3 Jun 2019 23:43:48 +0000 (11:43 +1200)]
preg.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agonegoex.idl: remove unused decode functions
Gary Lockyer [Mon, 3 Jun 2019 23:43:24 +0000 (11:43 +1200)]
negoex.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agonbt.idl: remove unused decode functions
Gary Lockyer [Mon, 3 Jun 2019 23:43:07 +0000 (11:43 +1200)]
nbt.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agokrb5pac.idl: remove unused decode functions
Gary Lockyer [Mon, 3 Jun 2019 23:42:44 +0000 (11:42 +1200)]
krb5pac.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agocab.idl: remove unused decode functions
Gary Lockyer [Mon, 3 Jun 2019 23:41:51 +0000 (11:41 +1200)]
cab.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodnsp.idl: remove unused decode functions
Gary Lockyer [Mon, 3 Jun 2019 23:32:40 +0000 (11:32 +1200)]
dnsp.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agontlmssp.idl: remove unused decode functions
Gary Lockyer [Mon, 3 Jun 2019 23:29:49 +0000 (11:29 +1200)]
ntlmssp.idl: remove unused decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodrsblobs.idl: remove decode functions
Gary Lockyer [Fri, 31 May 2019 03:49:20 +0000 (15:49 +1200)]
drsblobs.idl: remove decode functions

Remove the decode_* functions as they are no longer needed, and this
will reduce the amount of untested automatically generated code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agondrdump: print public structures
Gary Lockyer [Tue, 4 Jun 2019 20:44:09 +0000 (08:44 +1200)]
ndrdump: print public structures

Add a struct option to ndrdump that will allow it to print public
structures.
  i.e. binn/ndrdump dns dns_name_packet struct data.file

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agopidl: Allow ndrdump to print public structures
Gary Lockyer [Tue, 4 Jun 2019 20:43:33 +0000 (08:43 +1200)]
pidl: Allow ndrdump to print public structures

Generate code to allow ndrdump to operate on public structures.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

4 years agotests blackbox ndrdump: Add test for struct printing
Gary Lockyer [Tue, 4 Jun 2019 02:01:49 +0000 (14:01 +1200)]
tests blackbox ndrdump: Add test for struct printing

Add test for the dumping of a public structure with ndrdump.  This
removes the need to define decode_* functions in the idl.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:auth: explicitly add BUILTIN\Guests to the guest token
Ralph Boehme [Mon, 13 May 2019 18:16:47 +0000 (20:16 +0200)]
s3:auth: explicitly add BUILTIN\Guests to the guest token

This changes ensures that smbd always adds BUILTIN\Guests to the guest token
which is required for guest authentication.

Currently the guest token depends on the on-disk configured group mappings. If
there's an existing group mapping for BUILTIN\Guests, but LOCALSAM\Guest is not
a member, the final guest token won't contain BUILTIN\Guests.

For SMB2 the flag SMB2_SESSION_FLAG_IS_GUEST will not be set in the final SMB2
SESSION_SETUP response, because smbd sets it based on the token containing the
BUILTIN\Guests SID S-1-5-32-546.

At the same time, the packet is not signed which causes Windows clients and
smbclient to reject the unsigned SMB2 SESSION_SETUP response.

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

Pair-programmed-with: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jun  5 16:55:26 UTC 2019 on sn-devel-184

4 years agotests: add a test for guest authentication
Ralph Boehme [Thu, 16 May 2019 10:47:34 +0000 (12:47 +0200)]
tests: add a test for guest authentication

This verifies that smbd always adds BUILTIN\Guests to the guest token which is
required for guest authentication.

Currently the guest token depends on the on-disk configured group mappings. If
there's an existing group mapping for BUILTIN\Guests, but LOCALSAM\Guest is not
a member, the final guest token won't contain BUILTIN\Guests.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoselftest: allow guest login in the ad_member_idmap_rid env
Ralph Boehme [Thu, 16 May 2019 10:43:40 +0000 (12:43 +0200)]
selftest: allow guest login in the ad_member_idmap_rid env

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:smbd: call reinit_guest_session_info() in the conf updated handler
Ralph Boehme [Thu, 16 May 2019 10:42:54 +0000 (12:42 +0200)]
s3:smbd: call reinit_guest_session_info() in the conf updated handler

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:auth: add reinit_guest_session_info()
Ralph Boehme [Thu, 16 May 2019 10:42:29 +0000 (12:42 +0200)]
s3:auth: add reinit_guest_session_info()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agotests auth log winbind: Fix flapping test
Gary Lockyer [Wed, 5 Jun 2019 02:52:03 +0000 (14:52 +1200)]
tests auth log winbind: Fix flapping test

Fix flapping auth_log_winbind tests, were seeing failures like

UNEXPECTED(failure):
samba.tests.auth_log_winbind.samba.tests.auth_log_winbind.AuthLogTestsWinbind.
test_wbinfo(ad_member:local)
REASON: Exception: Exception: Traceback (most recent call last):
  File "bin/python/samba/tests/auth_log_winbind.py", line 328, in
  test_wbinfo
      self.assertEquals(logon_id, msg["Authentication"]["logonId"])
      AssertionError: '812b7158bff1660e' != '2cfc1fed76ff8865'
      - 812b7158bff1660e
      + 2cfc1fed76ff8865

Test had a race condition with other SamLogon events on the domain
server. The tests can now handle multiple SamLogon messages and filter
out the SamLogon messages for other logons.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agothird_party: Update waf to version 2.0.17
Andreas Schneider [Mon, 3 Jun 2019 08:40:55 +0000 (10:40 +0200)]
third_party: Update waf to version 2.0.17

This fixes building Samba, libtalloc, libtevent, libtdb and libldb with
Python 3.8.

     wget https://waf.io/waf-2.0.17.tar.bz2
     tar -xf waf-2.0.17.tar.bz2
     git rm third_party/waf/waflib/ -r
     mkdir third_party/waf -p
     rsync -a waf-2.0.17/waflib/ third_party/waf/waflib/
     git add third_party/waf/waflib/

(Then update version number in buildtools/bin/waf and
buildtools/wafsamba/wafsamba.py)

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agoctdb-utils: Fix CID 1125558 (Unchecked return value from library)
Martin Schwenke [Wed, 29 May 2019 09:11:51 +0000 (19:11 +1000)]
ctdb-utils: Fix CID 1125558 (Unchecked return value from library)

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): Wed Jun  5 12:09:56 UTC 2019 on sn-devel-184

4 years agoctdb-daemon: Attempt to silence CID 1357985 (Unchecked return value)
Martin Schwenke [Wed, 29 May 2019 09:05:49 +0000 (19:05 +1000)]
ctdb-daemon: Attempt to silence CID 1357985 (Unchecked return value)

Yes, the other callers check the return value of ctdb_lockdb_mark().
However, this is called in a void function and ctdb_lockdb_mark() has
already printed any error message.  All we can do is explicitly ignore
the return value.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-cluster: CID 1435726: NULL pointer dereference
Martin Schwenke [Wed, 29 May 2019 07:38:03 +0000 (17:38 +1000)]
ctdb-cluster: CID 1435726: NULL pointer dereference

Also found by csbuild.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-ipalloc: Fix warning about unused value assigned to srcimbl
Martin Schwenke [Thu, 30 May 2019 05:41:42 +0000 (15:41 +1000)]
ctdb-ipalloc: Fix warning about unused value assigned to srcimbl

To make this much clearer, move the declaration into the scope where
it is used.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-ipalloc: Avoid -1 as a PNN, use CTDB_UNKNOWN_PNN instead
Martin Schwenke [Thu, 30 May 2019 05:40:42 +0000 (15:40 +1000)]
ctdb-ipalloc: Avoid -1 as a PNN, use CTDB_UNKNOWN_PNN instead

This fixes warnings about signed versus unsigned comparisons.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-ipalloc: Fix signed/unsigned comparisons by declaring as unsigned
Martin Schwenke [Thu, 30 May 2019 05:37:38 +0000 (15:37 +1000)]
ctdb-ipalloc: Fix signed/unsigned comparisons by declaring as unsigned

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tests: Avoid potentially uninitialised data
Martin Schwenke [Thu, 30 May 2019 05:33:05 +0000 (15:33 +1000)]
ctdb-tests: Avoid potentially uninitialised data

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-utils: Avoid warning about unused value
Martin Schwenke [Thu, 30 May 2019 05:32:03 +0000 (15:32 +1000)]
ctdb-utils: Avoid warning about unused value

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recovery: Fix signed/unsigned comparisons by declaring as unsigned
Martin Schwenke [Sat, 25 May 2019 12:04:10 +0000 (22:04 +1000)]
ctdb-recovery: Fix signed/unsigned comparisons by declaring as unsigned

Simple cases where variables and function parameters need to be
declared as an unsigned type instead of an int.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recovery: Avoid -1 as a PNN, use CTDB_UNKNOWN_PNN instead
Martin Schwenke [Thu, 23 May 2019 07:50:32 +0000 (17:50 +1000)]
ctdb-recovery: Avoid -1 as a PNN, use CTDB_UNKNOWN_PNN instead

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recovery: Fix signed/unsigned comparison by casting
Martin Schwenke [Thu, 23 May 2019 07:47:24 +0000 (17:47 +1000)]
ctdb-recovery: Fix signed/unsigned comparison by casting

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recovery: Fix signed/unsigned comparisons by declaring as unsigned
Martin Schwenke [Wed, 22 May 2019 22:43:58 +0000 (08:43 +1000)]
ctdb-recovery: Fix signed/unsigned comparisons by declaring as unsigned

Simple cases where variables need to be declared as an unsigned type
instead of an int.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tests: Fix signed/unsigned comparison by using constant
Martin Schwenke [Wed, 22 May 2019 11:58:46 +0000 (21:58 +1000)]
ctdb-tests: Fix signed/unsigned comparison by using constant

Variable reqid is unsigned, so don't compare with -1.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-client: Fix potentially uninitialised data
Martin Schwenke [Wed, 22 May 2019 11:58:14 +0000 (21:58 +1000)]
ctdb-client: Fix potentially uninitialised data

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-client: Fix signed/unsigned comparisons by declaring as unsigned
Martin Schwenke [Wed, 22 May 2019 11:55:56 +0000 (21:55 +1000)]
ctdb-client: Fix signed/unsigned comparisons by declaring as unsigned

Simple cases where a variables and function parameters need to be
declared as an unsigned type instead of an int.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-common: Avoid unused value warning
Martin Schwenke [Thu, 23 May 2019 07:53:19 +0000 (17:53 +1000)]
ctdb-common: Avoid unused value warning

The incremented value of argc is indeed never used.  Leave it as a
comment to warn anyone cutting and pasting the code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-common: Avoid warning for potentially uninitialised pointers
Martin Schwenke [Thu, 23 May 2019 07:51:46 +0000 (17:51 +1000)]
ctdb-common: Avoid warning for potentially uninitialised pointers

s_list generates a warning, but initialise them both.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-common: Use #ifdef to avoid TEST_RB_TREE not defined
Martin Schwenke [Thu, 23 May 2019 07:49:26 +0000 (17:49 +1000)]
ctdb-common: Use #ifdef to avoid TEST_RB_TREE not defined

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-common: Fix signed/unsigned comparisons by casting
Martin Schwenke [Sun, 2 Jun 2019 04:05:28 +0000 (14:05 +1000)]
ctdb-common: Fix signed/unsigned comparisons by casting

In one case, given triviality of change, add missing braces and fix
whitespace.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-common: Fix signed/unsigned comparisons by declaring as unsigned
Martin Schwenke [Wed, 22 May 2019 11:55:18 +0000 (21:55 +1000)]
ctdb-common: Fix signed/unsigned comparisons by declaring as unsigned

Simple cases where a variable (usually a loop variable) needs to be
declared as an unsigned type (unsigned int or size_t) instead of an
int.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tools: Fix potentially uninitialised data
Martin Schwenke [Wed, 22 May 2019 11:57:43 +0000 (21:57 +1000)]
ctdb-tools: Fix potentially uninitialised data

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tools: Fix signed/unsigned conversion by declaring as size_t
Martin Schwenke [Tue, 28 May 2019 00:57:49 +0000 (10:57 +1000)]
ctdb-tools: Fix signed/unsigned conversion by declaring as size_t

All the top-level callers pass size_t.

Drop the ternary operator.  The value of hsize is always positive
because it is unsigned.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tools: Fix signed/unsigned comparison by declaring as int
Martin Schwenke [Tue, 28 May 2019 00:55:19 +0000 (10:55 +1000)]
ctdb-tools: Fix signed/unsigned comparison by declaring as int

There's no point using unsigned here.  tdb_traverse() returns an int
for the number of records traversed and the number of empty records
can't exceed this value.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tools: Fix signed/unsigned comparison by declaring as unsigned
Martin Schwenke [Wed, 22 May 2019 11:54:04 +0000 (21:54 +1000)]
ctdb-tools: Fix signed/unsigned comparison by declaring as unsigned

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tools: Fix signed/unsigned comparisons by casting
Martin Schwenke [Wed, 22 May 2019 11:57:07 +0000 (21:57 +1000)]
ctdb-tools: Fix signed/unsigned comparisons by casting

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tools: Fix signed/unsigned comparisons by declaring extra variable
Martin Schwenke [Fri, 24 May 2019 03:50:07 +0000 (13:50 +1000)]
ctdb-tools: Fix signed/unsigned comparisons by declaring extra variable

This needs an extra variable because variable i has been used in both
signed and unsigned contexts.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tools: Fix signed/unsigned comparisons by declaring as unsigned
Martin Schwenke [Wed, 22 May 2019 11:52:17 +0000 (21:52 +1000)]
ctdb-tools: Fix signed/unsigned comparisons by declaring as unsigned

These are the simple cases where a variable (usually a loop variable)
needs to be declared as an unsigned type (usually unsigned int or
size_t) instead of an int.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-scripts: Fix tcp_tw_recycle existence check
Rafael David Tinoco via samba-technical [Mon, 3 Jun 2019 02:44:15 +0000 (23:44 -0300)]
ctdb-scripts: Fix tcp_tw_recycle existence check

net.ipv4.tcp_tw_recycle has been removed from Linux 4.12 but, still,
makes sense to check its existence. Unfortunately, current check does
not test for the procfs file existence. This commit fixes the issue.

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

Signed-off-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jun  4 23:31:24 UTC 2019 on sn-devel-184

4 years agoctdb:takeover: add better debugging when a client connects to a non public address
Stefan Metzmacher [Tue, 2 Apr 2019 08:24:02 +0000 (10:24 +0200)]
ctdb:takeover: add better debugging when a client connects to a non public address

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agoctdb:protocol_util: remove 'const' from allocated strings
Stefan Metzmacher [Mon, 27 May 2019 10:31:51 +0000 (12:31 +0200)]
ctdb:protocol_util: remove 'const' from allocated strings

The caller should be able to call TALLOC_FREE() on the returned
strings.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 years agodocs: Improve documentation of "lanman auth" and "ntlm auth" connection
Andrew Bartlett [Fri, 31 May 2019 21:04:48 +0000 (09:04 +1200)]
docs: Improve documentation of "lanman auth" and "ntlm auth" connection

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3:modules: Put debug msg into the if clause checking the strings exists
Andreas Schneider [Mon, 3 Jun 2019 09:00:01 +0000 (11:00 +0200)]
s3:modules: Put debug msg into the if clause checking the strings exists

error: '%s' directive argument is null [-Werror=format-overflow=]

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agonsswitch: cppcheck: Fix ctunullpointer error
Noel Power [Thu, 23 May 2019 13:56:39 +0000 (13:56 +0000)]
nsswitch: cppcheck: Fix ctunullpointer error

Fixes

nsswitch/pam_winbind.c:1379: error: ctunullpointer: Null pointer dereference: info <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agolib/util/tests: clang fix Value stored to 'lines' is never read warning
Noel Power [Thu, 23 May 2019 13:52:50 +0000 (13:52 +0000)]
lib/util/tests: clang fix Value stored to 'lines' is never read warning

Fixes

lib/util/tests/file.c:153:2: warning: Value stored to 'lines' is never read <--[clang]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agoctdb/server: cppcheck: fix shiftTooManyBitsSigned error
Noel Power [Thu, 23 May 2019 13:15:58 +0000 (13:15 +0000)]
ctdb/server: cppcheck: fix shiftTooManyBitsSigned error

Fixes

ctdb/server/ipalloc_lcp2.c:61: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3/winbdind: cppcheck: fix nullPointerArithmetic error
Noel Power [Wed, 22 May 2019 14:17:48 +0000 (14:17 +0000)]
s3/winbdind: cppcheck: fix nullPointerArithmetic error

Fixes

source3/winbindd/winbindd_cache.c:4386: error: nullPointerArithmetic: Pointer addition with NULL pointer. <--[cppcheck]
source3/winbindd/winbindd_cache.c:4400: error: nullPointerArithmetic: Pointer addition with NULL pointer. <--[cppcheck]
source3/winbindd/winbindd_cache.c:1569:24: warning: Dereference of null pointer <--[clang]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3/modules: cppcheck: Fix ctunullpointer error
Noel Power [Wed, 22 May 2019 14:07:44 +0000 (14:07 +0000)]
s3/modules: cppcheck: Fix ctunullpointer error

Fixes

source3/modules/vfs_syncops.c:117: error: ctunullpointer: Null pointer dereference: smb_fname <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agolib/pthreadpool: cppcheck: Fix Memory leak
Noel Power [Wed, 22 May 2019 13:16:19 +0000 (13:16 +0000)]
lib/pthreadpool: cppcheck: Fix Memory leak

Fixes

lib/pthreadpool/tests.c:63: error: memleak: Memory leak: finished <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3/rpcclient: cppcheck: Fix shiftTooManyBitsSigned error
Noel Power [Wed, 22 May 2019 13:15:19 +0000 (13:15 +0000)]
s3/rpcclient: cppcheck: Fix shiftTooManyBitsSigned error

Fixes

source3/rpcclient/cmd_srvsvc.c:44: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4/torture/unix: cppcheck: Fix shiftTooManyBitsSigned error
Noel Power [Wed, 22 May 2019 13:10:47 +0000 (13:10 +0000)]
s4/torture/unix: cppcheck: Fix shiftTooManyBitsSigned error

Fixes

source4/torture/unix/unix_info2.c:300: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4/torture/smb2: cppcheck: Fix shiftTooManyBitsSigned error
Noel Power [Wed, 22 May 2019 13:07:28 +0000 (13:07 +0000)]
s4/torture/smb2: cppcheck: Fix shiftTooManyBitsSigned error

Fixes

source4/torture/smb2/notify.c:974: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:994: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1002: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1011: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1025: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1040: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1048: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1062: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1081: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1096: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1112: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/notify.c:1125: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4/torture/smb2: cppcheck: Fix shiftTooManyBitsSigned error
Noel Power [Wed, 22 May 2019 12:03:36 +0000 (12:03 +0000)]
s4/torture/smb2: cppcheck: Fix shiftTooManyBitsSigned error

Fixes

source4/torture/smb2/create.c:197: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/create.c:234: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/create.c:265: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4/torture/raw: cppcheck: Fix shiftTooManyBitsSigned error
Noel Power [Wed, 22 May 2019 11:29:33 +0000 (11:29 +0000)]
s4/torture/raw: cppcheck: Fix shiftTooManyBitsSigned error

Fix

source4/torture/raw/open.c:1009: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/open.c:1048: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4/torture/raw: cppcheck: Fix shiftTooManyBitsSigned error
Noel Power [Wed, 22 May 2019 11:24:43 +0000 (11:24 +0000)]
s4/torture/raw: cppcheck: Fix shiftTooManyBitsSigned error

Fix

source4/torture/raw/notify.c:831: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:838: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:849: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:861: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:869: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:882: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:892: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:903: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:914: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:929: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:941: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:951: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:961: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:972: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:982: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agonsswitch: cppcheck: Fix memleakOnRealloc errors
Noel Power [Wed, 22 May 2019 11:09:41 +0000 (11:09 +0000)]
nsswitch: cppcheck: Fix memleakOnRealloc errors

Fixes the following errors

nsswitch/nsstest.c:192: error: memleakOnRealloc: Common realloc mistake: 'buf' nulled but not freed upon failure <--[cppcheck]
nsswitch/nsstest.c:230: error: memleakOnRealloc: Common realloc mistake: 'buf' nulled but not freed upon failure <--[cppcheck]
nsswitch/nsstest.c:269: error: memleakOnRealloc: Common realloc mistake: 'buf' nulled but not freed upon failure <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4/smdb: cppcheck: fix nullPointer: Possible null pointer dereference warning.
Noel Power [Wed, 22 May 2019 10:57:53 +0000 (10:57 +0000)]
s4/smdb: cppcheck: fix nullPointer: Possible null pointer dereference warning.

Insert unreachable return to satisfy the following warnings

source4/smbd/server.c:692: warning: nullPointer: Possible null pointer dereference: state <--[cppcheck]
source4/smbd/server.c:694: warning: nullPointer: Possible null pointer dereference: state <--[cppcheck]
source4/smbd/server.c:699: warning: nullPointer: Possible null pointer dereference: state <--[cppcheck]
source4/smbd/server.c:758: warning: nullPointer: Possible null pointer dereference: state <--[cppcheck]
source4/smbd/server.c:789: warning: nullPointer: Possible null pointer dereference: state <--[cppcheck]
source4/smbd/server.c:849: warning: nullPointer: Possible null pointer dereference: state <--[cppcheck]
source4/smbd/server.c:866: warning: nullPointer: Possible null pointer dereference: state <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4/smb_server/smb: cppcheck: Fix uninitvar & uninitStructMember errors
Noel Power [Wed, 22 May 2019 10:32:15 +0000 (10:32 +0000)]
s4/smb_server/smb: cppcheck: Fix uninitvar & uninitStructMember errors

Fixes the following errors (note: existing code is safe the way it is
currently all accesses to the structure are 'after' it is assigned)

source4/smb_server/smb/negprot.c:447: error: uninitvar: Uninitialized variable: blob <--[cppcheck]
source4/smb_server/smb/negprot.c:453: error: uninitStructMember: Uninitialized struct member: blob.data <--[cppcheck]
source4/smb_server/smb/negprot.c:447: error: uninitStructMember: Uninitialized struct member: blob.length <--[cppcheck]
source4/smb_server/smb/negprot.c:453: error: uninitStructMember: Uninitialized struct member: blob.length <--[cppcheck]
source4/smb_server/smb/negprot.c:454: error: uninitStructMember: Uninitialized struct member: blob.length <--[cppcheck]
source4/smb_server/smb/negprot.c:455: error: uninitStructMember: Uninitialized struct member: blob.length <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4/rpc_server/dnsserver: clang: fix Value stored to 'status' is never read
Noel Power [Wed, 22 May 2019 09:47:27 +0000 (09:47 +0000)]
s4/rpc_server/dnsserver: clang: fix Value stored to 'status' is never read

Fix the following warnings

source4/rpc_server/dnsserver/dcerpc_dnsserver.c:1021: error: uninitvar: Uninitialized variable: answer_integer <--[cppcheck]
source4/rpc_server/dnsserver/dcerpc_dnsserver.c:1723:4: warning: Value stored to 'status' is never read <--[clang]
                        status = dns_fill_records_array(tmp_ctx, NULL, DNS_TYPE_A,
                        ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
source4/rpc_server/dnsserver/dcerpc_dnsserver.c:1881:4: warning: Value stored to 'status' is never read <--[clang]
                        status = dns_fill_records_array(tmp_ctx, NULL, DNS_TYPE_A,

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4/rpc_server/dnsserver: cppcheck: Fix Uninitialized variable error.
Noel Power [Wed, 22 May 2019 09:37:40 +0000 (09:37 +0000)]
s4/rpc_server/dnsserver: cppcheck: Fix Uninitialized variable error.

source4/rpc_server/dnsserver/dcerpc_dnsserver.c:715: error: uninitvar: Uninitialized variable: answer_integer <--[cppcheck]

This error is benign and somewhat false because the code pointed to does
not run (due to a different check) if answer_integer is not actually
initialsed. It is easy to squash it though by just initialising the var.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4/ntvfs/cifs: cppcheck: squash nullPointer: Possible null pointer dereference
Noel Power [Wed, 22 May 2019 09:29:18 +0000 (09:29 +0000)]
s4/ntvfs/cifs: cppcheck: squash nullPointer: Possible null pointer dereference

Fix the following cppcheck warnings

/home/samba/samba-pidl/source4/ntvfs/cifs/vfs_cifs.c:604: warning: nullPointer: Possible null pointer dereference: file <--[cppcheck]
/home/samba/samba-pidl/source4/ntvfs/cifs/vfs_cifs.c:605: warning: nullPointer: Possible null pointer dereference: file <--[cppcheck]
/home/samba/samba-pidl/source4/ntvfs/cifs/vfs_cifs.c:648: warning: nullPointer: Possible null pointer dereference: file <--[cppcheck]
/home/samba/samba-pidl/source4/ntvfs/cifs/vfs_cifs.c:649: warning: nullPointer: Possible null pointer dereference: file <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3:rpc_server:netlogon: simplify AUTH_TYPE_SCHANNEL check in netr_creds_server_step_c...
Stefan Metzmacher [Mon, 27 May 2019 11:12:14 +0000 (13:12 +0200)]
s3:rpc_server:netlogon: simplify AUTH_TYPE_SCHANNEL check in netr_creds_server_step_check()

The gensec schannel module already asserts that at least
AUTH_LEVEL_INTEGRITY is used.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3:rpc_server:netlogon: don't require NEG_AUTHENTICATED_RPC in netr_ServerAuthenticate*()
Stefan Metzmacher [Mon, 27 May 2019 10:38:43 +0000 (12:38 +0200)]
s3:rpc_server:netlogon: don't require NEG_AUTHENTICATED_RPC in netr_ServerAuthenticate*()

The domain join with VMWare Horizon Quickprep seems to use
netr_ServerAuthenticate3() with just the NEG_STRONG_KEYS
(and in addition the NEG_SUPPORTS_AES) just to verify a password.

Note: NETLOGON_NEG_SCHANNEL is an alias to NEG_AUTHENTICATED_RPC.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13464 (maybe)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13949

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos4:rpc_server:netlogon: don't require NEG_AUTHENTICATED_RPC in netr_ServerAuthenticate*()
Stefan Metzmacher [Mon, 27 May 2019 10:38:43 +0000 (12:38 +0200)]
s4:rpc_server:netlogon: don't require NEG_AUTHENTICATED_RPC in netr_ServerAuthenticate*()

The domain join with VMWare Horizon Quickprep seems to use
netr_ServerAuthenticate3() with just the NEG_STRONG_KEYS
(and in addition the NEG_SUPPORTS_AES) just to verify a password.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13464 (maybe)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13949

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agos3-smbcontrol: Replace && with || to declare variables in do_sleep()
Anoop C S [Wed, 29 May 2019 06:10:55 +0000 (11:40 +0530)]
s3-smbcontrol: Replace && with || to declare variables in do_sleep()

--enable-developer internally use --enable-selftest alongside. But when
configured only with --enable-selftest the following code block becomes
invalid:

 #if defined(DEVELOPER) && defined(ENABLE_SELFTEST)
        unsigned int seconds;
        long input;
        const long MAX_SLEEP = 60 * 60; /* One hour maximum sleep */
 #endif

making those variables undeclared for further use. Therefore replace &&
with || to have those variables declared with --enable-selftest
configure option.

Signed-off-by: Anoop C S <anoopcs@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 May 31 20:38:09 UTC 2019 on sn-devel-184

4 years ago.gitlab-ci.yml: avoid using != to compare variables to support old versions
Joe Guo [Wed, 29 May 2019 03:35:08 +0000 (15:35 +1200)]
.gitlab-ci.yml: avoid using != to compare variables to support old versions

`!=` was only introduced after 11.11, according to doc at:

https://docs.gitlab.com/ee/ci/variables/README.html#environment-variables-expressions

For private gitlab instance, the version may not be new enough.
Use `==` to make it backward compatible.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri May 31 09:48:37 UTC 2019 on sn-devel-184

4 years agoselftest: Don't use global dirs when parsing customdc realm
Tim Beale [Thu, 30 May 2019 02:55:52 +0000 (14:55 +1200)]
selftest: Don't use global dirs when parsing customdc realm

When creating the customdc, testparm would default to using
/usr/local/samba sub-directories for creating sockets and lock files.
Instead, pass in the tmpdir we just created as an option to the command.

Normally this didn't cause a noticeable problem, however, if we run the
command with UID-wrapper but without socket-wrapper (i.e.
USE_NAMESPACES=1), then it fails completely.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri May 31 06:34:36 UTC 2019 on sn-devel-184