samba.git
18 months agopython selftest: enable samba.tests.s3param to run with python3
Noel Power [Thu, 22 Mar 2018 12:21:12 +0000 (12:21 +0000)]
python selftest: enable samba.tests.s3param to run with python3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
18 months agopython3 port for passdb module
Noel Power [Mon, 5 Feb 2018 12:50:48 +0000 (12:50 +0000)]
python3 port for passdb module

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
18 months agopython3 port for param module
Noel Power [Mon, 5 Feb 2018 11:39:58 +0000 (11:39 +0000)]
python3 port for param module

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
18 months agopython selftest: split samba3 test into separate tests
Noel Power [Wed, 21 Mar 2018 18:24:18 +0000 (18:24 +0000)]
python selftest: split samba3 test into separate tests

This patch splits the tests contained in samba3.py into separate
tests s3idmapdb.py, s3param.py, s3passdb.py, s3registry.py, s3windb.py
This allows test of associated python c-modules to be done independently.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
18 months agosamba test python: enable samba.tests.policy for py3
Noel Power [Thu, 8 Mar 2018 11:28:16 +0000 (11:28 +0000)]
samba test python: enable samba.tests.policy for py3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
18 months agopython3 port for policy module
Noel Power [Mon, 5 Feb 2018 11:04:53 +0000 (11:04 +0000)]
python3 port for policy module

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
18 months agopython: Write py3 bin to correct args location
David Mulder [Tue, 13 Feb 2018 15:35:12 +0000 (08:35 -0700)]
python: Write py3 bin to correct args location

Comands written like this were working:
python /home/dmulder/code/samba/source4/scripting/bin/subunitrun
Changed to:
/usr/bin/python3 /home/dmulder/code/samba/source4/scripting/bin/subunitrun

But commands with env args overwrite the wrong arg:
CLIENT_IP=127.0.0.11 SOCKET_WRAPPER_DEFAULT_IFACE=11 python /home/dmulder/code/samba/source4/scripting/bin/subunitrun
Changed to:
/usr/bin/python3 SOCKET_WRAPPER_DEFAULT_IFACE=11 python /home/dmulder/code/samba/source4/scripting/bin/subunitrun
And were further mangled in plantestsuite_loadlist() to:
/usr/bin/python3 /home/dmulder/code/samba/source4/scripting/bin/subunitrun SOCKET_WRAPPER_DEFAULT_IFACE=11 python /home/dmulder/code/samba/source4/scripting/bin/subunitrun

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
18 months agoldb: Add test to show a reindex failure must not leave the DB corrupt
Andrew Bartlett [Mon, 26 Mar 2018 03:07:45 +0000 (16:07 +1300)]
ldb: Add test to show a reindex failure must not leave the DB corrupt

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Apr  5 07:53:10 CEST 2018 on sn-devel-144

18 months agolib ldb tests: Prepare to run api and index test on tdb and lmdb
Gary Lockyer [Mon, 5 Mar 2018 20:13:31 +0000 (09:13 +1300)]
lib ldb tests: Prepare to run api and index test on tdb and lmdb

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
18 months agoldb_tdb: Ensure we can not commit an index that is corrupt due to partial re-index
Andrew Bartlett [Mon, 26 Mar 2018 03:01:13 +0000 (16:01 +1300)]
ldb_tdb: Ensure we can not commit an index that is corrupt due to partial re-index

The re-index traverse can abort part-way though and we need to ensure
that the transaction is never committed as that will leave an un-useable db.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
18 months agosmbclient: Handle ENUM_DIR in "notify" command
Volker Lendecke [Mon, 30 Oct 2017 15:15:03 +0000 (16:15 +0100)]
smbclient: Handle ENUM_DIR in "notify" command

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): Thu Apr  5 04:05:52 CEST 2018 on sn-devel-144

18 months agolibsmb: Handle IO_TIMEOUT in cli_smb2_notify properly
Volker Lendecke [Mon, 30 Oct 2017 13:36:46 +0000 (14:36 +0100)]
libsmb: Handle IO_TIMEOUT in cli_smb2_notify properly

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agolibsmb: Handle long-running smb2cli_notify
Volker Lendecke [Mon, 30 Oct 2017 13:34:12 +0000 (14:34 +0100)]
libsmb: Handle long-running smb2cli_notify

