samba.git
13 months agosmbd: Simplify logic in remove_stale_share_mode_entries
Volker Lendecke [Mon, 30 Jul 2018 11:21:26 +0000 (13:21 +0200)]
smbd: Simplify logic in remove_stale_share_mode_entries

To me, an early "continue" is easier to follow than a "else".

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agosmbd: Simplify share_mode_stale_pid
Volker Lendecke [Mon, 30 Jul 2018 11:03:17 +0000 (13:03 +0200)]
smbd: Simplify share_mode_stale_pid

This loop does not need to count valid share modes. A single valid one
is sufficient for keeping the delete token around

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agosmbd: Simplify lease_match() a bit
Volker Lendecke [Fri, 27 Jul 2018 12:16:20 +0000 (14:16 +0200)]
smbd: Simplify lease_match() a bit

This has been implicitly initialized to 0 with the explicit struct
initializer above.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agosmbd: Simplify logic in fsp_lease_update
Volker Lendecke [Thu, 26 Jul 2018 13:46:18 +0000 (15:46 +0200)]
smbd: Simplify logic in fsp_lease_update

One if-condition is better than two

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agosmbd: Simplify logic in smb2_lease_break_send
Volker Lendecke [Thu, 26 Jul 2018 12:52:55 +0000 (14:52 +0200)]
smbd: Simplify logic in smb2_lease_break_send

If/else if chains are hard to follow to me. Simplify the code by using
early returns.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agosmbd: Factor out file_has_read_oplocks()
Volker Lendecke [Thu, 26 Jul 2018 10:35:30 +0000 (12:35 +0200)]
smbd: Factor out file_has_read_oplocks()

Why? This makes it clearer to me that we're not interested in the actual
number of read oplocks. We only want to know if there are any read
oplocks at all.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3:lib: Rename server_contexts to global_contexts
Christof Schmitt [Tue, 21 Aug 2018 20:08:42 +0000 (13:08 -0700)]
s3:lib: Rename server_contexts to global_contexts

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3:lib/server_contexts: Rename variables
Christof Schmitt [Tue, 21 Aug 2018 18:18:08 +0000 (11:18 -0700)]
s3:lib/server_contexts: Rename variables

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3: Rename server_messaging_context() to global_messaging_context()
Christof Schmitt [Tue, 21 Aug 2018 18:09:16 +0000 (11:09 -0700)]
s3: Rename server_messaging_context() to global_messaging_context()

This reflects that the messaging context is also used outside of the
server processes.

The command used for the rename:
find . -name '*.[hc]' -print0 | xargs -0 sed -i 's/server_messaging_context/global_messaging_context/'

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3: Rename server_event_context() to global_event_context()
Christof Schmitt [Tue, 21 Aug 2018 18:06:16 +0000 (11:06 -0700)]
s3: Rename server_event_context() to global_event_context()

This reflects that the event context is also used outside of the server
processes.

The command used for the rename:
find . -name '*.[hc]' -print0 | xargs -0 sed -i 's/server_event_context/global_event_context/'

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agoexamples: Fix the smb2mount build
Volker Lendecke [Fri, 7 Sep 2018 05:27:46 +0000 (07:27 +0200)]
examples: Fix the smb2mount build

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3:smbget: Use cmdline_messaging_context
Christof Schmitt [Tue, 21 Aug 2018 23:11:02 +0000 (16:11 -0700)]
s3:smbget: Use cmdline_messaging_context

Initialize the messaging context through cmdline_messaging_context to
allow access to config in clustered Samba.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3:smbcontrol: Use cmdline_messaging_context
Christof Schmitt [Tue, 21 Aug 2018 19:35:11 +0000 (12:35 -0700)]
s3:smbcontrol: Use cmdline_messaging_context

Initialize the messaging context through cmdline_messaging_context to
allow access to config in clustered Samba.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3:dbwrap_tool: Use cmdline_messaging_context
Christof Schmitt [Tue, 21 Aug 2018 19:34:34 +0000 (12:34 -0700)]
s3:dbwrap_tool: Use cmdline_messaging_context

