samba.git
5 years agopython: Bulk conversion callers of ldb.Dn second param
Noel Power [Wed, 25 Apr 2018 19:01:49 +0000 (20:01 +0100)]
python: Bulk conversion callers of ldb.Dn second param

Convert second param passed to ldb.Dn to be unicode so py2 & py3 code
will work

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
5 years agopython/samba: bulk conversion of caller to dsdb_Dn 2nd param.
Noel Power [Wed, 25 Apr 2018 17:28:30 +0000 (18:28 +0100)]
python/samba: bulk conversion of caller to dsdb_Dn 2nd param.

Convert second param to dsdb_Dn to be unicode so py2 & py3 code
will work

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
5 years agopython/samba: Add binary_type for p2/p3 testing.
Noel Power [Tue, 24 Apr 2018 15:28:41 +0000 (16:28 +0100)]
python/samba: Add binary_type for p2/p3 testing.

For helping test for binary types, binary_type evaluates to 'str'
in py2, and 'bytes' in py3.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
5 years agoAdd aliases for StringIO.StringIO
Noel Power [Tue, 17 Apr 2018 12:52:58 +0000 (13:52 +0100)]
Add aliases for StringIO.StringIO

cStringIO doesn't handle unicode, StringIO does. With py2/py3
compatable code we can easily find ourselves getting passed
unicode so we don't alias cStringIO

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
5 years agopython/samba: Add some compatability PY2/PY3 functions
Noel Power [Fri, 13 Apr 2018 10:19:10 +0000 (11:19 +0100)]
python/samba: Add some compatability PY2/PY3 functions

I hope these changes are a short term interim solution for the
absence of the 'six' module/library. I also hope that soon this
module can be removed and be replaced by usage of six.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
5 years agos4/param: Additionally accept unicode as string param in Py2
Noel Power [Fri, 13 Apr 2018 16:34:40 +0000 (17:34 +0100)]
s4/param: Additionally accept unicode as string param in Py2

With the changes to make samba python code Py2/Py3 compatible there
now are many instances where string content is decoded.
Decoded string variables in Py2 are returned as the unicode type. Many
Py2 c-module functions that take string arguments only check for the
string type. However now it's quite possibe the content formally passed
as a string argument is now passed as unicode after being decoded,
such arguments are rejected and code can fail subtly. This only affects
places where the type is directly checked e.g. via PyStr_Check etc.
arguments that are parsed by ParseTuple* functions generally already
accept both string and unicode (if 's', 'z', 's*' format specifiers
are used)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
5 years agos4/librpc: Additionally accept unicode as string param in Py2
Noel Power [Fri, 13 Apr 2018 16:34:19 +0000 (17:34 +0100)]
s4/librpc: Additionally accept unicode as string param in Py2

With the changes to make samba python code Py2/Py3 compatible there
now are many instances where string content is decoded.
Decoded string variables in Py2 are returned as the unicode type. Many
Py2 c-module functions that take string arguments only check for the
string type. However now it's quite possibe the content formally passed
as a string argument is now passed as unicode after being decoded,
such arguments are rejected and code can fail subtly. This only affects
places where the type is directly checked e.g. via PyStr_Check etc.
arguments that are parsed by ParseTuple* functions generally already
accept both string and unicode (if 's', 'z', 's*' format specifiers
are used)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
5 years agos4/dsdb: Additionally accept unicode as string param in Py2
Noel Power [Fri, 13 Apr 2018 16:33:47 +0000 (17:33 +0100)]
s4/dsdb: Additionally accept unicode as string param in Py2

With the changes to make samba python code Py2/Py3 compatible there
now are many instances where string content is decoded.
Decoded string variables in Py2 are returned as the unicode type. Many
Py2 c-module functions that take string arguments only check for the
string type. However now it's quite possibe the content formally passed
as a string argument is now passed as unicode after being decoded,
such arguments are rejected and code can fail subtly. This only affects
places where the type is directly checked e.g. via PyStr_Check etc.
arguments that are parsed by ParseTuple* functions generally already
accept both string and unicode (if 's', 'z', 's*' format specifiers
are used)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
5 years agos4/auth: Additionally accept unicode as string param in Py2
Noel Power [Fri, 13 Apr 2018 16:33:10 +0000 (17:33 +0100)]
s4/auth: Additionally accept unicode as string param in Py2

