sfrench/samba-autobuild/.git
5 years agopython join: Set index transaction cache size.
Gary Lockyer [Mon, 1 Apr 2019 03:49:38 +0000 (16:49 +1300)]
python join: Set index transaction cache size.

The default value is too small for joining a large domain.  So we specify a
size of 200,000 which is suitable for domains with up to 100,000 users.

At a later date this could be added as a parameter to the join, but
200,000 should be suitable for now.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Apr  4 07:45:03 UTC 2019 on sn-devel-144

5 years agolib ldb key_value: Set index cache size on open
Gary Lockyer [Mon, 1 Apr 2019 03:33:52 +0000 (16:33 +1300)]
lib ldb key_value: Set index cache size on open

Set the default index cache from the passed option
"transaction_index_cache_size" on open.  This allows the default cache
size to be overridden when processing large transactions i.e. joining a
large domain.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb key_value: set the cache size for re-indexing
Gary Lockyer [Mon, 1 Apr 2019 02:28:31 +0000 (15:28 +1300)]
lib ldb key_value: set the cache size for re-indexing

Set the index cache size to the number of records in the databse when
reindexing.

This significantly improves reindex performance.  For a domain with
100,000 users the reindex times are reduced from 17 minutes to 45
seconds.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb key_value: Add get_size method
Gary Lockyer [Mon, 1 Apr 2019 02:27:32 +0000 (15:27 +1300)]
lib ldb key_value: Add get_size method

Add the get_size method to the ldb_key_value layer, this will allow the
reindexing code to get an estimate of the number of records in the
database.

The lmdb backend returns an accurate count of the number of records in
the database withe the mdb_env_stat call.

The tdb backend does not provide a low cost method to determine the
number of records on the database.  It does provide a tdb_summary call
however this this walks the entire database.

So for tdb we use the map size divided by 500, this over estimates the counts
for small domains, but the extra memory allocated for the cache should
not be significant.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb key_value: Pass index cache size
Gary Lockyer [Mon, 1 Apr 2019 01:10:10 +0000 (14:10 +1300)]
lib ldb key_value: Pass index cache size

Pass the index cache size to ldb_kv_index_transaction_start.  This will
allow it to be set for reindex and join operations, where the current
defaults result in a significant performance penalty on large databases.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolib ldb key_value: Remove index cache lazy initialisation
Gary Lockyer [Mon, 1 Apr 2019 00:12:20 +0000 (13:12 +1300)]
lib ldb key_value: Remove index cache lazy initialisation

Remove the lazy initialisation of the index cache. This make setting
the size of the cache for re-indexing easier, which will be done in
later commits.

Performance testing shows that the removal of lazy initialisation makes
no appreciable difference to performance.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoflapping tests: Add samba3.smb2.notify
Gary Lockyer [Wed, 3 Apr 2019 00:03:56 +0000 (13:03 +1300)]
flapping tests: Add samba3.smb2.notify

Add samba3.smb2.notify until Metze gets time to follow it up.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3-libnet_join: allow fallback to NTLMSSP auth in libnet_join
Günther Deschner [Tue, 2 Apr 2019 11:16:55 +0000 (13:16 +0200)]
s3-libnet_join: allow fallback to NTLMSSP auth in libnet_join

When a non-DNS and non-default admin domain is provided during the join
sometimes we might not be able to kinit with 'user@SHORTDOMAINNAME'
(e.g. when the winbind krb5 locator is not installed). In that case lets
fallback to NTLMSSP, like we do in winbind.

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Apr  3 18:57:31 UTC 2019 on sn-devel-144

5 years agos3-libnet_join: setup libnet join error string when AD connect fails
Günther Deschner [Tue, 2 Apr 2019 11:16:11 +0000 (13:16 +0200)]
s3-libnet_join: setup libnet join error string when AD connect fails

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
5 years agos3-libnet_join: always pass down admin domain to ads layer
Günther Deschner [Tue, 2 Apr 2019 11:14:06 +0000 (13:14 +0200)]
s3-libnet_join: always pass down admin domain to ads layer

Otherwise we could loose the information that a non-default domain name
has been used for admin creds.

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
5 years agorpc: Fix a typo
Volker Lendecke [Mon, 1 Apr 2019 19:14:05 +0000 (21:14 +0200)]
rpc: Fix a typo

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): Wed Apr  3 17:53:30 UTC 2019 on sn-devel-144

5 years agoauth: Add necessary decoration to auth/auth_util.h
Volker Lendecke [Wed, 3 Apr 2019 10:16:50 +0000 (12:16 +0200)]
auth: Add necessary decoration to auth/auth_util.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agorpc: Don't crash if npa_accept fails
Volker Lendecke [Tue, 2 Apr 2019 14:37:39 +0000 (16:37 +0200)]
rpc: Don't crash if npa_accept fails