Initialize the messaging context through cmdline_messaging_context to
allow access to config in clustered Samba.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3:eventlogadm: Use cmdline_messaging_context
Christof Schmitt [Mon, 20 Aug 2018 23:21:51 +0000 (16:21 -0700)]
s3:eventlogadm: Use cmdline_messaging_context

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3: ntlm_auth: Use cmdline_messaging_context
Christof Schmitt [Mon, 20 Aug 2018 23:18:20 +0000 (16:18 -0700)]
s3: ntlm_auth: Use cmdline_messaging_context

Call cmdline_messaging_context to initialize the messaging context
before accessing clustered Samba config.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3:sharesec: Use cmdline_messaging_context
Christof Schmitt [Mon, 20 Aug 2018 23:15:02 +0000 (16:15 -0700)]
s3:sharesec: Use cmdline_messaging_context

Call cmdline_messasging_context to initialize messaging context before
accessing clustered Samba config.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3:testparm: Use cmdline_messaging_context
Christof Schmitt [Mon, 20 Aug 2018 23:11:11 +0000 (16:11 -0700)]
s3:testparm: Use cmdline_messaging_context

Call cmdline_messaging_context to initialize a messaging config before
accessing clustered Samba config.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3:pdbedit: Use cmdline_messaging_context
Christof Schmitt [Mon, 20 Aug 2018 23:08:21 +0000 (16:08 -0700)]
s3:pdbedit: Use cmdline_messaging_context

Initialize the messaging context through cmdline_messaging_context to
allow access to config in clustered Samba.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3:messaging: remove unused messaging_init_client()
Ralph Boehme [Tue, 10 Jul 2018 14:29:46 +0000 (16:29 +0200)]
s3:messaging: remove unused messaging_init_client()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
13 months agos3:net: Use cmdline_messaging_context
Christof Schmitt [Mon, 20 Aug 2018 23:01:00 +0000 (16:01 -0700)]
s3:net: Use cmdline_messaging_context

Use cmdline_messaging_context with its error checking instead of open
coding the same steps.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agorpcclient: Use cmdline_messaging_context
Christof Schmitt [Mon, 20 Aug 2018 22:54:11 +0000 (15:54 -0700)]
rpcclient: Use cmdline_messaging_context

Use cmdline_messaging_context with its error checking instead of open
coding the same steps.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3:smbstatus: Use cmdline_messaging_context
Christof Schmitt [Mon, 20 Aug 2018 22:46:27 +0000 (15:46 -0700)]
s3:smbstatus: Use cmdline_messaging_context

Use cmdline_messaging_context to initialize a messaging context instead
of open coding the same steps.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3:smbpasswd: Use cmdline_messaging_context
Christof Schmitt [Mon, 20 Aug 2018 22:38:33 +0000 (15:38 -0700)]
s3:smbpasswd: Use cmdline_messaging_context

smbpasswd does not use POPT_CREDENTIALS. Call cmdline_messaging_context
to initialize a messaging_context with proper error checking before
calling lp_load_global.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agotest:doc: Skip 'clustering=yes'
Christof Schmitt [Tue, 21 Aug 2018 21:58:01 +0000 (14:58 -0700)]
test:doc: Skip 'clustering=yes'

As testparm will error out when running clustering=yes as non-root, skip
this step to avoid a test failure.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3:popt_common: use cmdline_messaging_context() in popt_common_credentials_callback()
Ralph Boehme [Tue, 10 Jul 2018 13:26:40 +0000 (15:26 +0200)]
s3:popt_common: use cmdline_messaging_context() in popt_common_credentials_callback()

This adds a call to cmdline_messaging_context() to the popt
popt_common_credentials_callback() hook and ensures that any client tool
that uses POPT_COMMON_CREDENTIALS gets an implicit messaging context,
ensuring it doesn't crash in the subsequent lp_load_client() with
include=registry in a cluster.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
13 months agoselftest: pass configfile to pdbedit
Ralph Boehme [Tue, 10 Jul 2018 08:38:10 +0000 (10:38 +0200)]
selftest: pass configfile to pdbedit