With the changes to make samba python code Py2/Py3 compatible there
now are many instances where string content is decoded.
Decoded string variables in Py2 are returned as the unicode type. Many
Py2 c-module functions that take string arguments only check for the
string type. However now it's quite possibe the content formally passed
as a string argument is now passed as unicode after being decoded,
such arguments are rejected and code can fail subtly. This only affects
places where the type is directly checked e.g. via PyStr_Check etc.
arguments that are parsed by ParseTuple* functions generally already
accept both string and unicode (if 's', 'z', 's*' format specifiers
are used)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
5 years agolibcli/nbt: Additionally accept unicode as string param in Py2
Noel Power [Fri, 13 Apr 2018 16:32:15 +0000 (17:32 +0100)]
libcli/nbt: Additionally accept unicode as string param in Py2

With the changes to make samba python code Py2/Py3 compatible there
now are many instances where string content is decoded.
Decoded string variables in Py2 are returned as the unicode type. Many
Py2 c-module functions that take string arguments only check for the
string type. However now it's quite possibe the content formally passed
as a string argument is now passed as unicode after being decoded,
such arguments are rejected and code can fail subtly. This only affects
places where the type is directly checked e.g. via PyStr_Check etc.
arguments that are parsed by ParseTuple* functions generally already
accept both string and unicode (if 's', 'z', 's*' format specifiers
are used)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
5 years agolib/tevent: Additionally accept unicode as string param in Py2
Noel Power [Fri, 13 Apr 2018 16:17:20 +0000 (17:17 +0100)]
lib/tevent: Additionally accept unicode as string param in Py2

With the changes to make samba python code Py2/Py3 compatible there
now are many instances where string content is decoded.
Decoded string variables in Py2 are returned as the unicode type. Many
Py2 c-module functions that take string arguments only check for the
string type. However now it's quite possibe the content formally passed
as a string argument is now passed as unicode after being decoded,
such arguments are rejected and code can fail subtly. This only affects
places where the type is directly checked e.g. via PyStr_Check etc.
arguments that are parsed by ParseTuple* functions generally already
accept both string and unicode (if 's', 'z', 's*' format specifiers
are used)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
5 years agolib/ldb: Additionally accept unicode as string param in Py2
Noel Power [Thu, 12 Apr 2018 13:46:59 +0000 (14:46 +0100)]
lib/ldb: Additionally accept unicode as string param in Py2

With the changes to make samba python code Py2/Py3 compatible there
now are many instances where string content is decoded.
Decoded string variables in Py2 are returned as the unicode type. Many
Py2 c-module functions that take string arguments only check for the
string type. However now it's quite possibe the content formally passed
as a string argument is now passed as unicode after being decoded,
such arguments are rejected and code can fail subtly. This only affects
places where the type is directly checked e.g. via PyStr_Check etc.
arguments that are parsed by ParseTuple* functions generally already
accept both string and unicode (if 's', 'z', 's*' format specifiers
are used)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
5 years agosamba-tool visualize: use correct DC in graph label
Douglas Bagnall [Thu, 19 Apr 2018 22:52:31 +0000 (10:52 +1200)]
samba-tool visualize: use correct DC in graph label

We have been using a random DC (depending to hash order, which was not
random enough on Python 2.7 to affect the tests).

Reported-by: Noel Power <noel.power@suse.com>
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <noel.power@suse.com>
5 years agoctdb-tests: Fix a typo
Martin Schwenke [Mon, 30 Apr 2018 02:07:48 +0000 (12:07 +1000)]
ctdb-tests: Fix a typo

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): Mon Apr 30 14:26:43 CEST 2018 on sn-devel-144

5 years agoctdb-tests: Simplify a test
Martin Schwenke [Mon, 26 Feb 2018 19:40:59 +0000 (06:40 +1100)]
ctdb-tests: Simplify a test

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-scripts: Drop CTDB_RC_LOCAL testing hook
Martin Schwenke [Thu, 5 Apr 2018 06:09:22 +0000 (16:09 +1000)]
ctdb-scripts: Drop CTDB_RC_LOCAL testing hook

This is not used.

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): Fri Apr 27 09:37:49 CEST 2018 on sn-devel-144

5 years agoctdb-scripts: Drop unused variable service_config
Martin Schwenke [Wed, 4 Apr 2018 09:00:56 +0000 (19:00 +1000)]
ctdb-scripts: Drop unused variable service_config