We can only rely on session_info_transport to be filled correctly upon
success of the accept_existing_recv function

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopython/samba: ignore encoding errors while reading files
Philipp Gesang [Tue, 12 Mar 2019 14:43:42 +0000 (15:43 +0100)]
python/samba: ignore encoding errors while reading files

Provisioning fails on C locale due to the Unicode quotes in ldif
data. Patch read_and_sub_file() to read the files as UTF-8.

Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Wed Apr  3 11:33:38 UTC 2019 on sn-devel-144

5 years agoprovision: use ASCII quotes
Philipp Gesang [Tue, 12 Mar 2019 14:51:16 +0000 (15:51 +0100)]
provision: use ASCII quotes

Remove some Unicode quotes that cause problems under the C
locale.

Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agolib:util: Include talloc_keep_secret.h in samba_util.h
Andreas Schneider [Tue, 19 Mar 2019 11:31:42 +0000 (12:31 +0100)]
lib:util: Include talloc_keep_secret.h in samba_util.h

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Apr  3 07:50:03 UTC 2019 on sn-devel-144

5 years agolib:util: Add test for talloc_keep_secret()
Andreas Schneider [Tue, 19 Mar 2019 10:18:47 +0000 (11:18 +0100)]
lib:util: Add test for talloc_keep_secret()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
5 years agolib:util: Add support to keep talloc chunks secret
Andreas Schneider [Tue, 19 Mar 2019 09:57:54 +0000 (10:57 +0100)]
lib:util: Add support to keep talloc chunks secret

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
5 years agooLschema2ldif: Resolve multiple parsing bugs
Michael Hanselmann [Wed, 27 Mar 2019 19:17:08 +0000 (20:17 +0100)]
oLschema2ldif: Resolve multiple parsing bugs

The "oLschema2ldif" program contained multiple bugs triggered by
malformed inputs:

* Iteration beyond list of recognized dsdb syntax OIDs when value wasn't
  found (bug 9567)
* NULL pointer dereference when input didn't define a name
* Heap buffer overflows for unterminated token values

Tests are added to reproduce all identified bugs.

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

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Then adapted to use ARRAY_SIZE() consistently as suggested by
metze.

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Apr  3 02:43:07 UTC 2019 on sn-devel-144

5 years agoRelax GPGME version check
Mathieu Parent [Fri, 24 Aug 2018 04:51:04 +0000 (06:51 +0200)]
Relax GPGME version check

The current method require at least the same version as during the build. This is not needed.

Used symbols indicate the minimum is 1.2.0

Bug-Debian: http://bugs.debian.org/886333

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

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agoprefork tests: disable restart tests MIT
Gary Lockyer [Wed, 27 Mar 2019 00:52:37 +0000 (13:52 +1300)]
prefork tests: disable restart tests MIT

The prefork restart tests use the kdc to test restart back off.  These
tests need to use a process that has not been restarted to ensure that
the process restart counters are sitting at 0 when the tests start.

As MIT kerberos is experimental the heimdal builds will still ensure
that this functionality is tested.

At some stage the echo server should be converted to run in pre-fork and
this process can then be used to test the restart backoff.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agos4:rpc_server: add missing newline to error debug message
Björn Baumbach [Fri, 29 Mar 2019 15:36:03 +0000 (16:36 +0100)]
s4:rpc_server: add missing newline to error debug message

Signed-off-by: Björn Baumbach <bb@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr  3 00:13:10 UTC 2019 on sn-devel-144

5 years agowaf: Simplify condition for undefined symbol detection
Michael Hanselmann [Fri, 22 Mar 2019 23:14:52 +0000 (00:14 +0100)]
waf: Simplify condition for undefined symbol detection

There's no need to check for OpenBSD twice.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Tue Apr  2 17:28:40 UTC 2019 on sn-devel-144

5 years agosamba_dnsupdate: small tweaks to make code more pythonic
Joe Guo [Wed, 27 Mar 2019 02:21:14 +0000 (15:21 +1300)]
samba_dnsupdate: small tweaks to make code more pythonic

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
5 years agomake some auth functions return an NTSTATUS like other similar functions for better...
Kristján Valur [Tue, 12 Mar 2019 09:33:15 +0000 (09:33 +0000)]
make some auth functions return an NTSTATUS like other similar functions for better diagnostics.

Signed-off-by: Kristján Valur <kristjan@rvx.is>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Apr  2 02:12:48 UTC 2019 on sn-devel-144