This is needed otherwise pdbedit fails to initialize messaging in
autobuild.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
13 months agos3:loadparm: reinit_globals in lp_load_with_registry_shares()
Ralph Boehme [Tue, 10 Jul 2018 06:11:31 +0000 (08:11 +0200)]
s3:loadparm: reinit_globals in lp_load_with_registry_shares()

This was set to false in 0e0d77519c27038b30fec92d542198e97be767d9 based
on the assumption that callers would have no need to call
lp_load_initial_only() with a later call to lp_load_something().

This is not quite correct, since for accessing registry config on a
cluster with include=registry, we need messaging up and running which
*itself* requires loadparm to be initialized to get the statedir,
lockdir asf. directories.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
13 months agos3:lib: Introduce cmdline context wrapper
Christof Schmitt [Mon, 20 Aug 2018 21:44:28 +0000 (14:44 -0700)]
s3:lib: Introduce cmdline context wrapper

Command line tools need acccess to the same messaging context provided
by server_messaging_context, as common code for db_open uses that
context. We want to have additional checking for command line tools
without having that code part of the servers. Introduce a wrapper
library to use for command line tools with the additional checks, that
then acquires the server_messaging_context.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3:lib: Move popt_common_credentials to separate file
Christof Schmitt [Mon, 13 Aug 2018 22:39:08 +0000 (15:39 -0700)]
s3:lib: Move popt_common_credentials to separate file

This is only used by command line utilities and has additional
dependencies. Move to a separate file to contain the dependencies to the
command line tools.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3/lib:popt_common: Move setup_logging to common callback
Christof Schmitt [Mon, 13 Aug 2018 22:07:20 +0000 (15:07 -0700)]
s3/lib:popt_common: Move setup_logging to common callback

The flag is set in the common callback, so be consistent

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
13 months agos3:lib/server_contexts: make server_event_ctx and server_msg_ctx static
Ralph Boehme [Mon, 9 Jul 2018 15:11:57 +0000 (17:11 +0200)]
s3:lib/server_contexts: make server_event_ctx and server_msg_ctx static

server_event_ctx and server_msg_ctx static shouldn't be accessible from
outside this compilation unit.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
13 months agowafsamba/samba_waf18: redefine flex function
Alexander Bokovoy [Thu, 6 Sep 2018 06:36:18 +0000 (09:36 +0300)]
wafsamba/samba_waf18: redefine flex function

There is a bug in waf: flex routine adjusts its inputs against
the task's current working directory but assumes it is being called from
within the build variant directory.

For Samba this means we adjust one level up than the actual work
directory we use to run (bin/ vs bin/default) and flex doesn't find the
source files.

Fix the issue by creating a local override of flex definition that
utilizes the same workd directory for both path adjustment and running
the flex itself.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Sep  7 15:45:36 CEST 2018 on sn-devel-144

13 months agolib/replace/wscript: fix detection of a fallthrough attribute for clang
Alexander Bokovoy [Thu, 6 Sep 2018 09:50:58 +0000 (09:50 +0000)]
lib/replace/wscript: fix detection of a fallthrough attribute for clang

clang issues a warning but otherwise allows our test to be compiled and
linked. We consider this case a successful pass for a fallthrough
attribute detection while it is an error.

Turn missing declaration warning into an error so that we actually do
not define fallthrough attribute support in case it doesn't really work.

Fixes FreeBSD 11.2 with clang.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agowafsamba/samba_autoconf: when setting undefined result, use empty tuple
Alexander Bokovoy [Thu, 6 Sep 2018 07:51:00 +0000 (07:51 +0000)]
wafsamba/samba_autoconf: when setting undefined result, use empty tuple

A difference between waf 1.x and 2.x is that we gained 0 as an undefined
variable in the cache file. This does not allow to differentiate unset
and set to 0 defines.