This was previously used by the loadconfig() function.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-docs: Drop documentation for CTDB_SHUTDOWN_TIMEOUT option
Martin Schwenke [Wed, 4 Apr 2018 08:17:13 +0000 (18:17 +1000)]
ctdb-docs: Drop documentation for CTDB_SHUTDOWN_TIMEOUT option

This was recently removed but the documentation was forgotten.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-docs: Drop stale reference to unused configuration file
Martin Schwenke [Thu, 29 Mar 2018 04:42:10 +0000 (15:42 +1100)]
ctdb-docs: Drop stale reference to unused configuration file

Recently removed but documentation change was forgotten.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-docs: Drop references to CTDB_BASE from the documentation
Martin Schwenke [Thu, 29 Mar 2018 04:38:13 +0000 (15:38 +1100)]
ctdb-docs: Drop references to CTDB_BASE from the documentation

CTDB_BASE should only ever be modified by test code.  It should not be
mentioned in the user documentation.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-tools: Avoid filtering stderr when onnode not running in parallel
Martin Schwenke [Tue, 17 Apr 2018 22:05:25 +0000 (08:05 +1000)]
ctdb-tools: Avoid filtering stderr when onnode not running in parallel

stderr_filter() only does anything useful when running in
parallel (i.e. with the -p option).  So, simplify the non-parallel
case by not using stderr_filter().

As a side-effect, this fixes an issue introduced in commit
85a4375788d8ef8345ec390807f18299abdadb20 where local daemon tests
would hang when trying to start daemons with VALGRIND set (to a
valgrind command that does not use --log-file).  This is because
valgrind would keep stderr open for its output so the pipeline
involving stderr_filter() would never complete.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb-scripts: Avoid shellcheck SC1117: Backslash is literal in "..."
Martin Schwenke [Thu, 19 Apr 2018 01:54:26 +0000 (11:54 +1000)]
ctdb-scripts: Avoid shellcheck SC1117: Backslash is literal in "..."

This warning (apparently new in shellcheck 0.4.7) only applies to
double-quoted strings.  Change affected constant strings to use
single-quotes.  In the one example that contains a variable expansion
escape the backslash as recommended.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoctdb: Fix some -Werror=strict-overflow issues
Martin Schwenke [Mon, 16 Apr 2018 08:32:07 +0000 (18:32 +1000)]
ctdb: Fix some -Werror=strict-overflow issues

All quite obvious.  For the LCP2 one, we're not actually counting so
use a bool instead of an int.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 years agoscript/git-hooks: add check-trailing-whitespace
Ralph Boehme [Tue, 10 Apr 2018 11:19:09 +0000 (13:19 +0200)]
script/git-hooks: add check-trailing-whitespace

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Apr 26 03:54:39 CEST 2018 on sn-devel-144

5 years agoAdd a wrapper script as git pre-commit hook
Ralph Boehme [Tue, 10 Apr 2018 11:04:27 +0000 (13:04 +0200)]
Add a wrapper script as git pre-commit hook

When developer mode is enabled, the wrapper script
"script/git-hooks/pre-commit-hook" gets installed as

  .git/hooks/pre-commit

and calls "script/git-hooks/pre-commit-script".

This way we can later modify the "script/git-hooks/pre-commit-script"
without the need to ever change the installed commit hook itself.

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Jeremy Allison <jra at samba.org>
5 years agorpc_server: Fix NetSessEnum with stale sessions
Christof Schmitt [Tue, 24 Apr 2018 20:53:41 +0000 (13:53 -0700)]
rpc_server: Fix NetSessEnum with stale sessions

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr 25 22:49:07 CEST 2018 on sn-devel-144

5 years agoselftest: Add testcase for querying sessions after smbd crash
Christof Schmitt [Tue, 24 Apr 2018 20:52:59 +0000 (13:52 -0700)]
selftest: Add testcase for querying sessions after smbd crash

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agorpcclient: Print number of entries for NetSessEnum
Christof Schmitt [Tue, 24 Apr 2018 19:18:49 +0000 (12:18 -0700)]
rpcclient: Print number of entries for NetSessEnum

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4/smbd/server.c: create /run if missing
William Brown [Wed, 18 Apr 2018 09:44:33 +0000 (19:44 +1000)]
s4/smbd/server.c: create /run if missing

In some cases (containers mainly) /var/run may not be present. Instead of
erroring, we should create it at startup.