5 years agoSpelling fixes s/verson/version/
Mathieu Parent [Mon, 25 Mar 2019 14:22:55 +0000 (15:22 +0100)]
Spelling fixes s/verson/version/

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoSpelling fixes s/conficts/conflicts/
Mathieu Parent [Mon, 25 Mar 2019 14:22:49 +0000 (15:22 +0100)]
Spelling fixes s/conficts/conflicts/

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoSpelling fixes s/overrided/overridden/
Mathieu Parent [Mon, 25 Mar 2019 14:20:44 +0000 (15:20 +0100)]
Spelling fixes s/overrided/overridden/

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agoSpelling fix s/informations/information/
Mathieu Parent [Mon, 25 Mar 2019 14:02:45 +0000 (15:02 +0100)]
Spelling fix s/informations/information/

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
5 years agos3:ldap: Leave add machine code early for pre-existing accounts
Guenther Deschner [Mon, 1 Apr 2019 15:40:03 +0000 (17:40 +0200)]
s3:ldap: Leave add machine code early for pre-existing accounts

This avoids numerous LDAP constraint violation errors when we try to
re-precreate an already existing machine account.

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

Pair-Programmed-With: Andreas Schneider <asn@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:libads: Make sure we can lookup KDCs which are not configured
Andreas Schneider [Mon, 1 Apr 2019 14:47:26 +0000 (16:47 +0200)]
s3:libads: Make sure we can lookup KDCs which are not configured

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

Pair-Programmed-With: Guenther Deschner <gd@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:libnet: Use more secure name for the JOIN krb5.conf
Andreas Schneider [Mon, 1 Apr 2019 14:39:45 +0000 (16:39 +0200)]
s3:libnet: Use more secure name for the JOIN krb5.conf

Currently we create krb5.conf..JOIN, use krb5.conf._JOIN_ instead.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoauth:creds: Prefer the principal over DOMAIN/username when using NTLM
Andreas Schneider [Mon, 1 Apr 2019 13:59:10 +0000 (15:59 +0200)]
auth:creds: Prefer the principal over DOMAIN/username when using NTLM

If we want to authenticate using -Wadmin@otherdomain the DC should do
take care of the authentication with the right DC for us.

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

Pair-Programmed-With: Guenther Deschner <gd@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoauth:ntlmssp: Add back CRAP ndr debug output
Guenther Deschner [Wed, 27 Mar 2019 16:51:04 +0000 (17:51 +0100)]
auth:ntlmssp: Add back CRAP ndr debug output

This got lost somehow during refactoring. This is still viable
information when trying to figure out what is going wrong when
authenticating a user over NTLMSSP.

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

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:libnet: Fix debug message in libnet_DomainJoin()
Guenther Deschner [Mon, 1 Apr 2019 15:46:39 +0000 (17:46 +0200)]
s3:libnet: Fix debug message in libnet_DomainJoin()

A newline is missing but also use DBG_INFO macro and cleanup spelling.

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:libsmb: Add some useful debug output to cliconnect
Andreas Schneider [Wed, 27 Mar 2019 15:45:39 +0000 (16:45 +0100)]
s3:libsmb: Add some useful debug output to cliconnect

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:libads: Print more information when LDAP fails
Andreas Schneider [Fri, 29 Mar 2019 10:34:53 +0000 (11:34 +0100)]
s3:libads: Print more information when LDAP fails

Currently we just get an error but don't know what exactly we tried to
do in 'net ads join -d10'.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolibsmb: Make cli_posix_chown/chmod proper tevent_req functions
Volker Lendecke [Fri, 29 Mar 2019 08:50:31 +0000 (09:50 +0100)]
libsmb: Make cli_posix_chown/chmod proper tevent_req functions

This prepares for making them smb2-aware

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): Mon Apr  1 19:00:11 UTC 2019 on sn-devel-144

5 years agolibsmb: Make "struct smb2_lock_element" generally usable
Volker Lendecke [Mon, 25 Mar 2019 14:43:49 +0000 (15:43 +0100)]
libsmb: Make "struct smb2_lock_element" generally usable

This struct will be of interest when we add locking capabilities to
libcli/smb/smb2cli*

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agolibsmb: Rename InfoType from [MS-SMB2] according to the spec
Volker Lendecke [Fri, 29 Mar 2019 10:08:12 +0000 (11:08 +0100)]
libsmb: Rename InfoType from [MS-SMB2] according to the spec

This makes it easier to find this via internet search

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agoctdb-scripts: Do not "correct" number of nfsd threads when it is 0
Martin Schwenke [Tue, 26 Mar 2019 03:15:33 +0000 (14:15 +1100)]
ctdb-scripts: Do not "correct" number of nfsd threads when it is 0