Force to use empty tuple () to signify unset defines.

Also, fix handling of extra cflags in case of 'strict=True': if
extra_cflags were not defined, we'd append None to the cflags list and
it confuses conf.check() later. 'None' is added to the command line of a
tool executed by the conf.check() which, depending on a tool, may be
treated as an error and cause wrong test result.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos3/wscript: fix flex detection
Ralph Boehme [Wed, 5 Sep 2018 11:47:17 +0000 (13:47 +0200)]
s3/wscript: fix flex detection

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos3/wscript: fix bison detection
Ralph Boehme [Wed, 5 Sep 2018 11:46:37 +0000 (13:46 +0200)]
s3/wscript: fix bison detection

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4/selftest/tests: Enabled samba.tests.samba_tool.computer
Noel Power [Thu, 26 Apr 2018 17:23:50 +0000 (18:23 +0100)]
s4/selftest/tests: Enabled samba.tests.samba_tool.computer

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett abartlet@samba.org
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Thu Sep  6 19:24:54 CEST 2018 on sn-devel-144

13 months agos4/dsdb/tests: port samba4.tombstone_reanimation for PY3
Noel Power [Mon, 3 Sep 2018 17:47:20 +0000 (18:47 +0100)]
s4/dsdb/tests: port samba4.tombstone_reanimation for PY3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett abartlet@samba.org
13 months agos3/selftst: enable samba4.tombstone_reanimation for py3
Noel Power [Thu, 10 May 2018 17:17:29 +0000 (18:17 +0100)]
s3/selftst: enable samba4.tombstone_reanimation for py3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett abartlet@samba.org
13 months agos4/selftest: enable samba4.drs.replica_sync_rodc.python for py3
Noel Power [Thu, 10 May 2018 16:19:47 +0000 (17:19 +0100)]
s4/selftest: enable samba4.drs.replica_sync_rodc.python for py3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett abartlet@samba.org
13 months agos4/torture/drs: PY3 port for samba4.drs.replica_sync_rodc
Noel Power [Mon, 3 Sep 2018 16:56:56 +0000 (17:56 +0100)]
s4/torture/drs: PY3 port for samba4.drs.replica_sync_rodc

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett abartlet@samba.org
13 months agos4/selftest: enable samba.tests.dsdb_schema_attributes for py3
Noel Power [Thu, 10 May 2018 15:35:29 +0000 (16:35 +0100)]
s4/selftest: enable samba.tests.dsdb_schema_attributes for py3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett abartlet@samba.org
13 months agopython/samba/tests: port samba.tests.dsdb_schema_attributes to PY3
Noel Power [Mon, 3 Sep 2018 16:34:27 +0000 (17:34 +0100)]
python/samba/tests: port samba.tests.dsdb_schema_attributes to PY3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett abartlet@samba.org
13 months agoPEP8: fix E128: continuation line under-indented for visual indent
Joe Guo [Mon, 3 Sep 2018 13:05:52 +0000 (01:05 +1200)]
PEP8: fix E128: continuation line under-indented for visual indent

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Sep  6 15:50:17 CEST 2018 on sn-devel-144