This likely runs into a timeout. Properly cancel the smb2 request,
allowing the higher-level caller to re-issue this request on an existing
handle.

I did not see a proper way to achieve this with tevent_req_set_endtime or
something like that.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agocredentials: Fix a typo
Volker Lendecke [Wed, 4 Apr 2018 08:27:21 +0000 (10:27 +0200)]
credentials: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agocredentials: Fix CID 1414796 Explicit null dereferenced
Volker Lendecke [Wed, 4 Apr 2018 08:26:14 +0000 (10:26 +0200)]
credentials: Fix CID 1414796 Explicit null dereferenced

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agos3: lib: messages: Don't use the result of sec_init() before calling sec_init().
Lutz Justen [Wed, 4 Apr 2018 16:50:12 +0000 (09:50 -0700)]
s3: lib: messages: Don't use the result of sec_init() before calling sec_init().

Commit ad8c7171ba86e8a47d78b0c7329bb814e5a8871e accidently
moved sec_init() to the point after sec_initial_uid() is
called in the call to directory_create_or_exist_strict().
I missed this in the review (sorry). This works as root
as initial_uid/initial_gid are static (and so initialized
as zero) but doesn't work on ChromeOS as this code isn't
running as root.

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

Signed-off-by: Lutz Justen <ljusten@google.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr  4 23:52:02 CEST 2018 on sn-devel-144

18 months agoctdb: Remove double sanity checks from ctdb_tcp_read_cb
Swen Schillig [Tue, 13 Mar 2018 08:22:45 +0000 (09:22 +0100)]
ctdb: Remove double sanity checks from ctdb_tcp_read_cb

Within ctdb_tcp_read_cb the provided data is checked for sanity,
e.g. correct size and content. This is not required because it was
done already by the caller(queue_process).

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Apr  4 09:31:04 CEST 2018 on sn-devel-144

18 months agoctdb: Remove double sanity checks from ctdb_daemon_read_cb
Swen Schillig [Tue, 13 Mar 2018 07:57:40 +0000 (08:57 +0100)]
ctdb: Remove double sanity checks from ctdb_daemon_read_cb

Within ctdb_daemon_read_cb the provided data is checked for sanity,
e.g. correct size and content. This is not required because it was
done already by the caller (queue_process).

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agokrb5_wrap: Fix CID 1414755 Resource leak
Volker Lendecke [Fri, 30 Mar 2018 16:08:05 +0000 (11:08 -0500)]
krb5_wrap: Fix CID 1414755 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr  4 03:51:00 CEST 2018 on sn-devel-144

18 months agokrb5_wrap: Fix CID 1034833 Resource leak
Volker Lendecke [Fri, 30 Mar 2018 14:23:07 +0000 (09:23 -0500)]
krb5_wrap: Fix CID 1034833 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agonet: Avoid tallocs
Volker Lendecke [Fri, 30 Mar 2018 14:16:47 +0000 (09:16 -0500)]
net: Avoid tallocs

Not really performance critical, but I think it's worth establishing sample
code to use more stack variables than going out to talloc.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agonet: Fix CID 1414752 Resource leak
Volker Lendecke [Fri, 30 Mar 2018 14:15:30 +0000 (09:15 -0500)]
net: Fix CID 1414752 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agopdb_ldap: Fix CID 1363266 Resource leak
Volker Lendecke [Fri, 30 Mar 2018 13:27:33 +0000 (08:27 -0500)]
pdb_ldap: Fix CID 1363266 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agopygpo: Fix CID 1422263 Resource leak
Volker Lendecke [Wed, 28 Mar 2018 20:49:30 +0000 (15:49 -0500)]
pygpo: Fix CID 1422263 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agoutils: Fix CID 1035541 Uninitialized scalar variable
Volker Lendecke [Wed, 28 Mar 2018 20:46:34 +0000 (15:46 -0500)]
utils: Fix CID 1035541 Uninitialized scalar variable

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agodsdb: Fix CID 1034966 Uninitialized scalar variable
Volker Lendecke [Wed, 28 Mar 2018 20:43:53 +0000 (15:43 -0500)]
dsdb: Fix CID 1034966 Uninitialized scalar variable