Signed-off-by: William Brown <william@blackhats.net.au>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agoprinting: return the same error code as windows does on upload failures
Björn Jacke [Thu, 19 Apr 2018 14:14:38 +0000 (16:14 +0200)]
printing: return the same error code as windows does on upload failures

Some print drivers inf files are broken and cause driver installation to fail
on Samba servers. Windows returns WERR_APP_INIT_FAILURE in that case, we should
do the same. Windows machines are less unlucky with that.

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

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Wed Apr 25 13:55:25 CEST 2018 on sn-devel-144

6 years agolib: #include "util_event.h" only where needed
Volker Lendecke [Tue, 24 Apr 2018 12:19:48 +0000 (14:19 +0200)]
lib: #include "util_event.h" only where needed

One dependency of includes.h less

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): Tue Apr 24 22:26:22 CEST 2018 on sn-devel-144

6 years agotevent: Fix callers of tevent_req_set_endtime
Volker Lendecke [Mon, 23 Apr 2018 13:36:28 +0000 (15:36 +0200)]
tevent: Fix callers of tevent_req_set_endtime

tevent_req_set_endtime internally already calls tevent_req_nomem and thus sets
the error status correctly.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agotorture3: Fix CID 1435119 Error handling issues (CHECKED_RETURN)
Volker Lendecke [Tue, 24 Apr 2018 08:37:26 +0000 (10:37 +0200)]
torture3: Fix CID 1435119 Error handling issues (CHECKED_RETURN)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3:util: remove reinit_after_fork_pipe_handler before sending SIGTERM
Stefan Metzmacher [Thu, 22 Mar 2018 11:32:15 +0000 (12:32 +0100)]
s3:util: remove reinit_after_fork_pipe_handler before sending SIGTERM

We should not keep the tevent_fd active when we sending us a SIGTERM,
this is not a real problem, but due to a different bug I triggered
a 100% cpu loop. I think it's safer to idle in that case instead
of waisting a lot of energy.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agowinbind: Speed up wbinfo -p
Volker Lendecke [Wed, 18 Apr 2018 15:29:51 +0000 (17:29 +0200)]
winbind: Speed up wbinfo -p

This was (possibly) used as an example in the early days of the async winbind
code we have today. It's not necessary to send this through a full tevent_req
round.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Apr 24 17:18:23 CEST 2018 on sn-devel-144

6 years agonsswitch: Only connect to the priv socket if required
Volker Lendecke [Mon, 23 Apr 2018 10:13:40 +0000 (12:13 +0200)]
nsswitch: Only connect to the priv socket if required

This should speed up calls like "wbinfo -p"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 years agontlm_auth: PAM_AUTH_CRAP needs a privileged socket
Volker Lendecke [Mon, 23 Apr 2018 12:04:48 +0000 (14:04 +0200)]
ntlm_auth: PAM_AUTH_CRAP needs a privileged socket

This only works right now because wb_common always tries privileged

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 years agonsswitch: fix memory leak in winbind_open_pipe_sock() when the privileged pipe is...
Stefan Metzmacher [Tue, 24 Apr 2018 08:59:05 +0000 (10:59 +0200)]
nsswitch: fix memory leak in winbind_open_pipe_sock() when the privileged pipe is not accessable.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 years agos3:messages: improve tevent_create_immediate recycling
Ralph Boehme [Tue, 27 Mar 2018 14:04:58 +0000 (16:04 +0200)]
s3:messages: improve tevent_create_immediate recycling

We should create the immediate event at the beginning
were we have a chance to return an error, rather than
ignoring a failure later.

As a side effect this also reuses the immediate event
after the refcount went to 0 and up again.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Apr 24 14:30:20 CEST 2018 on sn-devel-144

6 years agos3:messages: check tevent_fd_get_flags() == 0 before using stale event context pointer
Ralph Boehme [Tue, 27 Mar 2018 13:27:32 +0000 (15:27 +0200)]
s3:messages: check tevent_fd_get_flags() == 0 before using stale event context pointer

If the event context got deleted, tevent_fd_get_flags() will return 0
for the stale fde.  In that case we should not use fde_ev->ev anymore.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 years agos3:messages: check reg->refcount == 0 before accessing other elements
Ralph Boehme [Tue, 27 Mar 2018 14:05:30 +0000 (16:05 +0200)]
s3:messages: check reg->refcount == 0 before accessing other elements

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 years agowinbind: Remove an unused struct declaration
Volker Lendecke [Thu, 19 Apr 2018 04:30:42 +0000 (06:30 +0200)]
winbind: Remove an unused struct declaration

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): Tue Apr 24 04:44:30 CEST 2018 on sn-devel-144