13 months agoPEP8: fix E127: continuation line over-indented for visual indent
Joe Guo [Mon, 3 Sep 2018 13:05:48 +0000 (01:05 +1200)]
PEP8: fix E127: continuation line over-indented for visual indent

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agoPEP8: fix E125: continuation line with same indent as next logical line
Joe Guo [Mon, 3 Sep 2018 13:05:32 +0000 (01:05 +1200)]
PEP8: fix E125: continuation line with same indent as next logical line

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agoPEP8: fix E124: closing bracket does not match visual indentation
Joe Guo [Mon, 3 Sep 2018 13:05:31 +0000 (01:05 +1200)]
PEP8: fix E124: closing bracket does not match visual indentation

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agoPEP8: fix E123: closing bracket does not match indentation of opening bracket's line
Joe Guo [Mon, 3 Sep 2018 13:05:31 +0000 (01:05 +1200)]
PEP8: fix E123: closing bracket does not match indentation of opening bracket's line

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agoPEP8: fix E122: continuation line missing indentation or outdented
Joe Guo [Mon, 3 Sep 2018 13:05:26 +0000 (01:05 +1200)]
PEP8: fix E122: continuation line missing indentation or outdented

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agoPEP8: fix E111: indentation is not a multiple of four
Joe Guo [Mon, 3 Sep 2018 13:05:20 +0000 (01:05 +1200)]
PEP8: fix E111: indentation is not a multiple of four

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agoPEP8: fix E101: indentation contains mixed spaces and tabs
Joe Guo [Mon, 3 Sep 2018 13:05:20 +0000 (01:05 +1200)]
PEP8: fix E101: indentation contains mixed spaces and tabs

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agoPEP8: fix comment indent
Joe Guo [Mon, 3 Sep 2018 12:19:42 +0000 (00:19 +1200)]
PEP8: fix comment indent

The comments in this file will make different PEP8 rules fight.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agoPEP8: ignore rules and exclude files
Joe Guo [Mon, 27 Aug 2018 04:48:59 +0000 (16:48 +1200)]
PEP8: ignore rules and exclude files

Will fix other ones and come back to these later.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agowafsamba: Support clang as C compiler
Andreas Schneider [Wed, 5 Sep 2018 09:05:25 +0000 (11:05 +0200)]
wafsamba: Support clang as C compiler

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Sep  6 12:06:05 CEST 2018 on sn-devel-144

13 months agoctdb-tests: Check result of write() in ARP and TCP tests
Martin Schwenke [Wed, 5 Sep 2018 02:42:07 +0000 (12:42 +1000)]
ctdb-tests: Check result of write() in ARP and TCP tests

CTDB -O3 --picky-developer build is failing.  Not sure how this
slipped through.

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): Thu Sep  6 08:33:59 CEST 2018 on sn-devel-144

13 months agos4/selftest: enable samba4.schemaInfo.python for py3
Noel Power [Thu, 10 May 2018 12:16:28 +0000 (13:16 +0100)]
s4/selftest: enable samba4.schemaInfo.python for py3

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): Thu Sep  6 02:27:51 CEST 2018 on sn-devel-144

13 months agos4/selftest: Enable samba.tests.blackbox.smbcontrol for py3
Noel Power [Thu, 10 May 2018 11:51:19 +0000 (12:51 +0100)]
s4/selftest: Enable samba.tests.blackbox.smbcontrol for py3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4/selftest: enable samba.tests.blackbox.traffic_summary for py3
Noel Power [Thu, 10 May 2018 11:39:36 +0000 (12:39 +0100)]
s4/selftest: enable samba.tests.blackbox.traffic_summary for py3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4/selftest: Enable samba.tests.blackbox.traffic_learner for py3
Noel Power [Thu, 10 May 2018 11:36:32 +0000 (12:36 +0100)]
s4/selftest: Enable samba.tests.blackbox.traffic_learner for py3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopython/samba/tests: Change native string to binary for py2/py3 compat
Noel Power [Thu, 10 May 2018 11:35:58 +0000 (12:35 +0100)]
python/samba/tests: Change native string to binary for py2/py3 compat

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4/selftest: samba.tests.blackbox.traffic_replay enabled for py3
Noel Power [Thu, 10 May 2018 11:23:08 +0000 (12:23 +0100)]
s4/selftest: samba.tests.blackbox.traffic_replay enabled for py3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4/selftest: samba.tests.emulate.traffic_packet enable for py3
Noel Power [Thu, 10 May 2018 10:58:35 +0000 (11:58 +0100)]
s4/selftest: samba.tests.emulate.traffic_packet enable for py3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4/selftest: enable samba.tests.emulate.traffic for py3
Noel Power [Wed, 9 May 2018 19:09:10 +0000 (20:09 +0100)]
s4/selftest: enable samba.tests.emulate.traffic for py3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopython/samba/emulate: PY3 port of samba.tests.emulate.traffic_packet
Noel Power [Thu, 10 May 2018 10:57:59 +0000 (11:57 +0100)]
python/samba/emulate: PY3 port of samba.tests.emulate.traffic_packet

