metze/samba/wip.git
6 years agoselftest: enable py3 for samba.tests.common
Joe Guo [Mon, 26 Mar 2018 04:07:33 +0000 (17:07 +1300)]
selftest: enable py3 for samba.tests.common

fix dsdb_Dn comparison for Python 3

In Python 3, the builtin `cmp` funtion was dropped. And the `__cmp__` magic
method in object is no longer honored, which is replaced by 6 new methods:
__eq__, __ne__, __lt__, __le__, __gt__, __ge__.

This caused `tests.CommonTests` failed with `py3_compatiable=True`.
Fixed by adding the above methods.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agoselftest: enable py3 for samba.tests.dcerpc.string
Joe Guo [Tue, 3 Apr 2018 03:15:12 +0000 (15:15 +1200)]
selftest: enable py3 for samba.tests.dcerpc.string

No change needed.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agoselftest: enable py3 for samba.tests.dcerpc.array
Joe Guo [Tue, 3 Apr 2018 03:13:09 +0000 (15:13 +1200)]
selftest: enable py3 for samba.tests.dcerpc.array

No change needed.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agoselftest: enable py3 for samba.tests.dcerpc.rpc_talloc
Joe Guo [Tue, 3 Apr 2018 03:11:48 +0000 (15:11 +1200)]
selftest: enable py3 for samba.tests.dcerpc.rpc_talloc

No changes needed.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agoselftest: enable py3 for samba.tests.password_quality
Joe Guo [Tue, 3 Apr 2018 02:47:41 +0000 (14:47 +1200)]
selftest: enable py3 for samba.tests.password_quality

No change needed.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agoselftest: enable py3 for samba.tests.upgrade
Joe Guo [Tue, 3 Apr 2018 02:29:26 +0000 (14:29 +1200)]
selftest: enable py3 for samba.tests.upgrade

`os.tempname` is removed in Python 3.
Use `tempfile` instead.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agoselftest: enable py3 for samba.tests.blackbox.check_output
Joe Guo [Fri, 23 Mar 2018 01:10:28 +0000 (14:10 +1300)]
selftest: enable py3 for samba.tests.blackbox.check_output

convert bytes to str for Python 3

`BlackboxTestCase.check_output` will return bytes since it uses
`subprocess.communicate` underneath.
Convert expected string result to bytes for comparing.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agoselftest: enable py3 for samba.tests.xattr
Joe Guo [Thu, 5 Apr 2018 02:49:55 +0000 (14:49 +1200)]
selftest: enable py3 for samba.tests.xattr

Fix bytes and str issue.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agoselftest: enable py3 for samba.tests.posixacl
Joe Guo [Thu, 5 Apr 2018 02:49:25 +0000 (14:49 +1200)]
selftest: enable py3 for samba.tests.posixacl

Fix bytes and str issue.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agowscript_build: fix c modules deps name for Python 3
Joe Guo [Wed, 28 Mar 2018 02:53:50 +0000 (15:53 +1300)]
wscript_build: fix c modules deps name for Python 3

In wscript_build, the lib name in deps list may have postfix for Python
3. Instead of hard coding the base name directly, need to load correct
name for each Python version with `bld.pyembed_libname`.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agosamba3: work around bytes formatting for Python 3.4
Joe Guo [Wed, 28 Mar 2018 02:08:40 +0000 (15:08 +1300)]
samba3: work around bytes formatting for Python 3.4

  b'%s\x00' % key

The above % formatting for bytes is only available since Python 3.5,
however we need to support Python 3.4 so far.

Work around this with `+`.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 years agoget make test TESTS=samba.tests.provision to work
Noel Power [Mon, 5 Mar 2018 16:08:01 +0000 (16:08 +0000)]
get make test TESTS=samba.tests.provision to work

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>
6 years agopython3 port for provision.c
Noel Power [Mon, 5 Feb 2018 10:56:20 +0000 (10:56 +0000)]
python3 port for provision.c

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>
6 years agosamba python tests: enable samba.tests.ntacls for python3
Noel Power [Wed, 28 Mar 2018 09:33:12 +0000 (10:33 +0100)]
samba python tests: enable samba.tests.ntacls for 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>
6 years agosamba python tests: enable samba.tests.posixacl for python3
Noel Power [Tue, 6 Mar 2018 15:03:57 +0000 (15:03 +0000)]
samba python tests: enable samba.tests.posixacl for 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>
6 years agos4/ntvfs/posix/python: python3 (get|set)xattr value should be bytes
Noel Power [Tue, 6 Mar 2018 15:03:13 +0000 (15:03 +0000)]
s4/ntvfs/posix/python: python3 (get|set)xattr value should be bytes

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>
6 years agopython3 port for smbd module
Noel Power [Mon, 5 Feb 2018 11:10:46 +0000 (11:10 +0000)]
python3 port for smbd 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>
6 years agopython samba test: enable samba.tests.libsmb_samba_internal for py3
Noel Power [Thu, 8 Mar 2018 10:37:23 +0000 (10:37 +0000)]
python samba test: enable samba.tests.libsmb_samba_internal 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>
6 years agopython3 port for libsmb_samba_internal module
Noel Power [Mon, 5 Feb 2018 11:34:15 +0000 (11:34 +0000)]
python3 port for libsmb_samba_internal 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>
6 years agoselftest python: get samba.tests.s3idmapdb to run with py3
Noel Power [Thu, 22 Mar 2018 12:46:55 +0000 (12:46 +0000)]
selftest python: get samba.tests.s3idmapdb to run with 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>
6 years agopython selftest: enable samba.tests.s3windb to run with py3
Noel Power [Thu, 22 Mar 2018 12:39:43 +0000 (12:39 +0000)]
python selftest: enable samba.tests.s3windb to run with 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>
6 years agopython selftest: enabled samba.tests.s3registry to run with py3
Noel Power [Thu, 22 Mar 2018 12:35:11 +0000 (12:35 +0000)]
python selftest: enabled samba.tests.s3registry to run with 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>
6 years agopython selftest: enable samba.tests.s3passdb to run with python3
Noel Power [Thu, 22 Mar 2018 12:26:15 +0000 (12:26 +0000)]
python selftest: enable samba.tests.s3passdb 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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

6 years 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>
6 years 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>
6 years 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

6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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

6 years 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

6 years 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>
6 years 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

6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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

6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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

6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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

6 years 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

6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>
6 years 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>