6 years agodbwrap: Remove dependency on samba-hostconfig
Volker Lendecke [Tue, 17 Apr 2018 14:46:00 +0000 (16:46 +0200)]
dbwrap: Remove dependency on samba-hostconfig

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agodbwrap: Remove calls to loadparm
Volker Lendecke [Tue, 17 Apr 2018 14:45:45 +0000 (16:45 +0200)]
dbwrap: Remove calls to loadparm

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolibcli: Call dbwrap_local_open with the correct tdb flags
Volker Lendecke [Tue, 17 Apr 2018 14:39:46 +0000 (16:39 +0200)]
libcli: Call dbwrap_local_open with the correct tdb flags

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolibcli: Call dbwrap_local_open with the correct hash size
Volker Lendecke [Tue, 17 Apr 2018 14:38:27 +0000 (16:38 +0200)]
libcli: Call dbwrap_local_open with the correct hash size

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agodbwrap3: Call dbwrap_local_open with the correct tdb flags
Volker Lendecke [Tue, 17 Apr 2018 14:32:20 +0000 (16:32 +0200)]
dbwrap3: Call dbwrap_local_open with the correct tdb flags

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agodbwrap3: Call dbwrap_local_open with the correct hash size
Volker Lendecke [Tue, 17 Apr 2018 14:31:28 +0000 (16:31 +0200)]
dbwrap3: Call dbwrap_local_open with the correct hash size

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agocluster4: Call dbwrap_local_open with the correct tdb_flags
Volker Lendecke [Tue, 17 Apr 2018 14:26:27 +0000 (16:26 +0200)]
cluster4: Call dbwrap_local_open with the correct tdb_flags

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agocluster4: Call dbwrap_local_open with the correct hash size
Volker Lendecke [Tue, 17 Apr 2018 14:25:19 +0000 (16:25 +0200)]
cluster4: Call dbwrap_local_open with the correct hash size

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agocredentials: Call dbwrap_local_open with the correct tdb_flags
Volker Lendecke [Tue, 17 Apr 2018 14:23:03 +0000 (16:23 +0200)]
credentials: Call dbwrap_local_open with the correct tdb_flags

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agocredentials: Call dbwrap_local_open with the correct hash size
Volker Lendecke [Tue, 17 Apr 2018 14:22:08 +0000 (16:22 +0200)]
credentials: Call dbwrap_local_open with the correct hash size

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolibcli: Call dbwrap_local_open with the correct tdb_flags
Volker Lendecke [Tue, 17 Apr 2018 14:20:02 +0000 (16:20 +0200)]
libcli: Call dbwrap_local_open with the correct tdb_flags

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agolibcli: Call dbwrap_local_open with the correct hash size
Volker Lendecke [Tue, 17 Apr 2018 14:18:50 +0000 (16:18 +0200)]
libcli: Call dbwrap_local_open with the correct hash size

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3:vfs_aio_pthread: make use of pthreadpool_tevent instead of pthreadpool_pipe
Stefan Metzmacher [Fri, 9 Mar 2018 14:02:04 +0000 (15:02 +0100)]
s3:vfs_aio_pthread: make use of pthreadpool_tevent instead of pthreadpool_pipe

pthreadpool_tevent provides a much simpler api and avoids an extra
pipe for the completion notification.

This means we now have just one thread pool, that's shared for
all async pread, pwrite, fsync and openat() calls, instead of having
an extra pool for openat() with the same possible number of threads.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Apr 23 13:30:06 CEST 2018 on sn-devel-144

6 years agoselftest: add some basic testing for aio_pthread
Stefan Metzmacher [Fri, 20 Apr 2018 09:27:30 +0000 (11:27 +0200)]
selftest: add some basic testing for aio_pthread

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 years agodocs-xml: rewrite the vfs_aio_pthread manpage to reflect the >= 4.0.0 behavior
Stefan Metzmacher [Fri, 20 Apr 2018 09:04:20 +0000 (11:04 +0200)]
docs-xml: rewrite the vfs_aio_pthread manpage to reflect the >= 4.0.0 behavior

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 years agos3:smbd: call pthreadpool_tevent_init() already in smbd_process()
Stefan Metzmacher [Fri, 9 Mar 2018 13:59:31 +0000 (14:59 +0100)]
s3:smbd: call pthreadpool_tevent_init() already in smbd_process()