Fixes
+ None cannot be used with '<' or '>' operators
+ ord expects 'str'
+ unicode doesn't exist in py3
+ bytes class does not have encode method

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopython/samba/tests: fix traffic for py2/py3 compatability
Noel Power [Wed, 9 May 2018 19:05:36 +0000 (20:05 +0100)]
python/samba/tests: fix traffic for py2/py3 compatability

load/save operations return randomly sorted dictionaries in python3
these changes make sure the already sorted expected results are
compared with sorted actual values.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4/selftest: enable samba.tests.py_credentials for py3
Noel Power [Wed, 9 May 2018 15:11:49 +0000 (16:11 +0100)]
s4/selftest: enable samba.tests.py_credentials for py3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopython/samba/tests: port samba.tests.py_credentials for py2/py3 compat
Noel Power [Wed, 8 Aug 2018 11:51:20 +0000 (12:51 +0100)]
python/samba/tests: port samba.tests.py_credentials for py2/py3 compat

+ ord takes 'str' param
+ unicode doesn't exist in py3
+ py3 bytes class doesn't have encode method, try to ensure py2
  code runs unchanged while adapting code (by using get_string)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agoauth/credentials: py2/py3 credential key needs to return bytes
Noel Power [Wed, 9 May 2018 15:09:00 +0000 (16:09 +0100)]
auth/credentials: py2/py3 credential key needs to return bytes

new_client_authenticator returns a dictionary. The key
'credential' needs to return bytes in Python3, without this
change the the code will attempt to convert the binary data to
a string (resulting sometimes in decode errors).

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agoselftest/knownfail.d: Add PY3 rule for samba.tests.py_credentials
Noel Power [Mon, 3 Sep 2018 14:21:07 +0000 (15:21 +0100)]
selftest/knownfail.d: Add PY3 rule for samba.tests.py_credentials

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4/selftest: enable samba.tests.encrypted_secrets for python3
Noel Power [Wed, 9 May 2018 11:11:48 +0000 (12:11 +0100)]
s4/selftest: enable samba.tests.encrypted_secrets for python3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopython/samba/tests: PY3 port of samba.tests.encrypted_secrets
Noel Power [Wed, 9 May 2018 11:07:20 +0000 (12:07 +0100)]
python/samba/tests: PY3 port of samba.tests.encrypted_secrets

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agoselftest/knownfail.d: Add PY3 rule for samba.tests.encrypted_secrets
Noel Power [Mon, 3 Sep 2018 13:22:17 +0000 (14:22 +0100)]
selftest/knownfail.d: Add PY3 rule for samba.tests.encrypted_secrets

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4/selftest: enable samba.tests.password_hash_ldap for python3
Noel Power [Wed, 9 May 2018 10:37:42 +0000 (11:37 +0100)]
s4/selftest: enable samba.tests.password_hash_ldap for python3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4/selftest: enable samba.tests.password_hash_fl2008 for python3
Noel Power [Wed, 9 May 2018 10:27:40 +0000 (11:27 +0100)]
s4/selftest: enable samba.tests.password_hash_fl2008 for python3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopython/samba/tests: py3 port for samba.test.password_hash_ldap
Noel Power [Wed, 9 May 2018 10:37:16 +0000 (11:37 +0100)]
python/samba/tests: py3 port for samba.test.password_hash_ldap

user samba.compat.text_type instead of unicode