"continue" in a do-while loop jumps to the "while"-check, so "id_exists" needs
to be initialized by that point.

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agolibads: Fix CID 1272809 Free of address-of expression
Volker Lendecke [Wed, 28 Mar 2018 20:23:16 +0000 (15:23 -0500)]
libads: Fix CID 1272809 Free of address-of expression

Look at the other SAFE_FREE's in this function...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agogroupdb: Fix CID 1167984 Ignoring number of bytes read
Volker Lendecke [Fri, 30 Mar 2018 17:19:24 +0000 (12:19 -0500)]
groupdb: Fix CID 1167984 Ignoring number of bytes read

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agodsdb: Fix CID 1034744 Dereference after null check
Volker Lendecke [Fri, 30 Mar 2018 17:13:03 +0000 (12:13 -0500)]
dsdb: Fix CID 1034744 Dereference after null check

This HIGHLY looks like a cut&paste error...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agocldap: Avoid a ZERO_STRUCTP
Volker Lendecke [Fri, 30 Mar 2018 17:08:42 +0000 (12:08 -0500)]
cldap: Avoid a ZERO_STRUCTP

This is done implicitly by tevent_req_create

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agosmbd: Fix CID 240676 Dereference after null check
Volker Lendecke [Fri, 30 Mar 2018 16:37:49 +0000 (11:37 -0500)]
smbd: Fix CID 240676 Dereference after null check

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agolsasrv: Fix CID 241332 Self assignment
Volker Lendecke [Fri, 30 Mar 2018 18:23:43 +0000 (13:23 -0500)]
lsasrv: Fix CID 241332 Self assignment

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agolsasrv: Fix CID 241331 Self assignment
Volker Lendecke [Fri, 30 Mar 2018 18:23:01 +0000 (13:23 -0500)]
lsasrv: Fix CID 241331 Self assignment

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agolibcli: Fix CID 710748 Resource leak
Volker Lendecke [Fri, 30 Mar 2018 18:10:14 +0000 (13:10 -0500)]
libcli: Fix CID 710748 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agolibhttp: Fix CID 1273001 Dereference after null check
Volker Lendecke [Fri, 30 Mar 2018 17:32:26 +0000 (12:32 -0500)]
libhttp: Fix CID 1273001 Dereference after null check

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
18 months agowafsamba: Add missing cflags_end argument to SAMBA_BINARY
Andreas Schneider [Fri, 23 Mar 2018 09:52:54 +0000 (10:52 +0100)]
wafsamba: Add missing cflags_end argument to SAMBA_BINARY

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): Tue Apr  3 23:08:33 CEST 2018 on sn-devel-144

18 months agos3:modules: Set -Wno-strict-overflow for getdate if supported
Andreas Schneider [Fri, 23 Mar 2018 09:18:17 +0000 (10:18 +0100)]
s3:modules: Set -Wno-strict-overflow for getdate if supported

bison generates an C89 files which does some weired things.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agoreplace: Check for -Wno-strict-overflow
Andreas Schneider [Fri, 23 Mar 2018 15:27:00 +0000 (16:27 +0100)]
replace: Check for -Wno-strict-overflow

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agowafsamba: Add missing cflags_end argument to SAMBA_MODULE
Andreas Schneider [Fri, 23 Mar 2018 09:14:50 +0000 (10:14 +0100)]
wafsamba: Add missing cflags_end argument to SAMBA_MODULE

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agos3:modules: Generate new getdate.c with bison
Andreas Schneider [Fri, 23 Mar 2018 08:30:27 +0000 (09:30 +0100)]
s3:modules: Generate new getdate.c with bison