While 0 may indicate that all threads have exited after being stuck,
it may also indicate that nfsd should not be running due to being shut
down.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Sun Mar 31 11:47:44 UTC 2019 on sn-devel-144

5 years agoctdb-scripts: Update statd-callout to try several configuration files
Martin Schwenke [Wed, 20 Mar 2019 10:22:43 +0000 (21:22 +1100)]
ctdb-scripts: Update statd-callout to try several configuration files

The alternative seems to be to try something via CTDB_NFS_CALLOUT.
That would be complicated and seems like overkill for something this
simple.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
5 years agoctdb-scripts: Allow load_system_config() to take multiple alternatives
Martin Schwenke [Wed, 20 Mar 2019 10:19:49 +0000 (21:19 +1100)]
ctdb-scripts: Allow load_system_config() to take multiple alternatives

The situation for NFS config has got more complicated and is probably
broken in statd-callout on Debian-like systems at the moment.  Allow
several alternative configuration names to be tried.  Stop after the
first that is found and loaded.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
5 years agoctdb-scripts: Default to using systemd services in NFS call-out
Martin Schwenke [Tue, 26 Mar 2019 04:05:58 +0000 (15:05 +1100)]
ctdb-scripts: Default to using systemd services in NFS call-out

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
5 years agoctdb-tests: Update NFS test infrastructure to support systemd services
Martin Schwenke [Tue, 26 Mar 2019 04:07:43 +0000 (15:07 +1100)]
ctdb-tests: Update NFS test infrastructure to support systemd services

The tests are written around the default of sysvinit-redhat.  Add
support for systemd-redhat.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
5 years agoctdb-scripts: Add systemd services to NFS call-out
Martin Schwenke [Wed, 20 Mar 2019 06:45:10 +0000 (17:45 +1100)]
ctdb-scripts: Add systemd services to NFS call-out

At least Red Hat and Debian appear to use (a variant of?) the upstream
systemd units for NFS, so adding support for these services is
relatively easy.  Distributions using Sys-V init can patch the
call-out to use the relevant Sys-V init services.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
5 years agoctdb-scripts: Start NFS quota service if defined
Martin Schwenke [Thu, 21 Mar 2019 04:30:00 +0000 (15:30 +1100)]
ctdb-scripts: Start NFS quota service if defined

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
5 years agoctdb-scripts: Stop/start mount/rquotad/status via NFS call-out
Martin Schwenke [Wed, 20 Mar 2019 06:35:44 +0000 (17:35 +1100)]
ctdb-scripts: Stop/start mount/rquotad/status via NFS call-out

When an NFS check restarts a failed service by hand then systemd will
be unable to stop or start this service again because (at least) the
PID file will be wrong.  Do this via the NFS Linux kernel call-out
instead.  Allow the call-out to use the services instead of doing
manual restarts.  Add variables for mount, status and rquotad services
to support this.

Adding systemd NFS services to the call-out will follow.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
5 years agoctdb-scripts: Factor out nfs_load_config()
Martin Schwenke [Wed, 20 Mar 2019 05:11:32 +0000 (16:11 +1100)]
ctdb-scripts: Factor out nfs_load_config()

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
5 years agoctdb-scripts: Add test variable CTDB_NFS_DISTRO_STYLE
Martin Schwenke [Tue, 26 Mar 2019 03:49:49 +0000 (14:49 +1100)]
ctdb-scripts: Add test variable CTDB_NFS_DISTRO_STYLE

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
5 years agoctdb-scripts: Rename variable nfslock_service to nfs_lock_service
Martin Schwenke [Wed, 20 Mar 2019 03:50:59 +0000 (14:50 +1100)]
ctdb-scripts: Rename variable nfslock_service to nfs_lock_service

There will be more of these variable for other services so, for
readability, it makes sense for them to start with "nfs_".

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
5 years agoctdb-scripts: Reindent some functions prior to making changes
Martin Schwenke [Mon, 18 Mar 2019 03:42:36 +0000 (14:42 +1100)]
ctdb-scripts: Reindent some functions prior to making changes

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
5 years agolibcli: permit larger values of DataLength in SMB2_ENCRYPTION_CAPABILITIES of negotia...
Philipp Gesang [Thu, 14 Feb 2019 09:17:28 +0000 (10:17 +0100)]
libcli: permit larger values of DataLength in SMB2_ENCRYPTION_CAPABILITIES of negotiate response

Certain Netapp versions are sending SMB2_ENCRYPTION_CAPABILITIES
structures containing DataLength field that includes the padding
[0]. Microsoft has since clarified that only values smaller than
the size are considered invalid [1].