in py2 text_type is an alias for unicode
in py3 text_type is an alias for str (which does nothing if
the input is already str)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4/selftest: enable samba.tests.password_hash_gpgme for python3
Noel Power [Wed, 9 May 2018 10:26:02 +0000 (11:26 +0100)]
s4/selftest: enable samba.tests.password_hash_gpgme for python3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopython/samba/tests: make password_hash.py py2/py3 compatible
Noel Power [Wed, 9 May 2018 10:24:48 +0000 (11:24 +0100)]
python/samba/tests: make password_hash.py py2/py3 compatible

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4/selftest: enable tdb.python for python3
Noel Power [Wed, 9 May 2018 09:20:35 +0000 (10:20 +0100)]
s4/selftest: enable tdb.python for python3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agoselftest: Run libsmbclient tests with NT1 and SMB3
Andreas Schneider [Mon, 3 Sep 2018 14:55:02 +0000 (16:55 +0200)]
selftest: Run libsmbclient tests with NT1 and SMB3

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): Wed Sep  5 21:56:11 CEST 2018 on sn-devel-144

13 months agos4:torture: Set credentials for libsmbclient correctly
Andreas Schneider [Mon, 3 Sep 2018 14:36:54 +0000 (16:36 +0200)]
s4:torture: Set credentials for libsmbclient correctly

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agos3:libsmbclient: Add function to set protocol levels
Andreas Schneider [Tue, 4 Sep 2018 13:48:03 +0000 (15:48 +0200)]
s3:libsmbclient: Add function to set protocol levels

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agos3:libsmbclient: Do not call cli_RNetShareEnum if SMB1 is disabled
Andreas Schneider [Tue, 4 Sep 2018 14:08:58 +0000 (16:08 +0200)]
s3:libsmbclient: Do not call cli_RNetShareEnum if SMB1 is disabled

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agos3:smbclient: Do not call cli_RNetShareEnum if SMB1 is disabled
Andreas Schneider [Tue, 4 Sep 2018 09:11:49 +0000 (11:11 +0200)]
s3:smbclient: Do not call cli_RNetShareEnum if SMB1 is disabled

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agosmbclient: Fix errors printed if we can connect with SMB1
Andreas Schneider [Mon, 3 Sep 2018 10:11:39 +0000 (12:11 +0200)]
smbclient: Fix errors printed if we can connect with SMB1

smbclient -L //server

before:

Reconnecting with SMB1 for workgroup listing.
Connection to earth.milkyway.site failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
Failed to connect with SMB1 -- no workgroup available

after:

Reconnecting with SMB1 for workgroup listing.
Unable to connect with SMB1 -- no workgroup available

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agokdc: Improve code clarity with extra brackets
Andrew Bartlett [Mon, 3 Sep 2018 00:50:39 +0000 (12:50 +1200)]
kdc: Improve code clarity with extra brackets

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): Wed Sep  5 16:17:59 CEST 2018 on sn-devel-144

13 months agoheimdal: Change KDC to respect HDB server name type if f.canonicalize is set
Andrew Bartlett [Mon, 3 Sep 2018 00:49:40 +0000 (12:49 +1200)]
heimdal: Change KDC to respect HDB server name type if f.canonicalize is set

This changes behaviour flagged as being for Java 1.6.  My hope is that this does not
set f.canonicalize

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
13 months agotorture krb5.kdc.canon: Correct principal being checked in TEST_AS_REQ_SELF stage
Andrew Bartlett [Sun, 2 Sep 2018 22:41:10 +0000 (10:41 +1200)]
torture krb5.kdc.canon: Correct principal being checked in TEST_AS_REQ_SELF stage

We have already checked the client principal.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
13 months agotorture: Confirm that this element of the krb5.kdc test does not pass against Windows
Andrew Bartlett [Mon, 27 Aug 2018 03:01:41 +0000 (15:01 +1200)]
torture: Confirm that this element of the krb5.kdc test does not pass against Windows

This should be fixed, but in the meantime add clue to avoid regressions on
bug 11539.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
13 months agoselftest/samba4.blackbox.export.keytab: Update to use a principal with SPN as UPN
Andrew Bartlett [Mon, 3 Sep 2018 08:26:17 +0000 (20:26 +1200)]
selftest/samba4.blackbox.export.keytab: Update to use a principal with SPN as UPN