bison -o source3/modules/getdate.c source3/modules/getdate.y<Paste>

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agos3:modules: Update getdate.y to work with newer bison versions
Andreas Schneider [Fri, 23 Mar 2018 08:29:55 +0000 (09:29 +0100)]
s3:modules: Update getdate.y to work with newer bison versions

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agos3:torture: Fix size types in make_nonstd_fd()
Andreas Schneider [Thu, 22 Mar 2018 17:36:13 +0000 (18:36 +0100)]
s3:torture: Fix size types in make_nonstd_fd()

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agos3:client: Fix size types
Andreas Schneider [Thu, 22 Mar 2018 13:51:28 +0000 (14:51 +0100)]
s3:client: Fix size types

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agos3:spoolss: Fix size types
Andreas Schneider [Thu, 22 Mar 2018 13:06:34 +0000 (14:06 +0100)]
s3:spoolss: Fix size types

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agos3:printing: Fix size types
Andreas Schneider [Thu, 22 Mar 2018 12:41:39 +0000 (13:41 +0100)]
s3:printing: Fix size types

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agos3:smbd: Fix size types in reply_negprot()
Andreas Schneider [Thu, 22 Mar 2018 10:49:18 +0000 (11:49 +0100)]
s3:smbd: Fix size types in reply_negprot()

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agos4:torture: Fix size types in torture_create_procs()
Andreas Schneider [Wed, 21 Mar 2018 16:46:30 +0000 (17:46 +0100)]
s4:torture: Fix size types in torture_create_procs()

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agoheimdal: Fix size types and array access
Andreas Schneider [Wed, 21 Mar 2018 12:02:26 +0000 (13:02 +0100)]
heimdal: Fix size types and array access

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agos4:client: Fix size types and loop
Andreas Schneider [Thu, 22 Mar 2018 09:28:02 +0000 (10:28 +0100)]
s4:client: Fix size types and loop

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agos4:registry: Fix size type and loop
Andreas Schneider [Wed, 21 Mar 2018 15:46:49 +0000 (16:46 +0100)]
s4:registry: Fix size type and loop

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agolib:util: Fix size types in fgets_slash()
Andreas Schneider [Wed, 21 Mar 2018 11:49:38 +0000 (12:49 +0100)]
lib:util: Fix size types in fgets_slash()

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agothird_party: Fix size type in cmocka
Andreas Schneider [Wed, 21 Mar 2018 13:32:49 +0000 (14:32 +0100)]
third_party: Fix size type in cmocka

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agoldb: Fix overflow checks
Andreas Schneider [Wed, 21 Mar 2018 15:25:30 +0000 (16:25 +0100)]
ldb: Fix overflow checks

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agoldb: Add test for ldb_qsort()
Andreas Schneider [Thu, 22 Mar 2018 08:53:03 +0000 (09:53 +0100)]
ldb: Add test for ldb_qsort()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agothird_party: Update pam_wrapper to version 1.0.6
Andreas Schneider [Wed, 21 Mar 2018 16:19:39 +0000 (17:19 +0100)]
third_party: Update pam_wrapper to version 1.0.6

This fixes compilation with -Wstrict-overflow=2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agos3:modules: fix the build of vfs_aixacl2.c
Stefan Metzmacher [Wed, 21 Mar 2018 06:48:16 +0000 (07:48 +0100)]
s3:modules: fix the build of vfs_aixacl2.c

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Apr  3 20:18:58 CEST 2018 on sn-devel-144

18 months agoldb/tests: avoid 'return void_function();' which isn't portable
Stefan Metzmacher [Wed, 21 Mar 2018 06:33:16 +0000 (07:33 +0100)]
ldb/tests: avoid 'return void_function();' which isn't portable

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
18 months agolib/crypto: avoid 'return void_function();' which isn't portable
Stefan Metzmacher [Wed, 21 Mar 2018 06:33:16 +0000 (07:33 +0100)]
lib/crypto: avoid 'return void_function();' which isn't portable

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
18 months agos3:modules: make virusfilter_io_connect_path() more portable
Stefan Metzmacher [Wed, 21 Mar 2018 06:25:11 +0000 (07:25 +0100)]
s3:modules: make virusfilter_io_connect_path() more portable

