samba.git
5 years agobuildtools/wafsamba: undefine a define for a failed test unless asked to keep it
Alexander Bokovoy [Fri, 7 Sep 2018 14:34:48 +0000 (14:34 +0000)]
buildtools/wafsamba: undefine a define for a failed test unless asked to keep it

If conf.CHECK_CODE() is called without `always=True` and the test has
failed, undefine the define already set to '0' by conf.check_code().

This restores expectations that undefined symbols are not considered to
be set by CONFIG_SET() method.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoRevert "wafsamba/samba_autoconf: when setting undefined result, use empty tuple"
Stefan Metzmacher [Mon, 10 Sep 2018 08:22:16 +0000 (10:22 +0200)]
Revert "wafsamba/samba_autoconf: when setting undefined result, use empty tuple"

This reverts commit 95ba6b97441b75f28aef5ec1ee5a9442683f3763.

There was already a better fix under discusion.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoRevert "lib/replace: force to unset defines if check has failed"
Stefan Metzmacher [Mon, 10 Sep 2018 08:22:13 +0000 (10:22 +0200)]
Revert "lib/replace: force to unset defines if check has failed"

This reverts commit 8ec7eb0c0129518557d1f446191860a62ef3ff79.

There was already a better fix under discusion.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoselftext: Mark py3 visualize test as flapping
Douglas Bagnall [Sun, 9 Sep 2018 22:08:41 +0000 (10:08 +1200)]
selftext: Mark py3 visualize test as flapping

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Sep 10 16:51:09 CEST 2018 on sn-devel-144

5 years agos4: torture: Ensure raw notify tests use different directories.
Jeremy Allison [Fri, 7 Sep 2018 22:14:37 +0000 (15:14 -0700)]
s4: torture: Ensure raw notify tests use different directories.

Should help track down flapping tests.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sat Sep  8 11:37:44 CEST 2018 on sn-devel-144

5 years agolib/replace: force to unset defines if check has failed
Alexander Bokovoy [Thu, 6 Sep 2018 09:07:28 +0000 (09:07 +0000)]
lib/replace: force to unset defines if check has failed

For HAVE_WORKING_STRPTIME and HAVE_INCOHERENT_MMAP we always want to
have their defines unset as the code is using '#ifdef' rather than just
'#if'. Setting them to 0 means #ifdef will succeed due to a difference
how '#ifdef' and '#if' are working.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years 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.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agospoolss-iremotewinspool-tests: Use more recent client OS version
Justin Stephenson [Fri, 31 Aug 2018 19:28:36 +0000 (15:28 -0400)]
spoolss-iremotewinspool-tests: Use more recent client OS version

Set torture test client info build, major, and minor
version numbers to Windows 7 and Windows Server 2008 R2 values

 buildnum: 7007
 major: 6
 minor: 1

Build number taken from
 [MS-RPRN] <168> Section 2.2.3.10.1

Major/Minor numbers taken from
 https://docs.microsoft.com/en-us/windows/desktop/sysinfo/operating-system-version

Signed-off-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Sep  8 04:35:56 CEST 2018 on sn-devel-144

5 years agoiremotewinspool-tests: Add client os build number validation test
Justin Stephenson [Wed, 22 Aug 2018 17:23:18 +0000 (13:23 -0400)]
iremotewinspool-tests: Add client os build number validation test

Add test validating the AsyncOpenPrinter result based on the provided
client info build number

Signed-off-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
5 years agoiremotewinspool-tests: Allow modification of OS client version information
Justin Stephenson [Wed, 15 Aug 2018 15:10:21 +0000 (11:10 -0400)]
iremotewinspool-tests: Allow modification of OS client version information

Add test_get_client_info() function to set and, or modify the client OS
version values advertised in the iremotewinspool torture tests.

The OS build numbers are used from the table in:

  [MS-RPRN] <168> Section 2.2.3.10.1

Signed-off-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
5 years agos3-rpcclient: Use spoolss_init_spoolss_UserLevel1 in winspool cmds
Günther Deschner [Fri, 31 Aug 2018 16:22:04 +0000 (18:22 +0200)]
s3-rpcclient: Use spoolss_init_spoolss_UserLevel1 in winspool cmds

Use spoolss initialization function to set client version information for
iremotewinspool printer operations

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
5 years agos3-rpc_client: Advertise Windows 7 client info
Justin Stephenson [Fri, 31 Aug 2018 17:28:58 +0000 (13:28 -0400)]
s3-rpc_client: Advertise Windows 7 client info

Client printing operations currently fail against Windows
Server 2016 with Access Denied if a client os build number
lower than 6000 is advertised. Increase the default build number,
major, and minor versions to values associated with client
OS versoins Windows 7 and Windows Server 2008 R2.

The build number value specifically needs to be increased to
allow these operations to succeed.

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

Signed-off-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
5 years agos3-spoolss: Make spoolss client os_major,os_minor and os_build configurable.
Günther Deschner [Fri, 31 Aug 2018 15:36:19 +0000 (17:36 +0200)]
s3-spoolss: Make spoolss client os_major,os_minor and os_build configurable.

Similar to spoolss server options, make the client advertised OS version
values configurable to allow overriding the defaults provided to the print server.

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

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
5 years agowafsamba: Fix 'make -j<jobs>'
Andreas Schneider [Thu, 6 Sep 2018 10:40:10 +0000 (12:40 +0200)]
wafsamba: Fix 'make -j<jobs>'

Currently only 'make -j' enables parallel builds and e.g. 'make -j4'
results in no parallel compile jobs at all.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Sep  7 20:24:46 CEST 2018 on sn-devel-144

5 years agoctdb-tests: Fix CTDB -O3 --picky-developer build on CentOS 7
Martin Schwenke [Thu, 6 Sep 2018 06:06:40 +0000 (16:06 +1000)]
ctdb-tests: Fix CTDB -O3 --picky-developer build on CentOS 7

gcc 4.8.5 complains:

[319/381] Compiling ctdb/tests/src/system_socket_test.c
../tests/src/system_socket_test.c: In function ‘test_tcp’:
../tests/src/system_socket_test.c:196:20: error: ‘rst_out’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  assert((rst != 0) == (rst_out != 0));
                    ^
cc1: all warnings being treated as errors

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andreas Schneider <asn@samba.org>
5 years agodbwrap: Remove a pointless "return;"
Volker Lendecke [Fri, 31 Aug 2018 04:09:48 +0000 (06:09 +0200)]
dbwrap: Remove a pointless "return;"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agovfs_fruit: fix an uninitialized variable error
Volker Lendecke [Wed, 5 Sep 2018 09:31:10 +0000 (11:31 +0200)]
vfs_fruit: fix an uninitialized variable error

clang does not recognize "smb_panic" as an "exit()" equivalent

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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>
5 years 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

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

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

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

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

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

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

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