samba.git
11 months agos4/scripting/demodirsync: fix syntax error
Douglas Bagnall [Thu, 11 Oct 2018 05:33:48 +0000 (18:33 +1300)]
s4/scripting/demodirsync: fix syntax error

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agos4/scripting: py3 style 0o123 octal, not 0123
Douglas Bagnall [Thu, 11 Oct 2018 05:32:52 +0000 (18:32 +1300)]
s4/scripting: py3 style 0o123 octal, not 0123

this works with py2.6+ too.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agos4/dsdb/pytest/sort: use compat.cmp_fn instead of cmp
Douglas Bagnall [Thu, 11 Oct 2018 04:23:54 +0000 (17:23 +1300)]
s4/dsdb/pytest/sort: use compat.cmp_fn instead of cmp

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <noel.power@suse.com>
11 months agos4/dsdb/pytest/ad_dc_medley: do not use xrange
Douglas Bagnall [Thu, 11 Oct 2018 04:06:32 +0000 (17:06 +1300)]
s4/dsdb/pytest/ad_dc_medley: do not use xrange

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agos4/dsdb/pytests: Py3 compatitble except clauses
Douglas Bagnall [Thu, 11 Oct 2018 03:52:14 +0000 (16:52 +1300)]
s4/dsdb/pytests: Py3 compatitble except clauses

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agoscript/show_test_time: approach python 3 compatibility
Douglas Bagnall [Thu, 11 Oct 2018 03:04:38 +0000 (16:04 +1300)]
script/show_test_time: approach python 3 compatibility

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/kcc: use compat.cmp_fn (PY3)
Douglas Bagnall [Thu, 11 Oct 2018 00:37:28 +0000 (13:37 +1300)]
python/kcc: use compat.cmp_fn (PY3)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/remove_dc: use a local variable in offline_remove_server
Douglas Bagnall [Thu, 11 Oct 2018 00:07:30 +0000 (13:07 +1300)]
python/remove_dc: use a local variable in offline_remove_server

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/samba/common: py3 compat raw_input
Douglas Bagnall [Wed, 10 Oct 2018 23:52:09 +0000 (12:52 +1300)]
python/samba/common: py3 compat raw_input

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agosamba-tool ldapcmp: use ValueError, not obsolete StandardError
Douglas Bagnall [Wed, 10 Oct 2018 23:40:09 +0000 (12:40 +1300)]
samba-tool ldapcmp: use ValueError, not obsolete StandardError

The error is in the value, and StandardError is not in Python 3

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython tests: always use Python's unicodedata
Douglas Bagnall [Wed, 24 Oct 2018 02:56:20 +0000 (15:56 +1300)]
python tests: always use Python's unicodedata