We have existing utility functions to prepare a socket.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
18 months agos3:modules: fix the picky-developer build of vfs_virusfilter.c on FreeBSD 11
Stefan Metzmacher [Tue, 20 Mar 2018 11:10:01 +0000 (12:10 +0100)]
s3:modules: fix the picky-developer build of vfs_virusfilter.c on FreeBSD 11

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
18 months agonsswitch: fix the developer build of nsswitch/wins.c on freebsd 11
Stefan Metzmacher [Sat, 21 Oct 2017 12:15:12 +0000 (14:15 +0200)]
nsswitch: fix the developer build of nsswitch/wins.c on freebsd 11

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
18 months agonsswitch: add some const to _nss_winbind_initgroups_dyn() prototype
Stefan Metzmacher [Sat, 21 Oct 2017 12:14:34 +0000 (14:14 +0200)]
nsswitch: add some const to _nss_winbind_initgroups_dyn() prototype

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
18 months agonsswitch: maintain prototypes for the linux based functions only once
Stefan Metzmacher [Sat, 21 Oct 2017 12:08:15 +0000 (14:08 +0200)]
nsswitch: maintain prototypes for the linux based functions only once

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
18 months agolib/replace: define __[u]intptr_t_defined if we prove an replacement
Stefan Metzmacher [Tue, 20 Mar 2018 20:46:12 +0000 (21:46 +0100)]
lib/replace: define __[u]intptr_t_defined if we prove an replacement

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
18 months agolib/util: remove unused '#include <sys/syscall.h>' from tests/tfork.c
Stefan Metzmacher [Tue, 20 Mar 2018 15:49:30 +0000 (16:49 +0100)]
lib/util: remove unused '#include <sys/syscall.h>' from tests/tfork.c

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
18 months agoctdb-scripts: Drop "net serverid wipe" from 50.samba event script
Amitay Isaacs [Wed, 28 Mar 2018 23:45:19 +0000 (10:45 +1100)]
ctdb-scripts: Drop "net serverid wipe" from 50.samba event script

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

There is no serverid database anymore.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Sat Mar 31 08:34:00 CEST 2018 on sn-devel-144

18 months agoctdb-server: Only set destructor if required
Swen Schillig [Thu, 8 Feb 2018 11:19:09 +0000 (12:19 +0100)]
ctdb-server: Only set destructor if required

Set the detructor in ctdb_start_revoke_ro_record after the revokechild_handle
was added to the list.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Mar 31 03:45:51 CEST 2018 on sn-devel-144

18 months agoctdb-server: Add goto tag avoiding code duplication
Swen Schillig [Thu, 8 Feb 2018 11:08:45 +0000 (12:08 +0100)]
ctdb-server: Add goto tag avoiding code duplication

Introduced err_out goto tag to prevent code duplication.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agoctdb-server: Minor code cleanup
Swen Schillig [Thu, 8 Feb 2018 10:57:23 +0000 (11:57 +0100)]
ctdb-server: Minor code cleanup

Cleanup ctdb_start_revoke_ro_record to improve readability.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agoctdb-server: Replace the variable rc by something meaningful
Swen Schillig [Wed, 31 Jan 2018 12:06:30 +0000 (13:06 +0100)]
ctdb-server: Replace the variable rc by something meaningful

Replace the varibale name "rc" in ctdb_start_revoke_ro_record
to prevent a mix-up with the common meaning of rc (return code).

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agoctdb-server: Only talloc_set_destructor when required
Swen Schillig [Tue, 20 Feb 2018 16:08:59 +0000 (17:08 +0100)]
ctdb-server: Only talloc_set_destructor when required

The destructor is only needed once the state got added to the DLIST.
Therefore, move the setting of the destructor to after the addition
of state to the DLIST.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agoctdb-server: Cleanup ctdb_daemon_call_send_remote
Swen Schillig [Thu, 8 Feb 2018 10:33:08 +0000 (11:33 +0100)]
ctdb-server: Cleanup ctdb_daemon_call_send_remote

Minor code cleanup and adding a temporary variable to improve readabilty.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agoctdb: Use talloc_zero instead of zeroing attributes
Swen Schillig [Wed, 21 Feb 2018 12:52:11 +0000 (13:52 +0100)]
ctdb: Use talloc_zero instead of zeroing attributes

Zero entire structure with talloc_zero on memory allocation instead of
setting each attribute individually.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agoctdb: Use provided mem_ctx for newly allocated memory
Swen Schillig [Wed, 21 Feb 2018 12:34:28 +0000 (13:34 +0100)]
ctdb: Use provided mem_ctx for newly allocated memory