pthreadpool_tevent_init() doesn't start any thread yet, it only
allocates a bit of memory.

It's easier to start this in a central place, so that it's
available to all VFS modules.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 years agobuild: fix build without JSON audit support
Björn Baumbach [Fri, 20 Apr 2018 11:04:41 +0000 (13:04 +0200)]
build: fix build without JSON audit support

Autobuild-User(master): Björn Baumbach <bbaumbach@samba.org>
Autobuild-Date(master): Fri Apr 20 21:12:33 CEST 2018 on sn-devel-144

6 years agos3/security.c undefined value
William Brown [Wed, 18 Apr 2018 23:39:33 +0000 (09:39 +1000)]
s3/security.c undefined value

s3/security.c had an NTSTATUS status that was undefined and with the configure
option --address-sanitizer this caused uninitialised value error.

Signed-off-by: William Brown <william@blackhats.net.au>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Simo Sorce <idra@samba.org>
Autobuild-User(master): Alexander Bokovoy <ab@samba.org>
Autobuild-Date(master): Fri Apr 20 18:18:25 CEST 2018 on sn-devel-144

6 years agoldb_wrap.c missing header
William Brown [Wed, 18 Apr 2018 23:39:17 +0000 (09:39 +1000)]
ldb_wrap.c missing header

ldb_wrap.c was missing unistd.h causing implicit symbol declaration and error
during compilation.

Signed-off-by: William Brown <william@blackhats.net.au>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Simo Sorce <idra@samba.org>
6 years agos3:passdb: Do not return OK if we don't have pinfo set up
Andreas Schneider [Tue, 17 Apr 2018 06:55:23 +0000 (08:55 +0200)]
s3:passdb: Do not return OK if we don't have pinfo set up

This prevents a crash in fill_mem_keytab_from_secrets()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Apr 19 00:32:22 CEST 2018 on sn-devel-144

6 years agobuild: add option to choose to build with or without JSON audit support
Björn Baumbach [Tue, 17 Apr 2018 13:47:58 +0000 (15:47 +0200)]
build: add option to choose to build with or without JSON audit support

Add a new configure option:

  --with-json-audit
            Build with JSON auth audit support (default=auto). This requires
    the jansson devel package.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master):  <bbaumbach@samba.org>
Autobuild-Date(master): Wed Apr 18 15:25:42 CEST 2018 on sn-devel-144

6 years agonbt_server: Align integer types
Volker Lendecke [Mon, 16 Apr 2018 14:02:42 +0000 (16:02 +0200)]
nbt_server: Align integer types

sizeof returns size_t

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

6 years agonbt_server: Factor out nbtd_node_status_reply_packet
Volker Lendecke [Fri, 2 Feb 2018 14:03:16 +0000 (15:03 +0100)]
nbt_server: Factor out nbtd_node_status_reply_packet

Separate packet creation from sending out the packet. This way packet
creation can be used elsewhere in the future.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 years agonbt_server: Factor out nbtd_name_query_reply_packet
Volker Lendecke [Fri, 2 Feb 2018 12:30:44 +0000 (13:30 +0100)]
nbt_server: Factor out nbtd_name_query_reply_packet

Separate packet creation from sending out the packet. This way packet
creation can be used elsewhere in the future.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 years agotstream: Fix CID 1167981 Unchecked return value
Volker Lendecke [Fri, 30 Mar 2018 17:23:47 +0000 (12:23 -0500)]
tstream: Fix CID 1167981 Unchecked return value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Apr 16 19:09:56 CEST 2018 on sn-devel-144

6 years agotstream: Fix CID 1167982 Unchecked return value
Volker Lendecke [Fri, 30 Mar 2018 17:22:57 +0000 (12:22 -0500)]
tstream: Fix CID 1167982 Unchecked return value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 years agolibdgram: Fix an error path memleak
Volker Lendecke [Sun, 25 Feb 2018 12:00:39 +0000 (13:00 +0100)]
libdgram: Fix an error path memleak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Apr 13 21:04:28 CEST 2018 on sn-devel-144

6 years agolibnbt: Align data types
Volker Lendecke [Thu, 12 Apr 2018 18:40:32 +0000 (20:40 +0200)]
libnbt: Align data types