While parsing the NegotiateContext it is ensured that DataLength
does not exceed the message bounds. Also, the value is not
actually used anywhere outside the validation. Thus values
greater than the actual data size are safe to use. This patch
makes Samba fail only on values that are too small for the (fixed
size) payload.

[0] https://lists.samba.org/archive/samba/2019-February/221139.html
[1] https://lists.samba.org/archive/cifs-protocol/2019-March/003210.html

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

Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com>
Reviewed-by: Ralph Böhme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Mar 31 01:11:09 UTC 2019 on sn-devel-144

5 years agodoc: add missing "samba-tool ou" entry
Björn Baumbach [Thu, 28 Mar 2019 14:26:36 +0000 (15:26 +0100)]
doc: add missing "samba-tool ou" entry

Signed-off-by: Björn Baumbach <bbaumbach@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Sat Mar 30 23:33:39 UTC 2019 on sn-devel-144

5 years agodoc: add missing "samba-tool computer" entry
Björn Baumbach [Thu, 28 Mar 2019 14:25:01 +0000 (15:25 +0100)]
doc: add missing "samba-tool computer" entry

Signed-off-by: Björn Baumbach <bbaumbach@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agodoc: fix typos in samba-tool documentation
Björn Baumbach [Thu, 28 Mar 2019 14:18:49 +0000 (15:18 +0100)]
doc: fix typos in samba-tool documentation

Signed-off-by: Björn Baumbach <bbaumbach@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agodoc: add missing samba-tool user edit documentation
Björn Baumbach [Thu, 28 Mar 2019 14:02:08 +0000 (15:02 +0100)]
doc: add missing samba-tool user edit documentation

Signed-off-by: Björn Baumbach <bbaumbach@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agosamba-tool: fix some typos
Björn Baumbach [Thu, 28 Mar 2019 16:24:40 +0000 (17:24 +0100)]
samba-tool: fix some typos

All command descriptions have a dot '.' at the end.
The ou and visualize command need this too.

  ...
  group       - Group management.
  ldapcmp     - Compare two ldap databases.
  ntacl       - NT ACLs manipulation.
  ou          - Organizational Units (OU) management
  ...
  user        - User management.
  visualize   - Produces graphical representations of Samba network state

Signed-off-by: Björn Baumbach <bb@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agoselftest: use test smb.conf in provision
Douglas Bagnall [Fri, 29 Mar 2019 01:12:49 +0000 (14:12 +1300)]
selftest: use test smb.conf in provision

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Tim Beale <timbeale@catalyst.net.nz>
5 years agoacl_read: Fix regression caused by db15fcfa899e1fe4d6994f68ceb299921b8aa6f1 for empty...
Garming Sam [Tue, 12 Mar 2019 21:52:19 +0000 (10:52 +1300)]
acl_read: Fix regression caused by db15fcfa899e1fe4d6994f68ceb299921b8aa6f1 for empty lists

The original code never dereferenced attrs and only added "*" if attrs
was NULL (not if attrs[0] was NULL).

This causes significant performance issues with the new paged_results
module introduced for 4.10 as the initial GUID search requests no
attributes. This GUID search turns into a search for "*" and ends up
allocating memory for the entire database.

This never appears to cause changes in the final result set, only
intermediate processing.

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

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Mar 29 18:37:29 UTC 2019 on sn-devel-144

5 years agoldb: cmocka test for empty attributes bug
Aaron Haslett [Mon, 25 Mar 2019 00:13:33 +0000 (13:13 +1300)]
ldb: cmocka test for empty attributes bug

Cmocka test exposing LDB bug where a request with an empty attributes
list returns a response containing all attributes.  The bug is in the
ACL module and will be fixed in the next commit.

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

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agopaged_search: perf testing paged search
Aaron Haslett [Thu, 28 Mar 2019 02:03:17 +0000 (15:03 +1300)]
paged_search: perf testing paged search

Adding medley performance run with paged search module.

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

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:smbd: fix max_buffer handling of initial notify requests
Stefan Metzmacher [Wed, 16 Jan 2019 20:29:51 +0000 (21:29 +0100)]
s3:smbd: fix max_buffer handling of initial notify requests

The max_buffer value is only evaluated on the first notify
request on a directory handle.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Mar 29 00:35:39 UTC 2019 on sn-devel-144

5 years agos4:torture/smb2: replace torture:cn_max_buffer_size option with the negotiated max...
Stefan Metzmacher [Tue, 8 Jan 2019 15:22:25 +0000 (16:22 +0100)]
s4:torture/smb2: replace torture:cn_max_buffer_size option with the negotiated max trans size