ctdb_call_local is called with a mem_ctx parameter which should be used
for newly allocated memory.

This is safe because all allocations of this context are freed before
this function returns.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agoctdb: Fixing possible memory leak in ctdb_tcp_read_cb
Swen Schillig [Tue, 13 Mar 2018 08:34:52 +0000 (09:34 +0100)]
ctdb: Fixing possible memory leak in ctdb_tcp_read_cb

In case of an error condition the further processing of the data is cancelled
and the callback returns. In such a scenario the data has to be free'd.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agoctdb: Fixing memory leak in ctdb_tcp_tnode_cb
Swen Schillig [Tue, 13 Mar 2018 08:42:24 +0000 (09:42 +0100)]
ctdb: Fixing memory leak in ctdb_tcp_tnode_cb

It is expected by the caller(queue_process) that the callback is
free'ing the memory referenced by the data pointer.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agoctdb: Fixing possible memory leak in ctdb_daemon_read_cb
Swen Schillig [Tue, 13 Mar 2018 08:06:45 +0000 (09:06 +0100)]
ctdb: Fixing possible memory leak in ctdb_daemon_read_cb

In case of an error condition the further processing of the data is cancelled
and the callback returns. In such a scenario the data has to be free'd.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agos4:torture: kernel oplocks. Fix assertion warning
Jones Syue [Fri, 30 Mar 2018 00:31:06 +0000 (08:31 +0800)]
s4:torture: kernel oplocks. Fix assertion warning

Simply boolean 'ret' instead of 'ret = true'.

Signed-off-by: Jones Syue <jonessyue@qnap.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Mar 30 18:39:19 CEST 2018 on sn-devel-144

18 months agos3:smbd: don't use the directory cache for SMB2/3
Ralph Boehme [Thu, 29 Mar 2018 18:06:47 +0000 (20:06 +0200)]
s3:smbd: don't use the directory cache for SMB2/3

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Mar 30 03:51:48 CEST 2018 on sn-devel-144

18 months agos4: torture: Test all combinations of directory open with existing directory to ensur...
Jeremy Allison [Wed, 28 Mar 2018 20:19:12 +0000 (13:19 -0700)]
s4: torture: Test all combinations of directory open with existing directory to ensure behavior is the same.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar 29 23:13:42 CEST 2018 on sn-devel-144

18 months agos4: torture: Test all combinations of directory create to ensure behavior is the...
Jeremy Allison [Wed, 28 Mar 2018 20:17:14 +0000 (13:17 -0700)]
s4: torture: Test all combinations of directory create to ensure behavior is the same.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
18 months agos4: torture: Test all combinations of file open with existing file to ensure behavior...
Jeremy Allison [Wed, 28 Mar 2018 18:44:40 +0000 (11:44 -0700)]
s4: torture: Test all combinations of file open with existing file to ensure behavior is the same.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
18 months agos4: torture: Test all combinations of file create to ensure behavior is the same.
Jeremy Allison [Wed, 28 Mar 2018 18:00:59 +0000 (11:00 -0700)]
s4: torture: Test all combinations of file create to ensure behavior is the same.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
18 months agos4: torture: Ensure a failed file create doesn't create the file.
Jeremy Allison [Wed, 28 Mar 2018 17:54:30 +0000 (10:54 -0700)]
s4: torture: Ensure a failed file create doesn't create the file.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
18 months agos3: smbd: Files or directories can't be opened DELETE_ON_CLOSE without delete access.
Jeremy Allison [Wed, 28 Mar 2018 19:42:20 +0000 (12:42 -0700)]
s3: smbd: Files or directories can't be opened DELETE_ON_CLOSE without delete access.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
18 months agolibads: Fix CID 1349423 Resource leak
Volker Lendecke [Wed, 28 Mar 2018 12:27:08 +0000 (07:27 -0500)]
libads: Fix CID 1349423 Resource leak

get_sorted_dc_list should already take care, but this way it's safer

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): Thu Mar 29 03:45:00 CEST 2018 on sn-devel-144