ARRAY_SIZE returns size_t

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 years agolibnbt: Add an explicit "mem_ctx" to name_request_send
Volker Lendecke [Sun, 4 Feb 2018 12:16:14 +0000 (12:16 +0000)]
libnbt: Add an explicit "mem_ctx" to name_request_send

Implicitly hanging requests off nbtsock is too inflexible for future use

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 years agotraffic_relay: bulk port print to modern py3 style
Joe Guo [Fri, 13 Apr 2018 03:00:01 +0000 (15:00 +1200)]
traffic_relay: bulk port print to modern py3 style

Change print to function and avoid the ugly `print >>sys.stderr`.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Fri Apr 13 10:36:32 CEST 2018 on sn-devel-144

6 years agos4/webserver: initialise optional parameter
Douglas Bagnall [Thu, 12 Apr 2018 05:19:20 +0000 (17:19 +1200)]
s4/webserver: initialise optional parameter

OK, this is unused and unimplemented.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agos4/lib/py-registry: initialize optional parameters for open_* functions
Douglas Bagnall [Thu, 12 Apr 2018 05:15:19 +0000 (17:15 +1200)]
s4/lib/py-registry: initialize optional parameters for open_* functions

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agos3/py_passdb: initialize optional parameters earlier
Douglas Bagnall [Thu, 12 Apr 2018 05:13:05 +0000 (17:13 +1200)]
s3/py_passdb: initialize optional parameters earlier

It is just a bit easier to see what is happening.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agonbt/pynbt: initialize optional parameter in nbt_name_refresh
Douglas Bagnall [Thu, 12 Apr 2018 05:10:10 +0000 (17:10 +1200)]
nbt/pynbt: initialize optional parameter in nbt_name_refresh

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agonbt/pynbt: initialize optional parameter in nbt_name_register
Douglas Bagnall [Thu, 12 Apr 2018 05:09:45 +0000 (17:09 +1200)]
nbt/pynbt: initialize optional parameter in nbt_name_register

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agoldb/pyldb: initialize optional parameter in ldb_connect()
Douglas Bagnall [Thu, 12 Apr 2018 05:07:38 +0000 (17:07 +1200)]
ldb/pyldb: initialize optional parameter in ldb_connect()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 years agokcc/graph: add __hash__ to InternalEdge for py3
Joe Guo [Tue, 10 Apr 2018 03:06:51 +0000 (15:06 +1200)]
kcc/graph: add __hash__ to InternalEdge for py3

In py3, if a class defines `__eq__()` but not `__hash__()`, its instances will
not be usable as items in hashable collections, e.g.: set.

Add `__hash__()` to InternalEdge, so it can be added to a set in py3.

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 agokcc: fix sort for py3
Joe Guo [Tue, 10 Apr 2018 02:51:37 +0000 (14:51 +1200)]
kcc: fix sort for py3

py2:

    list.sort(cmp=None, key=None, reverse=False)
    sorted(iterable[, cmp[, key[, reverse]]])

py3:

    list.sort(key=None, reverse=False)
    sorted(iterable, *, key=None, reverse=False)

The `cmp` arg was removed in py3, make use of `key` arg to work around.

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 agokcc/kcc_utils: fix divide for py3
Joe Guo [Tue, 10 Apr 2018 00:58:52 +0000 (12:58 +1200)]
kcc/kcc_utils: fix divide for py3

`/` will return float other than int in py3.
Use `//` to keep consistent with py2.

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 agokcc/kcc_utils: convert dict.keys to list
Joe Guo [Tue, 10 Apr 2018 03:42:42 +0000 (15:42 +1200)]
kcc/kcc_utils: convert dict.keys to list

In py3, `dict.keys()` will return a iterator not a list.
Convert it to list to support both py2 and py3.

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 agokcc/graph_utils: port string.translate for py3
Joe Guo [Tue, 10 Apr 2018 00:45:34 +0000 (12:45 +1200)]
kcc/graph_utils: port string.translate for py3

In py3, `str.translate` removed the second positional argument
`deletechars`, which means you can not use it to delete chars from str.
Use `replace` for this case.

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/graph: enable py3 for samba.tests.graph
Joe Guo [Tue, 10 Apr 2018 03:52:47 +0000 (15:52 +1200)]
selftest/graph: enable py3 for samba.tests.graph