Both:

 smbtorture //w2012r2-188/torture -Ua%b smb2.notify.valid-req --smb-ports=139

and:

 smbtorture //w2012r2-188/torture -Ua%b smb2.notify.valid-req --smb-ports=445

work against Windows 2008R2, 2012R2 and 2016 now and it reflects what
we have implemented in Samba.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:torture/smb2/notify: make use of torture_setup_simple_file() in test_valid_request()
Stefan Metzmacher [Fri, 15 Feb 2019 14:30:29 +0000 (15:30 +0100)]
s4:torture/smb2/notify: make use of torture_setup_simple_file() in test_valid_request()

There's no reason to use torture_setup_complex_file(), when we want to
test notify code. The test pass fine against Samba this way and don't
fail because of unrelated timestamp behavior.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:torture/smb2: add smb2_create_simple_file() and torture_setup_simple_file()
Stefan Metzmacher [Tue, 12 Feb 2019 15:51:20 +0000 (16:51 +0100)]
s4:torture/smb2: add smb2_create_simple_file() and torture_setup_simple_file()

Instead of the *_complex_file() versions these don't use EA's nor
complex timestamps.

A lot of tests currently using *_complex_file() only fail because
smbd doesn't implement the correct 'change_time' update behavior.
That should not be the reason why all smb2 related tests fail.

Timestamps should be tested in dedicated tests.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:libcli/smb2: calculate the correct credit charge in smb2_notify_send()
Stefan Metzmacher [Tue, 8 Jan 2019 09:10:49 +0000 (10:10 +0100)]
s4:libcli/smb2: calculate the correct credit charge in smb2_notify_send()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:libcli/smb2: calculate the correct credit charge in smb2_ioctl_send()
Stefan Metzmacher [Tue, 8 Jan 2019 15:13:41 +0000 (16:13 +0100)]
s4:libcli/smb2: calculate the correct credit charge in smb2_ioctl_send()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:libcli/smb2: align struct smb_ioctl.smb2 to [MS-SMB2] names
Stefan Metzmacher [Tue, 8 Jan 2019 14:52:35 +0000 (15:52 +0100)]
s4:libcli/smb2: align struct smb_ioctl.smb2 to [MS-SMB2] names

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:libcli/smb2: calculate the correct credit charge in smb2_getinfo_send()
Stefan Metzmacher [Tue, 8 Jan 2019 15:11:15 +0000 (16:11 +0100)]
s4:libcli/smb2: calculate the correct credit charge in smb2_getinfo_send()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:libcli/smb2: fix smb2_getinfo_send() marshalling
Stefan Metzmacher [Tue, 8 Jan 2019 15:09:46 +0000 (16:09 +0100)]
s4:libcli/smb2: fix smb2_getinfo_send() marshalling

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmb2_server: grant all 8192 credits to clients
Stefan Metzmacher [Wed, 16 Jan 2019 11:24:04 +0000 (12:24 +0100)]
smb2_server: grant all 8192 credits to clients

This seems to match Windows Server 2016.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agovfs_default: fix vfswrap_offload_write_send() NT_STATUS_INVALID_VIEW_SIZE check
Stefan Metzmacher [Tue, 31 Jul 2018 10:29:29 +0000 (12:29 +0200)]
vfs_default: fix vfswrap_offload_write_send() NT_STATUS_INVALID_VIEW_SIZE check

This fixes a regression introduced in commit
60e45a2d25401eaf9a15a86d19114670ccfde259, where the 'num' variable
was renamed to 'to_copy', but a new 'num' variable was introduced.

Note that off_t is signed!
In future we need to watch out for filesystems supporting
FMODE_UNSIGNED_OFFSET on Linux. Which means they use it unsigned.

This is more or less a theoretical problem, The
NT_STATUS_INVALID_PARAMETER cases are catched before by
SMB_VFS_PREAD_SEND/RECV.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agovfs_default: fix DEBUG messages in vfswrap_offload_write_*_done()
Stefan Metzmacher [Wed, 27 Mar 2019 11:43:32 +0000 (12:43 +0100)]
vfs_default: fix DEBUG messages in vfswrap_offload_write_*_done()