We had our own special version with very few entries, but only
used it in one place.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopytest/dcerpc.integer: force py2 long int without incompatible syntax
Douglas Bagnall [Thu, 11 Oct 2018 05:31:09 +0000 (18:31 +1300)]
pytest/dcerpc.integer: force py2 long int without incompatible syntax

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agos4/selftest/tests: don't use import *
Douglas Bagnall [Thu, 11 Oct 2018 03:52:28 +0000 (16:52 +1300)]
s4/selftest/tests: don't use import *

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agos3/selftest/tests: don't use import *
Douglas Bagnall [Thu, 11 Oct 2018 03:51:23 +0000 (16:51 +1300)]
s3/selftest/tests: don't use import *

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agoselftest/tests.py: avoid import *
Douglas Bagnall [Thu, 11 Oct 2018 03:05:23 +0000 (16:05 +1300)]
selftest/tests.py: avoid import *

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/tests/common: avoid import *
Douglas Bagnall [Thu, 11 Oct 2018 00:40:59 +0000 (13:40 +1300)]
python/tests/common: avoid import *

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agoselftest/perftests: avoid import *
Douglas Bagnall [Thu, 11 Oct 2018 03:05:11 +0000 (16:05 +1300)]
selftest/perftests: avoid import *

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/tests/kcc_*: avoid * imports
Douglas Bagnall [Thu, 11 Oct 2018 01:51:55 +0000 (14:51 +1300)]
python/tests/kcc_*: avoid * imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/tests/kcc.graph: avoid import *
Douglas Bagnall [Thu, 11 Oct 2018 01:44:02 +0000 (14:44 +1300)]
python/tests/kcc.graph: avoid import *

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agos4/scripting/pfm_verify: remove duplicate import
Douglas Bagnall [Thu, 11 Oct 2018 05:33:23 +0000 (18:33 +1300)]
s4/scripting/pfm_verify: remove duplicate import

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agosamba-tool: samba.getopt is not used here
Douglas Bagnall [Wed, 10 Oct 2018 23:34:53 +0000 (12:34 +1300)]
samba-tool: samba.getopt is not used here

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agoauth/cred/tests/bind: remove unused import
Douglas Bagnall [Thu, 11 Oct 2018 05:25:53 +0000 (18:25 +1300)]
auth/cred/tests/bind: remove unused import

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agos4/dsdb/pytest/: unused imports
Douglas Bagnall [Thu, 11 Oct 2018 04:24:22 +0000 (17:24 +1300)]
s4/dsdb/pytest/: unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agos4/dsdb/pytest/dsdb_schema_info: do not double import
Douglas Bagnall [Thu, 11 Oct 2018 04:07:22 +0000 (17:07 +1300)]
s4/dsdb/pytest/dsdb_schema_info: do not double import

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agos4/dsdb/pytest/dirsync: do not double import
Douglas Bagnall [Thu, 11 Oct 2018 04:07:05 +0000 (17:07 +1300)]
s4/dsdb/pytest/dirsync: do not double import

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopy/tests: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 03:50:49 +0000 (16:50 +1300)]
py/tests: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agotests/blackbox/py: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 03:50:17 +0000 (16:50 +1300)]
tests/blackbox/py: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agotdb/test/_tdbtext: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 03:49:47 +0000 (16:49 +1300)]
tdb/test/_tdbtext: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agotalloc/test/pytalloc: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 03:49:05 +0000 (16:49 +1300)]
talloc/test/pytalloc: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agoldb/tests/_ldb_text: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 03:47:11 +0000 (16:47 +1300)]
ldb/tests/_ldb_text: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agoldb-samba/tests/match-rules: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 03:46:44 +0000 (16:46 +1300)]
ldb-samba/tests/match-rules: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agowintest/test-s3: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 03:05:57 +0000 (16:05 +1300)]
wintest/test-s3: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agoscript/generate_param.py: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 03:04:00 +0000 (16:04 +1300)]
script/generate_param.py: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/tests: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 01:33:49 +0000 (14:33 +1300)]
python/tests: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/tests/samdb: avoid useless local variable
Douglas Bagnall [Thu, 11 Oct 2018 01:00:30 +0000 (14:00 +1300)]
python/tests/samdb: avoid useless local variable

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/tests/*: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 00:58:50 +0000 (13:58 +1300)]
python/tests/*: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/tests/netbios: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 00:50:43 +0000 (13:50 +1300)]
python/tests/netbios: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/tests/getdcname: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 00:45:54 +0000 (13:45 +1300)]
python/tests/getdcname: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/tests/dsdb_schema_attr: remove unused/duplicate imports
Douglas Bagnall [Thu, 11 Oct 2018 00:44:45 +0000 (13:44 +1300)]
python/tests/dsdb_schema_attr: remove unused/duplicate imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/tests/dns*: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 00:42:10 +0000 (13:42 +1300)]
python/tests/dns*: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/provision: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 00:39:06 +0000 (13:39 +1300)]
python/provision: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/gp_parse/gp_pol: remove unused import
Douglas Bagnall [Thu, 11 Oct 2018 00:23:35 +0000 (13:23 +1300)]
python/gp_parse/gp_pol: remove unused import

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/schema: remove unused import
Douglas Bagnall [Thu, 11 Oct 2018 00:10:33 +0000 (13:10 +1300)]
python/schema: remove unused import

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/ntacls: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 00:06:40 +0000 (13:06 +1300)]
python/ntacls: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/gp_ext_loader: remove unused imports
Douglas Bagnall [Thu, 11 Oct 2018 00:05:32 +0000 (13:05 +1300)]
python/gp_ext_loader: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/forest_update: remove unused imports
Douglas Bagnall [Wed, 10 Oct 2018 23:57:15 +0000 (12:57 +1300)]
python/forest_update: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/domain_update: remove unused imports
Douglas Bagnall [Wed, 10 Oct 2018 23:55:41 +0000 (12:55 +1300)]
python/domain_update: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agosamba-tool domain: remove unused imports
Douglas Bagnall [Wed, 10 Oct 2018 23:45:54 +0000 (12:45 +1300)]
samba-tool domain: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agosamba-tool user: remove unused import
Douglas Bagnall [Wed, 10 Oct 2018 23:41:28 +0000 (12:41 +1300)]
samba-tool user: remove unused import

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agosamba-tool ldapcmp: remove unused import
Douglas Bagnall [Wed, 10 Oct 2018 23:38:58 +0000 (12:38 +1300)]
samba-tool ldapcmp: remove unused import

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agosamba-tool drs: remove duplicate and unused imports
Douglas Bagnall [Wed, 10 Oct 2018 23:37:36 +0000 (12:37 +1300)]
samba-tool drs: remove duplicate and unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/tests/__init__: import what we need
Douglas Bagnall [Thu, 11 Oct 2018 00:49:05 +0000 (13:49 +1300)]
python/tests/__init__: import what we need

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/tests/gpo: import what we need (errno, not gp_log)
Douglas Bagnall [Thu, 11 Oct 2018 00:47:22 +0000 (13:47 +1300)]
python/tests/gpo: import what we need (errno, not gp_log)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agopython/tests/unix: fix spelling and import of text_type
Douglas Bagnall [Thu, 11 Oct 2018 01:43:29 +0000 (14:43 +1300)]
python/tests/unix: fix spelling and import of text_type

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
11 months agos3:smbd: Move a variable declaration closer to its use
Volker Lendecke [Wed, 19 Sep 2018 14:26:09 +0000 (16:26 +0200)]
s3:smbd: Move a variable declaration closer to its use

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

11 months agosmbd: Slightly optimize delay_rename_for_lease_break
Volker Lendecke [Mon, 24 Sep 2018 13:46:27 +0000 (15:46 +0200)]
smbd: Slightly optimize delay_rename_for_lease_break

Do the checks with increasing cost, possibly avoid more expensive ones

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 months agolib: Avoid an "includes.h"
Volker Lendecke [Thu, 18 Oct 2018 03:46:03 +0000 (05:46 +0200)]
lib: Avoid an "includes.h"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 months agosmbd: Replace some GUID_string by GUID_buf_string
Volker Lendecke [Mon, 24 Sep 2018 13:40:46 +0000 (06:40 -0700)]
smbd: Replace some GUID_string by GUID_buf_string

It's only debug statements, but I would like to promote the
stack-allocation routines as good practice where they make sense.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 months agotdbtorture: Align integer types
Volker Lendecke [Tue, 23 Oct 2018 03:53:24 +0000 (05:53 +0200)]
tdbtorture: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 months agotdbtorture: No transaction with mutexes
Volker Lendecke [Mon, 22 Oct 2018 15:18:43 +0000 (17:18 +0200)]
tdbtorture: No transaction with mutexes

Right now we don't do transactions with mutexed tdbs. tdbtorture -m
locks up. I haven't really investigated why that is the case. The lockup
confused me quite a bit until I figured out it works fine as long as it
does not do transactions, which is all we need right now.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 months agotdb: Remove "USE_RIGHT_MERGES" code
Volker Lendecke [Mon, 22 Oct 2018 08:10:24 +0000 (10:10 +0200)]
tdb: Remove "USE_RIGHT_MERGES" code

This has not been activated by default for ages and can be very
inefficient. With check_merge_with_left_record() we have an
alternative that will merge freelist records while we walk it
anyway. This has reduced fragmentation significantly

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 months agotdb: Fix a typo
Volker Lendecke [Mon, 22 Oct 2018 08:14:23 +0000 (10:14 +0200)]
tdb: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 months agotdb: Use explicit initialization
Volker Lendecke [Mon, 22 Oct 2018 05:08:58 +0000 (07:08 +0200)]
tdb: Use explicit initialization

Let the compiler figure out the optimal code

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 months agotdb: Avoid casts
Volker Lendecke [Mon, 22 Oct 2018 05:42:14 +0000 (07:42 +0200)]
tdb: Avoid casts

We have %PRIu32 and %zu these days

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 months agoCI/Autobuild: Remove samba-none-env-py3 test
Noel Power [Thu, 18 Oct 2018 08:49:24 +0000 (09:49 +0100)]
CI/Autobuild: Remove samba-none-env-py3 test

We now run a purepython3 none-env test, later when the whole
build is running under python3 we will resurrect this job
but as (samba-none-env-py2) for python2

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Oct 23 09:10:22 CEST 2018 on sn-devel-144

11 months agoAdd new CI job for new purepy3-none-env autobuild task
Noel Power [Tue, 16 Oct 2018 18:39:41 +0000 (19:39 +0100)]
Add new CI job for new purepy3-none-env autobuild task

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agoscript: Add new (temporary) autobuild task for none-env tests.
Noel Power [Tue, 16 Oct 2018 18:25:26 +0000 (19:25 +0100)]
script: Add new (temporary) autobuild task for none-env tests.

Ideally we want all the tests to run under python3 by default (no
special task for this) and then convert the existing '-py3' tasks
to run the python tests with python3.
However at the moment the convertion process is not ready to do this,
for a while we need to run separate autobuild tasks for this.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba/netcmd: PY3 fix CI error for samba.tests.samba_tool.help
Noel Power [Wed, 17 Oct 2018 17:06:34 +0000 (18:06 +0100)]
python/samba/netcmd: PY3 fix CI error for samba.tests.samba_tool.help

Strangely the test was failing on CI only, looks like there is an
issue with order of elements returned from dict.items() with python3.4
(version of python in CI docker instance) and python3.6 (version on my
development machine). Changed code to sort the keys so order of help
printed out should be the same for each invocation.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba/provision: PY3 PY3 port samba4.blackbox.provision-backend
Noel Power [Wed, 10 Oct 2018 11:25:09 +0000 (12:25 +0100)]
python/samba/provision: PY3 PY3 port samba4.blackbox.provision-backend

Enclose filter with list as filter object has no 'len' method

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba: PY3 port samba4.blackbox.provision-backend
Noel Power [Wed, 10 Oct 2018 11:21:10 +0000 (12:21 +0100)]
python/samba: PY3 port samba4.blackbox.provision-backend

convert ldif content to str when necessary

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba/provision: PY3 port samba4.blackbox.provision-backend
Noel Power [Wed, 10 Oct 2018 11:18:32 +0000 (12:18 +0100)]
python/samba/provision: PY3 port samba4.blackbox.provision-backend

Fix some attibrutes that need to be treated as str

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba/netcmd: PY3 make sure get_testparm_var returns 'str'
Noel Power [Wed, 10 Oct 2018 10:18:13 +0000 (11:18 +0100)]
python/samba/netcmd: PY3 make sure get_testparm_var returns 'str'

part of PY3 port samba4.blackbox.upgrade.samba3-upgrade*

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba/samba3: PY3 tdb.Tdb.get method expects bytes in PY3
Noel Power [Wed, 10 Oct 2018 10:16:40 +0000 (11:16 +0100)]
python/samba/samba3: PY3 tdb.Tdb.get method expects bytes in PY3

part of PY3 port samba4.blackbox.upgrade.samba3-upgrade*

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba/netcmd: PY3 fix samba.tests.domain_backup_offline
Noel Power [Tue, 9 Oct 2018 20:16:08 +0000 (21:16 +0100)]
python/samba/netcmd: PY3 fix samba.tests.domain_backup_offline

Fix attributes that need to be treated as str not bytes

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba: PY3 port samba4.blackbox.functionalprep
Noel Power [Mon, 8 Oct 2018 14:21:45 +0000 (15:21 +0100)]
python/samba: PY3 port samba4.blackbox.functionalprep

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba/netcmd: PY3 Fix error in samba4.blackbox.schemaupgrade
Noel Power [Mon, 8 Oct 2018 11:27:56 +0000 (12:27 +0100)]
python/samba/netcmd: PY3 Fix error in samba4.blackbox.schemaupgrade

Getting Exception: must be str, not ldb.bytes error in scheme_upgrade
phase of test
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agoselftest/filter: PY3 Make filter-subunit forgiving of decoding errors
Noel Power [Fri, 5 Oct 2018 15:49:45 +0000 (16:49 +0100)]
selftest/filter: PY3 Make filter-subunit forgiving of decoding errors

samba4.local.ndr for one is a test that outputs string in an encoding
that stdin.readline() guesses to be utf8 (but it isn't) filter subunit
can afford to be forgiving of some random text that can't be decoded as
utf8 so lets do that.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba: PY3 fix samba4.blackbox.upgradeprovision.release-4-0-0
Noel Power [Fri, 5 Oct 2018 14:10:52 +0000 (15:10 +0100)]
python/samba: PY3 fix samba4.blackbox.upgradeprovision.release-4-0-0

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agos4/scripting/bin: blobs needs to be bytes
Noel Power [Thu, 4 Oct 2018 17:29:37 +0000 (18:29 +0100)]
s4/scripting/bin: blobs needs to be bytes

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agos4/scripting/bin: PY3 fix samba4.blackbox.upgradeprovision.alpha13
Noel Power [Wed, 3 Oct 2018 14:19:09 +0000 (15:19 +0100)]
s4/scripting/bin: PY3 fix samba4.blackbox.upgradeprovision.alpha13

11 months agos4/scripting/bin: PY3 make sure GUID result of format is string
Noel Power [Tue, 2 Oct 2018 13:45:53 +0000 (14:45 +0100)]
s4/scripting/bin: PY3 make sure GUID result of format is string

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agos4/scripting: Py2/Py3 for samba4.blackbox.upgradeprovision.alpha13
Noel Power [Mon, 27 Aug 2018 19:29:53 +0000 (20:29 +0100)]
s4/scripting: Py2/Py3 for samba4.blackbox.upgradeprovision.alpha13

fixup source4/scripting/bin/samba_upgradedns
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agos4/scripting: PY2/PY3 port for samba4.blackbox.upgradeprovision.current
Noel Power [Mon, 27 Aug 2018 12:08:26 +0000 (13:08 +0100)]
s4/scripting: PY2/PY3 port for samba4.blackbox.upgradeprovision.current

o Fix various ldb attribute that need to be converted to string
o dict has no 'has_key' method
o ndr_unpack needs bytes not string
o b64encode needs bytes (so open file with binary mode)
o StandardError was removed in python3 use Exception instead
o fix octal literals
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba: samba4.blackbox.dbcheck.release-4-1-0rc3
Noel Power [Sat, 25 Aug 2018 11:50:58 +0000 (12:50 +0100)]
python/samba: samba4.blackbox.dbcheck.release-4-1-0rc3

* Various string related fixed py2/py3
* Fix strange double decode followed by encode code (see comments
  in change)
* Added dump_attr_values, simply printing attribute values (from
  sequence) doesn't work (when using string '%s' format codes in
  existing string). We need to print out string from bytes in PY3
  and fallback to repr(which will print b'blah') if we get a decode error

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agosamba_tool: Enclose iterator with list
Noel Power [Sat, 25 Aug 2018 10:39:04 +0000 (11:39 +0100)]
samba_tool: Enclose iterator with list

Really strange bug caused by map being updated while being iterated.
This caused keys to be skipped and inconsistent and incorrect
results from ldapcmp.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba: misc use of str for ldb.bytes
Noel Power [Thu, 23 Aug 2018 16:59:12 +0000 (17:59 +0100)]
python/samba: misc use of str for ldb.bytes

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba: ldb attribute string fix for wafsamba.tests
Noel Power [Mon, 1 Oct 2018 13:47:06 +0000 (14:47 +0100)]
python/samba: ldb attribute string fix for wafsamba.tests

11 months agoPY3: ensure StringIO usage is py2/py3 compatible
Noel Power [Mon, 6 Aug 2018 12:39:15 +0000 (13:39 +0100)]
PY3: ensure StringIO usage is py2/py3 compatible

11 months agoPY3: relative import fixes
Noel Power [Mon, 6 Aug 2018 14:02:18 +0000 (15:02 +0100)]
PY3: relative import fixes

11 months agos4/scripting/bin: PY3 Fix exception tuple assignments.
Noel Power [Fri, 28 Sep 2018 15:49:27 +0000 (16:49 +0100)]
s4/scripting/bin: PY3 Fix exception tuple assignments.

In Python3 to access the exception arguments you need to now use
Exception.args, in Python2 you could access these direcly with the
'except' declaration.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agoPY3: port samba.tests.samba3sam
Noel Power [Sun, 5 Aug 2018 20:08:33 +0000 (21:08 +0100)]
PY3: port samba.tests.samba3sam

11 months agopython/samba: use PY3 version of ConfigParser
Noel Power [Wed, 5 Sep 2018 13:59:19 +0000 (14:59 +0100)]
python/samba: use PY3 version of ConfigParser

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba/gp_parse: PY2/PY3 compat porting for gp_init.py
Noel Power [Mon, 15 Oct 2018 09:58:23 +0000 (10:58 +0100)]
python/samba/gp_parse: PY2/PY3 compat porting for gp_init.py

Fixes
1) use compat versions of ConfigParser and StringIO
2) open file needs to be opened in binary mode as write_pretty_xml
   routine uses BytesIO() object.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba: add alias for ConfigParser for PY2/PY3 compatability
Noel Power [Fri, 24 Aug 2018 08:55:08 +0000 (09:55 +0100)]
python/samba: add alias for ConfigParser for PY2/PY3 compatability

ConfigParser module changed name to configParser in PY3, additionally
the behaviour regarding interpolation has changed. ConfigParser now
has a default interpolation param whose behaviour demands that '%' is
escaped. To maintain behaviour with the python2 version this default
param needs to be changed. Add some alias(s) and 'shim' Configparser
symbol in samba.compat to cater for this.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agoPY3: convert samba.tests.strings to Py2/Py3
Noel Power [Sat, 4 Aug 2018 20:00:06 +0000 (21:00 +0100)]
PY3: convert samba.tests.strings to Py2/Py3

Previously the py2 api for strcasecmp_m/strstr_m required strings/unicode
 but couldn't actually handle unicode with anything other than the default
encoding (e.g. ascii). The c-api as been fixed and the encoding steps
(which were unnecessary and causing errors in PY3) have been removed

11 months agopython: py_strcasecmp_m & py_strstr_m don't handle unicode properly
Noel Power [Tue, 7 Aug 2018 15:21:35 +0000 (16:21 +0100)]
python: py_strcasecmp_m & py_strstr_m don't handle unicode properly

py_strcasecmp_m & py_strstr_m use PyArg_ParseTuple() with 's' which
in Py2 tries to decode string with the default (e.g. ascii) encoding

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agopython/samba/tests: PY2/PY3 port samba.tests.dcerpc.integer
Noel Power [Sat, 4 Aug 2018 16:01:24 +0000 (17:01 +0100)]
python/samba/tests: PY2/PY3 port samba.tests.dcerpc.integer

Python3 no longer has a long type so the 'L' postfix is no
longer valid. Additionally in python2 an int that exceeds will
be transparently converted into a long when necessary

11 months agopython/samba/netcmd: PY3 only possible to decode bytes
Noel Power [Thu, 27 Sep 2018 17:16:49 +0000 (18:16 +0100)]
python/samba/netcmd: PY3 only possible to decode bytes

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agoPY3: Only decode when necessary
Noel Power [Sat, 4 Aug 2018 13:23:28 +0000 (14:23 +0100)]
PY3: Only decode when necessary

11 months agos4/setup/tests: PY3 samba-tool needs to be called with correct python ver.
Noel Power [Wed, 10 Oct 2018 10:14:59 +0000 (11:14 +0100)]
s4/setup/tests: PY3 samba-tool needs to be called with correct python ver.

Ensure samba-tool python version defined by $PYTHON

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>