Changes are made separatedly in previous commits.
No change needed here.

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 agopython/tests/graph: actually test graphs, don't print
Douglas Bagnall [Thu, 12 Apr 2018 03:57:09 +0000 (15:57 +1200)]
python/tests/graph: actually test graphs, don't print

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agograph: fix sort for py3
Joe Guo [Tue, 10 Apr 2018 03:51:34 +0000 (15:51 +1200)]
graph: fix sort for py3

`sorted` can not sort `None` with str in py3, use the `key` arg to fix.
Sort None as ''.

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 agograph: fix divide for py3
Joe Guo [Tue, 10 Apr 2018 03:48:35 +0000 (15:48 +1200)]
graph: fix divide for py3

`/` will return float other than int in py3.
Use `//` to keep consistent with py2.

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.krb5_credentials
Joe Guo [Wed, 11 Apr 2018 05:44:26 +0000 (17:44 +1200)]
selftest: enable py3 for samba.tests.krb5_credentials

Fix encoding 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.docs
Joe Guo [Thu, 5 Apr 2018 01:48:36 +0000 (13:48 +1200)]
selftest: enable py3 for samba.tests.docs

Popen methods will return bytes.
Decode output to string before using.

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.source
Joe Guo [Thu, 5 Apr 2018 00:49:09 +0000 (12:49 +1200)]
selftest: enable py3 for samba.tests.source

In py2, `open` has no `encoding` arg, python guesses file encoding from
locale. This could be wrong.

Use `io.open` to open a file, so we can specify encoding in both py2 and
py3.

Also, open file with `r` instead of `rb` for py3.

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.lsa_string
Joe Guo [Wed, 11 Apr 2018 05:17:48 +0000 (17:17 +1200)]
selftest: enable py3 for samba.tests.lsa_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.registry
Joe Guo [Wed, 11 Apr 2018 04:42:54 +0000 (16:42 +1200)]
selftest: enable py3 for samba.tests.dcerpc.registry

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.dcerpc.rpcecho
Joe Guo [Wed, 11 Apr 2018 04:38:03 +0000 (16:38 +1200)]
selftest: enable py3 for samba.tests.dcerpc.rpcecho

Prefix `b` for bytes.

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.bare
Joe Guo [Tue, 10 Apr 2018 23:39:56 +0000 (11:39 +1200)]
selftest: enable py3 for samba.tests.dcerpc.bare

Prefix b to bytes.

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.sam
Joe Guo [Tue, 10 Apr 2018 04:27:47 +0000 (16:27 +1200)]
selftest: enable py3 for samba.tests.dcerpc.sam

1. Fix invalid declaration syntax for toArray
2. Simplify toArray implementation with list comprehension.
3. Remove ending L for long integer.

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 agopython: fix unicode escape in doc string
Joe Guo [Wed, 11 Apr 2018 04:32:19 +0000 (16:32 +1200)]
python: fix unicode escape in doc string

The doc string has `\u` mark inside, which will cause encoding error in
py3. prefix `r` to doc string to fix.

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 agopython: bulk convert zip to list
Joe Guo [Tue, 10 Apr 2018 03:49:40 +0000 (15:49 +1200)]
python: bulk convert zip to list

In py3, zip will return a iterator other than a list.
Convert it to a list to support both py2 and py3.

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 agopython: bulk replace file to open for py3
Joe Guo [Wed, 11 Apr 2018 04:03:34 +0000 (16:03 +1200)]
python: bulk replace file to open for py3

The builtin function `file` was removed in py3. Use `open` 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 agopython: bulk replace dict.itervalues to values for py3
Joe Guo [Tue, 10 Apr 2018 22:44:24 +0000 (10:44 +1200)]
python: bulk replace dict.itervalues to values for py3

In py3, iterxxx methods are removed.

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 agopython: bulk port tdb iterkeys for py3
Joe Guo [Thu, 12 Apr 2018 04:07:24 +0000 (16:07 +1200)]
python: bulk port tdb iterkeys for py3

In py3, `dict.iterkeys()` is removed, we need to use `keys()` instead.
This is compatible with py2 since `dict.keys()` exists for py2.

tdb pretents to be a dict, however, not completely.
It provides `iterkeys()` for py2 only, and `keys()` for py3 only,
which means replace `iterkeys()` to `keys()` will break py2.

In python, iter a dict will implicitly iter on keys.
Use this feature to work around.

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>