SMB_VFS_{PREAD,PWRITE}_RECV() don't set errno, so we need to
use strerror(aio_state.error) in the debug messages.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmb2_tcon: avoid STATUS_PENDING completely on tdis
Stefan Metzmacher [Tue, 12 Feb 2019 07:27:43 +0000 (08:27 +0100)]
smb2_tcon: avoid STATUS_PENDING completely on tdis

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmb2_sesssetup: avoid STATUS_PENDING completely on session logoff
Stefan Metzmacher [Tue, 12 Feb 2019 07:27:43 +0000 (08:27 +0100)]
smb2_sesssetup: avoid STATUS_PENDING completely on session logoff

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmb2_tcon: avoid STATUS_PENDING responses for tree connect
Stefan Metzmacher [Thu, 24 Jan 2019 08:10:11 +0000 (09:10 +0100)]
smb2_tcon: avoid STATUS_PENDING responses for tree connect

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmb2_sesssetup: avoid STATUS_PENDING responses for session setup
Stefan Metzmacher [Thu, 24 Jan 2019 08:10:11 +0000 (09:10 +0100)]
smb2_sesssetup: avoid STATUS_PENDING responses for session setup

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12845
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13698
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13796

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmb2_server: allow smbd_smb2_request_pending_queue(0) to avoid STATUS_PENDING
Stefan Metzmacher [Tue, 12 Feb 2019 07:08:38 +0000 (08:08 +0100)]
smb2_server: allow smbd_smb2_request_pending_queue(0) to avoid STATUS_PENDING

This has the same meaning as smb2_request_set_async_internal(),
but this will simplifies callers.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmb2_ioctl_network_fs: remove unused fsctl_srv_copychunk_state->aapl_copyfile
Stefan Metzmacher [Tue, 31 Jul 2018 10:29:29 +0000 (12:29 +0200)]
smb2_ioctl_network_fs: remove unused fsctl_srv_copychunk_state->aapl_copyfile

This is not used since commit 74e018f476608429caa1c3594102485ccc17afce.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos3:smbd: handle IO_REPARSE_TAG_DFS in SMB_FIND_FILE_FULL_DIRECTORY_INFO
Stefan Metzmacher [Mon, 9 Oct 2017 10:06:29 +0000 (12:06 +0200)]
s3:smbd: handle IO_REPARSE_TAG_DFS in SMB_FIND_FILE_FULL_DIRECTORY_INFO

This completes commit 74829fecd7a4e806ee441cd75141bede2eefef1a,
which missed SMB_FIND_FILE_FULL_DIRECTORY_INFO

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos3:smbd: fix SAFE_FREE() vs. TALLOC_FREE() in list_sessions()
Stefan Metzmacher [Tue, 28 Nov 2017 07:16:03 +0000 (08:16 +0100)]
s3:smbd: fix SAFE_FREE() vs. TALLOC_FREE() in list_sessions()

It's very unlikely that sessionid_traverse_read() fails,
but we should not segfault.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos3:smb2_write: add missing initialization of state->in_offset
Stefan Metzmacher [Thu, 5 Oct 2017 13:59:23 +0000 (15:59 +0200)]
s3:smb2_write: add missing initialization of state->in_offset

This is just used in DEBUG messages, but still confusing.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agos4:torture/smb2: test_notify_tcp_dis trigger idle event every 0.25s
Stefan Metzmacher [Sun, 17 Feb 2013 21:45:32 +0000 (22:45 +0100)]
s4:torture/smb2: test_notify_tcp_dis trigger idle event every 0.25s

This is 1000 times longer than before and is less likely to
change the timing behavior when running under valgrind.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agos4:torture/raw: test_notify_tcp_dis trigger idle event every 0.25s
Stefan Metzmacher [Sun, 17 Feb 2013 21:43:49 +0000 (22:43 +0100)]
s4:torture/raw: test_notify_tcp_dis trigger idle event every 0.25s

This is 1000 times longer than before and is less likely to
change the timing behavior when running under valgrind.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:libcli/smb2: don't schedule idle handlers on a dead connection
Stefan Metzmacher [Sun, 17 Feb 2013 21:41:00 +0000 (22:41 +0100)]
s4:libcli/smb2: don't schedule idle handlers on a dead connection

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:libcli/raw: don't schedule idle handlers on a dead connection
Stefan Metzmacher [Sun, 17 Feb 2013 21:39:40 +0000 (22:39 +0100)]
s4:libcli/raw: don't schedule idle handlers on a dead connection

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agovfs_snapper: drop unneeded fstat handler
David Disseldorp [Mon, 25 Mar 2019 17:06:15 +0000 (18:06 +0100)]
vfs_snapper: drop unneeded fstat handler

fstat is handle based, and unlike vfs_shadow_copy2, we don't need to
make any changes to the returned sbuf, so remove the existing handler
which does nothing.

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

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Mar 27 18:21:38 UTC 2019 on sn-devel-144

5 years agos3:tests: Add test for smbstatus and smbstatus --resolve_uids
Andreas Schneider [Wed, 13 Mar 2019 11:00:27 +0000 (12:00 +0100)]
s3:tests: Add test for smbstatus and smbstatus --resolve_uids

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Mar 27 14:33:35 UTC 2019 on sn-devel-144