The ability the kinit with an SPN (not also being a UPN) has gone away as
windows doesn't offer this functionality.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
13 months agoselftest: Add new test to run krb5.kdc.canon against a user with an SPN for a UPN
Andrew Bartlett [Mon, 27 Aug 2018 03:00:12 +0000 (15:00 +1200)]
selftest: Add new test to run krb5.kdc.canon against a user with an SPN for a UPN

The failures in this test compared with Windows Server 1709 are added to
knownfail.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
13 months agoRevert "s4/heimdal: allow SPNs in AS-REQ"
Andrew Bartlett [Thu, 30 Nov 2017 03:30:49 +0000 (16:30 +1300)]
Revert "s4/heimdal: allow SPNs in AS-REQ"

This reverts commit 20dc68050df7b1b0c9d06f8251183a0a6283fcaf.

Tests (the krb5.kdc testsuite) show this behaviour is incorrect.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
13 months agoselftest/samba4.blackbox.export.keytab: Remove stray exit 0 and so run cleanup
Andrew Bartlett [Mon, 3 Sep 2018 04:38:20 +0000 (16:38 +1200)]
selftest/samba4.blackbox.export.keytab: Remove stray exit 0 and so run cleanup

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
13 months agotorture: Add tests to prove that kinit to an SPN is not allowed (unless it is also...
Andrew Bartlett [Thu, 16 Nov 2017 01:01:56 +0000 (14:01 +1300)]
torture: Add tests to prove that kinit to an SPN is not allowed (unless it is also a UPN)

The krb5.kdc.canon testsuite has been updated to pass against Windows
Server 1709 in four modes:

* A normal user
* A user with a UPN
* A user with an SPN (machine account)
* A user with an SPN as the UPN

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
13 months agothird_party: Import exact files from waf-2.0.8/waflib
Andrew Bartlett [Tue, 4 Sep 2018 21:58:21 +0000 (09:58 +1200)]
third_party: Import exact files from waf-2.0.8/waflib

wget https://waf.io/waf-2.0.8.tar.bz2
tar -xf waf-2.0.8.tar.bz2
rsync -a waf-2.0.8/waflib/ third_party/waf/waflib/

The previous import was damaged by auto-strip/correct of whitespace
and had other small corrections.

Check with git show -w.

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): Wed Sep  5 09:29:39 CEST 2018 on sn-devel-144

13 months agoscript/autobuild: Fix formatting in send_email
Alexander Bokovoy [Mon, 3 Sep 2018 10:20:31 +0000 (13:20 +0300)]
script/autobuild: Fix formatting in send_email

Commit cb40e2bbc8a34a1ec3584ab585c5bf44c037ef0e introduced a print
statement with a broken formatting. Reported by pylint.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agoscript/autobuild: re-use CACHE_SUFFIX from waflib
Alexander Bokovoy [Mon, 3 Sep 2018 10:07:23 +0000 (13:07 +0300)]
script/autobuild: re-use CACHE_SUFFIX from waflib

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agobuildtools/wafsamba: use CACHE_SUFFIX instead of a hard-coded name
Alexander Bokovoy [Mon, 3 Sep 2018 10:04:58 +0000 (13:04 +0300)]
buildtools/wafsamba: use CACHE_SUFFIX instead of a hard-coded name

waflib.Build provides CACHE_SUFFIX constant to append to the target
name. We have a reference to samba-specific cache suffix (.cache.py)
while original WAF uses _cache.py as a cache suffix since 2011 (see
commit 44a967e326cc2e670a31b3712e4763b72d65e81b in WAF project code).

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agolib/mscat: fix logging in wscript
Alexander Bokovoy [Mon, 3 Sep 2018 09:51:59 +0000 (12:51 +0300)]
lib/mscat: fix logging in wscript

13 months agolib/audit_logging: update to waf 2.0
Alexander Bokovoy [Thu, 5 Jul 2018 11:26:57 +0000 (14:26 +0300)]
lib/audit_logging: update to waf 2.0

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>