18 months agonet: Fix CID 1128559 Dereference null return value
Volker Lendecke [Wed, 28 Mar 2018 12:24:01 +0000 (07:24 -0500)]
net: Fix CID 1128559 Dereference null return value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agosmbstatus: Fix CID 1128560 Dereference null return value
Volker Lendecke [Wed, 28 Mar 2018 12:22:02 +0000 (07:22 -0500)]
smbstatus: Fix CID 1128560 Dereference null return value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agovfs_fruit: Fix CID 1433613 Operands don't affect result
Volker Lendecke [Wed, 28 Mar 2018 12:17:59 +0000 (07:17 -0500)]
vfs_fruit: Fix CID 1433613 Operands don't affect result

Two changes: First, we can't check multiplication overflow after the
operation. This has to be done before with a division. Second, there
is no OFF_T_MAX, and both operands are size_t, so check for
SIZE_MAX. The result is assigned to off_t, but I'm not sure where the
automatic coercion from size_t to off_t would happen.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agodsdb: Fix CID 1433614 Dereference after null check
Volker Lendecke [Wed, 28 Mar 2018 12:10:59 +0000 (07:10 -0500)]
dsdb: Fix CID 1433614 Dereference after null check

This whole routine assumes module!=NULL, both in the successful as
well as in error cases. So checking for module!=NULL is confusing both
the reader as well as Coverity.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agolibads: Fix 1433611 Resource leak
Volker Lendecke [Wed, 28 Mar 2018 12:00:34 +0000 (07:00 -0500)]
libads: Fix 1433611 Resource leak

Not really a memleak due to the passed-in talloc ctx, but this way it's cleaner

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agolsa_server: Fix CID 1433608 Dereference after null check
Volker Lendecke [Tue, 27 Mar 2018 22:03:15 +0000 (17:03 -0500)]
lsa_server: Fix CID 1433608 Dereference after null check

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agolibads: Fix CID 1433606 Dereference before null check
Volker Lendecke [Tue, 27 Mar 2018 22:00:46 +0000 (17:00 -0500)]
libads: Fix CID 1433606 Dereference before null check

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 months agondr_string: Do overflow checks in ndr_push/pull_charset
Volker Lendecke [Mon, 26 Mar 2018 10:02:01 +0000 (12:02 +0200)]
ndr_string: Do overflow checks in ndr_push/pull_charset

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Mar 28 16:08:16 CEST 2018 on sn-devel-144

18 months agondr_string: Fix a signed/unsigned glitch
Volker Lendecke [Mon, 26 Mar 2018 10:00:40 +0000 (12:00 +0200)]
ndr_string: Fix a signed/unsigned glitch

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
18 months agoctdb-tests: Delete unused fake /etc/sysconfig/ctdb file
Martin Schwenke [Tue, 20 Mar 2018 09:20:55 +0000 (20:20 +1100)]
ctdb-tests: Delete unused fake /etc/sysconfig/ctdb file

The only remaining item is a setting of CTDB_DEBUGLEVEL, which is not
required.

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 Mar 28 07:27:58 CEST 2018 on sn-devel-144

18 months agoctdb-scripts: Tunables are now loaded from ctdb.tunables
Martin Schwenke [Tue, 20 Feb 2018 07:22:33 +0000 (18:22 +1100)]
ctdb-scripts: Tunables are now loaded from ctdb.tunables

Using CTDB_SET_TunableVariables in the main configuration file is no
longer supported.

The only subtlety is an unexpected order change in one of the unit
test results.  This is because the old implementation implicitly
sorted the tunable variables via the set command.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
18 months agoctdb-tests: Rename setup_config() to setup_tunable_config()
Martin Schwenke [Thu, 22 Mar 2018 03:39:45 +0000 (14:39 +1100)]
ctdb-tests: Rename setup_config() to setup_tunable_config()

Drop the "CTDB_SET_" prefix from variable names and add it back for
now.  When there is a better way of setting tunables then this
function will support that.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
18 months agoctdb-tests: Script options into per-script file
Martin Schwenke [Mon, 19 Feb 2018 03:58:48 +0000 (14:58 +1100)]
ctdb-tests: Script options into per-script file

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
18 months agoctdb-scripts: Use load_script_options in event scripts
Martin Schwenke [Tue, 20 Feb 2018 01:56:42 +0000 (12:56 +1100)]
ctdb-scripts: Use load_script_options in event scripts

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>