5 years agoselftest: Add smbstatus to testhelper
Andreas Schneider [Wed, 13 Mar 2019 11:00:11 +0000 (12:00 +0100)]
selftest: Add smbstatus to testhelper

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:utils: Add 'smbstatus -L --resolve-uids' to show usernames
Andreas Schneider [Mon, 18 Feb 2019 13:11:32 +0000 (14:11 +0100)]
s3:utils: Add 'smbstatus -L --resolve-uids' to show usernames

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos4/torture: Update winsreplication to only use IPv4 addresses
Tim Beale [Tue, 26 Mar 2019 05:06:16 +0000 (18:06 +1300)]
s4/torture: Update winsreplication to only use IPv4 addresses

This test was failing now that the client had an IPv6 address, however,
the test was marked as flapping so this failure wasn't obvious.

Use iface_list_n_is_v4() to filter out only the IPv4 addresses, as
that's all the test cares about.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoselftest: Restore IPs 12-16 for selftest client
Tim Beale [Mon, 18 Mar 2019 04:55:39 +0000 (17:55 +1300)]
selftest: Restore IPs 12-16 for selftest client

The assumption that tests only used the .11 IP was wrong. The
winsreplication test tries to use multiple different IPs - CI doesn't
fail when we remove the additional IPs, but it starts to skip test
cases.

+ Update get_interfaces_config() and get_ipv4_addr() so we can add
multiple different IPs for the same host.
+ Update selftest.pl so the client gets 6 IP addresses.
+ Update comments to better reflect this dependency.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolibsmb: Change cli_posix_readlink to return talloc'ed target
Volker Lendecke [Tue, 26 Mar 2019 08:48:16 +0000 (09:48 +0100)]
libsmb: Change cli_posix_readlink to return talloc'ed target

This is a deviation from the Posix readlink function that from my
point of view makes this function easier to use. In Posix, probably
the assumption is that readlink is cheap, so someone under memory
constraints could just start with a small buffer and incrementally
increase the buffer size. For us, it's a network round-trip, and we
have the luxury of [mt]alloc, which the syscall kernel interface does
not have.

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): Wed Mar 27 12:31:37 UTC 2019 on sn-devel-144

5 years agolibsmb: Don't pass "cli" to cli_posix_readlink_recv
Volker Lendecke [Mon, 25 Mar 2019 11:32:07 +0000 (12:32 +0100)]
libsmb: Don't pass "cli" to cli_posix_readlink_recv

From my point of view the option to change "cli" between
cli_posix_readlink_send and _recv is not necessary.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agolibsmb: Rename "readlink_state" to "cli_posix_readlink_state"
Volker Lendecke [Mon, 25 Mar 2019 11:26:37 +0000 (12:26 +0100)]
libsmb: Rename "readlink_state" to "cli_posix_readlink_state"

This is more in line with most other users of tevent_req: The state is
called fully after the routines it acts as a state repository for.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agolibsmb: Fix valgrind errors in cli_smb2_get_reparse_point
Volker Lendecke [Tue, 26 Mar 2019 09:56:27 +0000 (10:56 +0100)]
libsmb: Fix valgrind errors in cli_smb2_get_reparse_point

Both tevent_req_nterror and tevent_req_is_nterror invalidate
"state". Pull the variables out of "state" before calling those two
functions.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agolib: Make fd_load work for non-regular files
Volker Lendecke [Thu, 21 Feb 2019 17:37:08 +0000 (18:37 +0100)]
lib: Make fd_load work for non-regular files

Follow-up to

https://lists.samba.org/archive/samba/2018-September/217992.html

and following. This also fixes a small and very theoretical race: Between the
fstat and the read call the file size might change. This would make us fail on
potentially legitimate files.

This is more complex and probably slower, but looking at the use cases I don't
think the speed matters.

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Mar 26 04:43:40 UTC 2019 on sn-devel-144

5 years agolibsmb: Fix cli_smb2_get_reparse_point_fnum_send
Volker Lendecke [Mon, 25 Mar 2019 08:11:51 +0000 (09:11 +0100)]
libsmb: Fix cli_smb2_get_reparse_point_fnum_send

Use the correct state variable type

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agopytalloc: Check for errors during module initialization.
Kristján Valur [Wed, 6 Mar 2019 14:08:40 +0000 (14:08 +0000)]
pytalloc: Check for errors during module initialization.

Signed-off-by: Kristján Valur <kristjan@rvx.is>
Reviewed-by: Noel Power <npower@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>