samba.git
3 years agotdb mutex check: Fix CID 1358473 Uninitialized scalar variable
Volker Lendecke [Tue, 12 Apr 2016 05:49:40 +0000 (07:49 +0200)]
tdb mutex check: Fix CID 1358473 Uninitialized scalar variable

This comes via a "goto cleanup" before suspend_mask is initialized

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Autobuild-User(master): Uri Simchoni <uri@samba.org>
Autobuild-Date(master): Tue Apr 12 11:39:35 CEST 2016 on sn-devel-144

3 years agotdb: version 1.3.9 tdb-1.3.9
Stefan Metzmacher [Tue, 29 Mar 2016 16:01:32 +0000 (18:01 +0200)]
tdb: version 1.3.9

* avoid a race condition when checking for robust mutexes
  (bug #11808)
* Remove use of strcpy in tdb test.
* eliminate deprecation warnings in python tests
* Only set public headers field when installing as a public library.
* Refuse to load a database with hash size 0
* Fix various spelling errors

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Apr 11 18:48:26 CEST 2016 on sn-devel-144

3 years agotdb: rework cleanup logic in tdb_runtime_check_for_robust_mutexes()
Uri Simchoni [Tue, 29 Mar 2016 18:36:17 +0000 (21:36 +0300)]
tdb: rework cleanup logic in tdb_runtime_check_for_robust_mutexes()

The cleanup logic used six goto lables, at least I'm not able to make
sane modifications to such a beast.

By using state flags that track which objects are initialized and need
cleanup, we get rid of the goto labels. It comes at a cost though: you
have to be careful to correctly set the cleanup flags.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
3 years agovfs_catia: Fix bug 11827, memleak
Volker Lendecke [Sun, 10 Apr 2016 10:51:15 +0000 (12:51 +0200)]
vfs_catia: Fix bug 11827, memleak

add_srt should add the mappings to the linked list even if
mappings==NULL (the default)

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11827
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Apr 11 14:25:59 CEST 2016 on sn-devel-144

3 years agovfs_catia: Align loop index with terminator
Volker Lendecke [Sun, 10 Apr 2016 11:09:29 +0000 (13:09 +0200)]
vfs_catia: Align loop index with terminator

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agoexamples/smb.conf.default: Fix typo in comment line: sever -> server
Santiago Vila [Fri, 8 Apr 2016 11:05:56 +0000 (13:05 +0200)]
examples/smb.conf.default: Fix typo in comment line: sever -> server

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

Signed-off-by: Santiago Vila <sanvila@debian.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Apr  9 02:35:23 CEST 2016 on sn-devel-144

3 years agos3: libsmb: Fix error where short name length was read as 2 bytes, should be 1.
Jeremy Allison [Tue, 5 Apr 2016 20:07:06 +0000 (13:07 -0700)]
s3: libsmb: Fix error where short name length was read as 2 bytes, should be 1.

Reported by Thomas Dvorachek <tdvorachek@yahoo.com> from a Windows 10 server.
Confirmed in MS-CIFS 2.2.8.1.7.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr  6 03:46:55 CEST 2016 on sn-devel-144

3 years agoselftest: Load time_audit and full_audit
Christof Schmitt [Fri, 1 Apr 2016 05:31:19 +0000 (22:31 -0700)]
selftest: Load time_audit and full_audit

This triggers the check for missing VFS functions in these modules.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_time_audit: Assert that all VFS functions are implemented
Christof Schmitt [Fri, 1 Apr 2016 05:30:41 +0000 (22:30 -0700)]
vfs_time_audit: Assert that all VFS functions are implemented

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_full_audit: Assert that all VFS functions are implemented
Christof Schmitt [Fri, 1 Apr 2016 05:30:14 +0000 (22:30 -0700)]
vfs_full_audit: Assert that all VFS functions are implemented

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs: Add helper to check for missing VFS functions
Christof Schmitt [Fri, 1 Apr 2016 16:47:31 +0000 (09:47 -0700)]
vfs: Add helper to check for missing VFS functions

Some VFS modules want to ensure that they implement all VFS functions.
This helper can be used to detect missing functions in the developer
build.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoconfigure: Don't check for inotify on illumos
Jorge Schrauwen [Sun, 3 Apr 2016 09:43:50 +0000 (11:43 +0200)]
configure: Don't check for inotify on illumos

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11816
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agonwrap: Fix the build on Solaris
Volker Lendecke [Mon, 4 Apr 2016 11:43:02 +0000 (13:43 +0200)]
nwrap: Fix the build on Solaris

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Apr  5 08:57:06 CEST 2016 on sn-devel-144

3 years agos3: vfs: time_audit. Add missing audit_file().
Jeremy Allison [Tue, 5 Apr 2016 00:01:53 +0000 (17:01 -0700)]
s3: vfs: time_audit. Add missing audit_file().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: vfs: time_audit: Add get/fget/set/fset dos_attributes functions.
Jeremy Allison [Mon, 4 Apr 2016 23:57:12 +0000 (16:57 -0700)]
s3: vfs: time_audit: Add get/fget/set/fset dos_attributes functions.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: vfs: time_audit. Add missing fsctl().
Jeremy Allison [Mon, 4 Apr 2016 23:46:56 +0000 (16:46 -0700)]
s3: vfs: time_audit. Add missing fsctl().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: vfs: time_audit. Add missing get_dfs_referrals().
Jeremy Allison [Mon, 4 Apr 2016 23:42:49 +0000 (16:42 -0700)]
s3: vfs: time_audit. Add missing get_dfs_referrals().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: vfs: Sort vfs function entries in vfs_time_audit.
Jeremy Allison [Mon, 4 Apr 2016 23:39:22 +0000 (16:39 -0700)]
s3: vfs: Sort vfs function entries in vfs_time_audit.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: vfs: full_audit. Implement missing durable_XXX functions.
Jeremy Allison [Mon, 4 Apr 2016 23:29:32 +0000 (16:29 -0700)]
s3: vfs: full_audit. Implement missing durable_XXX functions.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: vfs: full_audit. Add audit_file_fn().
Jeremy Allison [Mon, 4 Apr 2016 23:27:05 +0000 (16:27 -0700)]
s3: vfs: full_audit. Add audit_file_fn().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: vfs: full_audit. Add missing fsctl_fn().
Jeremy Allison [Mon, 4 Apr 2016 23:25:47 +0000 (16:25 -0700)]
s3: vfs: full_audit. Add missing fsctl_fn().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: vfs: full_audit. Add missing get_dfs_referrals_fn().
Jeremy Allison [Mon, 4 Apr 2016 23:24:10 +0000 (16:24 -0700)]
s3: vfs: full_audit. Add missing get_dfs_referrals_fn().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3: vfs: full_audit. Sort vfs fn list and add comments on missing entries.
Jeremy Allison [Mon, 4 Apr 2016 23:22:06 +0000 (16:22 -0700)]
s3: vfs: full_audit. Sort vfs fn list and add comments on missing entries.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agolib:replace: Missing semicolon on function definition.
Jeremy Allison [Fri, 1 Apr 2016 23:44:21 +0000 (16:44 -0700)]
lib:replace: Missing semicolon on function definition.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Sat Apr  2 06:04:13 CEST 2016 on sn-devel-144

3 years agoBug 11818 : obvious missing word When trying to demote a dc, 'remove_dc.remove_sysvol...
Rowland Penny [Thu, 31 Mar 2016 12:24:28 +0000 (13:24 +0100)]
Bug 11818 : obvious missing word When trying to demote a dc, 'remove_dc.remove_sysvol_references' is sent 'remote_samdb, dc_name' , it expects 'remote_samdb, logger, dc_name'

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

Signed-off-by: Rowland Penny <rpenny@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Apr  1 22:54:22 CEST 2016 on sn-devel-144

3 years agovfs_gpfs: Remove xattr functions
Christof Schmitt [Wed, 23 Mar 2016 05:43:49 +0000 (22:43 -0700)]
vfs_gpfs: Remove xattr functions

The xattr functions intercepted only the calls from dosmode. With the
implementation of the dos_attribute interface, the xattr codepaths never
get called and can be removed.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_gpfs: Implement new dos_attributes vfs functions
Christof Schmitt [Wed, 23 Mar 2016 05:39:11 +0000 (22:39 -0700)]
vfs_gpfs: Implement new dos_attributes vfs functions

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agogpfswrap: Add wrapper for gpfs_set_winattrs
Christof Schmitt [Wed, 23 Mar 2016 05:38:11 +0000 (22:38 -0700)]
gpfswrap: Add wrapper for gpfs_set_winattrs

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoctdb-killtcp: Change default retry interval, batch size and attempts
Martin Schwenke [Tue, 29 Mar 2016 03:58:33 +0000 (14:58 +1100)]
ctdb-killtcp: Change default retry interval, batch size and attempts

Testing indicates that these are good reliable defaults that can kill
many connections in a reasonable amount of time.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Apr  1 08:10:54 CEST 2016 on sn-devel-144

3 years agoctdb-killtcp: Send tickle ACKs in batches
Martin Schwenke [Thu, 24 Mar 2016 04:11:22 +0000 (15:11 +1100)]
ctdb-killtcp: Send tickle ACKs in batches

At the moment the batch size is "all".

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Store retry interval in killtcp structure
Martin Schwenke [Wed, 23 Mar 2016 00:03:41 +0000 (11:03 +1100)]
ctdb-killtcp: Store retry interval in killtcp structure

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Don't count attempts for individual connections
Martin Schwenke [Tue, 22 Mar 2016 21:26:36 +0000 (08:26 +1100)]
ctdb-killtcp: Don't count attempts for individual connections

This made sense when connections were individually queued in the
daemon.  However, they're now done in batch so just keep an overall
count.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Keep track of number of kill attempts and maximum allowed
Martin Schwenke [Tue, 22 Mar 2016 21:20:07 +0000 (08:20 +1100)]
ctdb-killtcp: Keep track of number of kill attempts and maximum allowed

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Filter out sent packets
Martin Schwenke [Mon, 21 Mar 2016 00:11:19 +0000 (11:11 +1100)]
ctdb-killtcp: Filter out sent packets

When previously killing TCP connections via the daemon there was some
latency due to each kill being sent to the daemon via a separate
control.  This probably meant that when doing a 2-way kill the tickle
ACKs sent to the client end of a connection would not interfere with
listening for the reply ACK from the server end.  Now that there is no
latency, the tickle ACK or RST sent to the client end can be seen as
the reply to the server end tickle ACK, and vice-versa.

To avoid this, throw away packets that look like we sent them.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-system: Return window size and RST bit when reading TCP packets
Martin Schwenke [Mon, 21 Mar 2016 00:07:19 +0000 (11:07 +1100)]
ctdb-system: Return window size and RST bit when reading TCP packets

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Clarify a debug message
Martin Schwenke [Mon, 21 Mar 2016 00:45:10 +0000 (11:45 +1100)]
ctdb-killtcp: Clarify a debug message

The end of the connection in parentheses is not the end being killed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Set debug level via environment variable CTDB_DEBUGLEVEL
Martin Schwenke [Mon, 21 Mar 2016 00:42:40 +0000 (11:42 +1100)]
ctdb-killtcp: Set debug level via environment variable CTDB_DEBUGLEVEL

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Don't send initial tickle ACK during setup
Martin Schwenke [Tue, 29 Mar 2016 02:49:11 +0000 (13:49 +1100)]
ctdb-killtcp: Don't send initial tickle ACK during setup

Since they're being done in batch, just schedule an event to traverse
all the connections.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Drop unnecessary casts
Martin Schwenke [Wed, 23 Mar 2016 03:49:05 +0000 (14:49 +1100)]
ctdb-killtcp: Drop unnecessary casts

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Drop check to see if capture socket can be read
Martin Schwenke [Wed, 23 Mar 2016 03:18:24 +0000 (14:18 +1100)]
ctdb-killtcp: Drop check to see if capture socket can be read

The handler won't be called unless there is something to read.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Merge "common" killtcp code into helper
Martin Schwenke [Fri, 11 Mar 2016 05:04:30 +0000 (16:04 +1100)]
ctdb-killtcp: Merge "common" killtcp code into helper

ctdb_killtcp.c is now the only place it is needed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-protocol: Drop killtcp protocol support
Martin Schwenke [Fri, 11 Mar 2016 04:54:21 +0000 (15:54 +1100)]
ctdb-protocol: Drop killtcp protocol support

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-daemon: Remove implementation of CTDB_CONTROL_KILL_TCP
Martin Schwenke [Fri, 11 Mar 2016 04:57:44 +0000 (15:57 +1100)]
ctdb-daemon: Remove implementation of CTDB_CONTROL_KILL_TCP

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-client: Drop killtcp client functions
Martin Schwenke [Fri, 11 Mar 2016 04:48:26 +0000 (15:48 +1100)]
ctdb-client: Drop killtcp client functions

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-tools: Drop "ctdb killtcp" command
Martin Schwenke [Fri, 11 Mar 2016 04:37:37 +0000 (15:37 +1100)]
ctdb-tools: Drop "ctdb killtcp" command

It is now handled by a standalone helper.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-scripts: Use ctdb_killtcp helper to kill connections
Martin Schwenke [Fri, 11 Mar 2016 04:30:47 +0000 (15:30 +1100)]
ctdb-scripts: Use ctdb_killtcp helper to kill connections

ctdb_killtcp will take up to 5 seconds to kill connections, so don't
wait in a loop.  Just check if there are remaining connections on
completion and log a message either way.

Also add a test stub.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-scripts: Add interface argument to kill_tcp_connections()
Martin Schwenke [Fri, 11 Mar 2016 04:27:10 +0000 (15:27 +1100)]
ctdb-scripts: Add interface argument to kill_tcp_connections()

This will be needed for a rewrite of the connection killing code but
it is not used yet.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: New helper ctdb_killtcp
Martin Schwenke [Wed, 2 Mar 2016 23:34:48 +0000 (10:34 +1100)]
ctdb-killtcp: New helper ctdb_killtcp

This will allow killing of TCP connections without daemon involvement.

It looks strange that the common code for daemon and helper is in the
server directory.  Having it in the server directory means less
temporary changes to the build configuration.  This code will move
into the helper itself and will no longer be used by the daemon.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Simplify includes by using ctdb_sock_addr_to_string()
Martin Schwenke [Thu, 17 Mar 2016 00:32:49 +0000 (11:32 +1100)]
ctdb-killtcp: Simplify includes by using ctdb_sock_addr_to_string()

This allows common.h and ctdb_private.h to be dropped.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Avoid unnecessary dependency on lib/util/time.h
Martin Schwenke [Sun, 6 Mar 2016 19:29:19 +0000 (06:29 +1100)]
ctdb-killtcp: Avoid unnecessary dependency on lib/util/time.h

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Factor out killtcp code into separate file.
Martin Schwenke [Wed, 2 Mar 2016 05:27:02 +0000 (16:27 +1100)]
ctdb-killtcp: Factor out killtcp code into separate file.

This will be used in a standalone helper.

Don't worry that the API isn't clean and opaque.  All of the code will
eventually move into the helper and will no longer be used by the
daemon.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Factor out ctdb_killtcp()
Martin Schwenke [Wed, 2 Mar 2016 05:06:58 +0000 (16:06 +1100)]
ctdb-killtcp: Factor out ctdb_killtcp()

This function knows nothing about CTDB contexts or VNNs, so it can be
used elsewhere.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Change struct ctdb_tcp_kill to store arbitrary destructor data
Martin Schwenke [Wed, 2 Mar 2016 08:04:18 +0000 (19:04 +1100)]
ctdb-killtcp: Change struct ctdb_tcp_kill to store arbitrary destructor data

The destructor used in this instances needs a CTDB context and a VNN.
However, destructors used in other cases may need different data.

For this instance create a local structure to hold the required data.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Avoid CTDB_NO_MEMORY()
Martin Schwenke [Wed, 2 Mar 2016 04:28:01 +0000 (15:28 +1100)]
ctdb-killtcp: Avoid CTDB_NO_MEMORY()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Determine the interface as soon as vnn is known
Martin Schwenke [Wed, 2 Mar 2016 02:29:46 +0000 (13:29 +1100)]
ctdb-killtcp: Determine the interface as soon as vnn is known

This makes restructuring the code easier.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-killtcp: Use the given event context directly
Martin Schwenke [Wed, 2 Mar 2016 02:20:27 +0000 (13:20 +1100)]
ctdb-killtcp: Use the given event context directly

We don't want this code to depend on a CTDB context, so don't go
looking there for an event context.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-system: Add ctdb_parse_connections() function
Amitay Isaacs [Fri, 11 Mar 2016 00:44:12 +0000 (11:44 +1100)]
ctdb-system: Add ctdb_parse_connections() function

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-tests: Link ctdb-util instead of including
Martin Schwenke [Wed, 2 Mar 2016 05:41:29 +0000 (16:41 +1100)]
ctdb-tests: Link ctdb-util instead of including

These are never replaced with stubs.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-util: Move rb_tree.c to ctdb-util
Martin Schwenke [Wed, 16 Mar 2016 20:05:51 +0000 (07:05 +1100)]
ctdb-util: Move rb_tree.c to ctdb-util

It doesn't need struct ctdb_context or similar.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agodocs: Mention _NO_WINBINDD in idmap_script.8
Volker Lendecke [Thu, 31 Mar 2016 15:10:39 +0000 (17:10 +0200)]
docs: Mention _NO_WINBINDD in idmap_script.8

Thanks to Joachim Achtzehnter <joachima@netacquire.com> for pointing out this
flaw!

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): Thu Mar 31 23:57:13 CEST 2016 on sn-devel-144

3 years agodocs: build idmap_script.8 by default
Volker Lendecke [Thu, 31 Mar 2016 14:57:58 +0000 (16:57 +0200)]
docs: build idmap_script.8 by default

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agopam_winbind: Avoid a use of sprintf
Volker Lendecke [Thu, 31 Mar 2016 12:41:07 +0000 (14:41 +0200)]
pam_winbind: Avoid a use of sprintf

pam_winbind depends on talloc, which depends on libreplace, so we have asprintf
available.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbcquotas: print "NO LIMIT" only if returned quota value is 0.
Uri Simchoni [Wed, 30 Mar 2016 11:20:44 +0000 (14:20 +0300)]
smbcquotas: print "NO LIMIT" only if returned quota value is 0.

If the user being queried has no quota, the server returns 0 as
its quota. This is the observed smbd and Windows behavior, which
is also documented in [MS-FSA] 2.5.1.20.

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

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: do not cover up VFS failures to get quota
Uri Simchoni [Wed, 30 Mar 2016 11:02:31 +0000 (14:02 +0300)]
smbd: do not cover up VFS failures to get quota

Now that the VFS follows the convention that get-quota
returns error only on error condition, and success
with zero quota if there is no quota assigned,
reply with an error if failing to obtain a user's
quota.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agonfs-quota: do not fail on ECONNREFUSED
Uri Simchoni [Wed, 30 Mar 2016 10:21:58 +0000 (13:21 +0300)]
nfs-quota: do not fail on ECONNREFUSED

Trying to differentiate between "no quota" and real
error conditions - if the connection to rpc.quotad
is refused it could simply mean that the remote host
has no quota and therefore report this as success with
no quota.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoxfs-quota: do not fail if user has no quota
Uri Simchoni [Wed, 30 Mar 2016 10:00:29 +0000 (13:00 +0300)]
xfs-quota: do not fail if user has no quota

XFS fails quotactl(Q_XGETQUOTA) with ENOENT if the user
or group has no quota assigned to it. This is not an error
condition - simply report 0 quota in this case.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosys-quotas: do not fail if user has no quota
Uri Simchoni [Wed, 30 Mar 2016 11:05:49 +0000 (14:05 +0300)]
sys-quotas: do not fail if user has no quota

If the user/group has no quota, do not treat that as
error condition. Instead, return zero quota.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agontquotas - skip entry if the quota is zero
Uri Simchoni [Wed, 30 Mar 2016 10:59:39 +0000 (13:59 +0300)]
ntquotas - skip entry if the quota is zero

When listing user quotas, do not list the user
if the driver returned success with zero quota -
this signals that no quota is assigned for that
user.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agont-quotas: return 0 as indication of no quota
Uri Simchoni [Tue, 29 Mar 2016 20:05:09 +0000 (23:05 +0300)]
nt-quotas: return 0 as indication of no quota

When getting user quota, the correct value to indicate "no quota"
is 0, not -1.

In [MS-FSCC] section 2.4.33 it is written that -1 designates no-quota.
However, careful read of that section shows that this designation is only
true when setting the quota, and this section says nothing about getting
the quota.

In [MS-FSA] section 2.1.5.20, it is written that "If SidList includes a SID
that does not map to an existing SID in the Open.File.Volume.QuotaInformation
list, the object store MUST return a FILE_QUOTA_INFORMATION structure
(as specified in [MS-FSCC] section 2.4.33) that is filled with zeros.

This is also verified experimentally and cleared with dochelp.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agont-quotas: vfs_get_ntquota() return NTSTATUS
Uri Simchoni [Tue, 29 Mar 2016 20:30:23 +0000 (23:30 +0300)]
nt-quotas: vfs_get_ntquota() return NTSTATUS

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowinbind: Fix a typo in a wrong comment...
Volker Lendecke [Tue, 29 Mar 2016 12:49:17 +0000 (14:49 +0200)]
winbind: Fix a typo in a wrong comment...

While trying to disentangle this knot I could not stand to fix the obvious
typo. The whole comment is not really the whole story anymore, but that's a
commit for another day.

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 30 21:54:40 CEST 2016 on sn-devel-144

3 years agoexamples/perfcounter/perf_writer.c: fix memset
Aurelien Aptel [Tue, 29 Mar 2016 15:30:36 +0000 (17:30 +0200)]
examples/perfcounter/perf_writer.c: fix memset

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 years agowinbind: Remove unused idmap_backends_unixid_to_sid
Volker Lendecke [Wed, 16 Mar 2016 14:35:51 +0000 (15:35 +0100)]
winbind: Remove unused idmap_backends_unixid_to_sid

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Mar 30 17:58:48 CEST 2016 on sn-devel-144

3 years agowinbind: Remove unused idmap_[ug]id_to_sid
Volker Lendecke [Wed, 16 Mar 2016 14:33:48 +0000 (15:33 +0100)]
winbind: Remove unused idmap_[ug]id_to_sid

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowinbind: Use plural xids2sids in _wbint_UnixIDs2Sids
Volker Lendecke [Fri, 4 Mar 2016 14:45:24 +0000 (15:45 +0100)]
winbind: Use plural xids2sids in _wbint_UnixIDs2Sids

We've had plural xid2sid idmap backends for a while. Start using
them.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowinbind: Pass down the domain name to xids2sids
Volker Lendecke [Wed, 16 Mar 2016 14:25:35 +0000 (15:25 +0100)]
winbind: Pass down the domain name to xids2sids

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowinbind: Add idmap_backend_unixids_to_sids
Volker Lendecke [Fri, 4 Mar 2016 14:03:08 +0000 (15:03 +0100)]
winbind: Add idmap_backend_unixids_to_sids

This is the plural version of idmap_backends_unixid_to_sid that expects all ids
to come from the same idmap domain. The singular version walks the domain list
itself, this one expects the domain name to be passed to it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowinbind: Do per-domain xids2sids calls
Volker Lendecke [Tue, 1 Mar 2016 13:34:26 +0000 (14:34 +0100)]
winbind: Do per-domain xids2sids calls

This prepares the equivalent of 2b1dd01934b657a for xids2sids.

Collecting sids2xids per domain is a bit easier: SIDs carry their own domain
prefix. For the reverse, we need to scan the configuration for all the idmap
range definitions.

It has a separate effect: It enables overlapping idmap ranges. The per-domain
calls are done whenever a range matches. If the idmap child finds a successful
xid2sid mapping, this will be collected as one result. This means that every
range definition can contribute mappings.

If there are two rfc2307 sfu domains with overlapping ranges, the domains will
be queried one after the other for a specific mapping. If the defined ranges
overlap, the admin has to make sure that there are no conflicts, because in the
current code "the first writer wins", and the code does not specify an order
(yet).

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowinbind: Introduce id_map_ptrs_init
Volker Lendecke [Fri, 4 Mar 2016 13:23:51 +0000 (14:23 +0100)]
winbind: Introduce id_map_ptrs_init

This simplifies _wbint_Sids2UnixIDs a bit and will be re-used in _wbint_UnixIDs2Sids

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoidmap: Factor out lp_scan_idmap_domains()
Volker Lendecke [Mon, 22 Feb 2016 16:03:43 +0000 (17:03 +0100)]
idmap: Factor out lp_scan_idmap_domains()

This simplifies idmap_found_domain_backend() by moving the regex magic
somewhere else. Also, this routine will be useful soon somewhere else, thus
make it non-static to idmap.c.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoVLV: avoid name conflict with string.h's index()
Douglas Bagnall [Tue, 22 Mar 2016 21:54:01 +0000 (10:54 +1300)]
VLV: avoid name conflict with string.h's index()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Garming Sam <garming@samba.org>
Autobuild-Date(master): Wed Mar 30 14:26:51 CEST 2016 on sn-devel-144

3 years agotdb: avoid a race condition when checking for robust mutexes
Ralph Boehme [Sat, 26 Mar 2016 11:43:55 +0000 (12:43 +0100)]
tdb: avoid a race condition when checking for robust mutexes

This fixes a race between calling waitpid() in two places (SIGCHLD the
signal handler and the rendezvous code when waiting for the child to
terminate), by

- blocking SIGCHLD before installing our signal handler

- in the rendezvous code call sigssuspend() which unblocks SIGCHLD and
  suspends the thread and waits for signal delivery

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Mar 29 16:04:19 CEST 2016 on sn-devel-144

3 years agovfs_glusterfs: call clock_gettime_mono() only on profile-enabled build
Uri Simchoni [Mon, 28 Mar 2016 07:20:22 +0000 (10:20 +0300)]
vfs_glusterfs: call clock_gettime_mono() only on profile-enabled build

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Mar 29 00:12:14 CEST 2016 on sn-devel-144

3 years agovfs_aio_fork: call clock_gettime_mono() only on profile-enabled build
Uri Simchoni [Mon, 28 Mar 2016 07:19:49 +0000 (10:19 +0300)]
vfs_aio_fork: call clock_gettime_mono() only on profile-enabled build

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agovfs_aio_linux: call clock_gettime_mono() only on profile-enabled build
Uri Simchoni [Mon, 28 Mar 2016 07:18:46 +0000 (10:18 +0300)]
vfs_aio_linux: call clock_gettime_mono() only on profile-enabled build

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoasys: call clock_gettime_mono() only on profile-enabled build
Uri Simchoni [Mon, 28 Mar 2016 07:17:03 +0000 (10:17 +0300)]
asys: call clock_gettime_mono() only on profile-enabled build

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3-profile: add PROFILE_TIMESTAMP macro
Uri Simchoni [Mon, 28 Mar 2016 07:13:50 +0000 (10:13 +0300)]
s3-profile: add PROFILE_TIMESTAMP macro

This is a get-timestamp macro which works only when
profiling is enabled in the build. The underlying
clock_gettime_mono() function can be costly on some
architectures and we want to avoid it if it's not
necessary.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3-profile: reduce dependencies of smbprofile.h
Uri Simchoni [Mon, 28 Mar 2016 07:11:33 +0000 (10:11 +0300)]
s3-profile: reduce dependencies of smbprofile.h

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agolib/util: fix function comment
Uri Simchoni [Mon, 28 Mar 2016 07:08:58 +0000 (10:08 +0300)]
lib/util: fix function comment

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos3: vfs: Use the new VFS functions for setting and getting DOS attributes.
Jeremy Allison [Fri, 25 Mar 2016 22:32:09 +0000 (15:32 -0700)]
s3: vfs: Use the new VFS functions for setting and getting DOS attributes.

This will make it easier to support those systems and file systems that
can store DOS attributes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <rsharpe@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Mar 27 09:23:42 CEST 2016 on sn-devel-144

3 years agos3: vfs: Add VFS functions for setting and getting DOS attributes.
Richard Sharpe [Sun, 20 Mar 2016 19:51:32 +0000 (12:51 -0700)]
s3: vfs: Add VFS functions for setting and getting DOS attributes.

This will make it easier to support those systems and file systems that
can store DOS attributes. It should retain the original functionality if
VFS functions providing these things are not provided.

Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Signed-off-by: Jeremy Allison <jra@samba.org>
3 years agos3: smbd: DFS: Pass uint32_t ucf_flags through into unix_convert().
Jeremy Allison [Fri, 25 Mar 2016 18:34:30 +0000 (11:34 -0700)]
s3: smbd: DFS: Pass uint32_t ucf_flags through into unix_convert().

This allows vendors to ensure that flags such as UCF_PREP_CREATEFILE
are always passed to their VFS modules whilst smbd is doing pathname
lookup - even before the create VFS call is done.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Mar 26 00:08:40 CET 2016 on sn-devel-144

3 years agos3: smbd: DFS: Pass uint32_t ucf_flags through into dfs_redirect().
Jeremy Allison [Fri, 25 Mar 2016 18:26:39 +0000 (11:26 -0700)]
s3: smbd: DFS: Pass uint32_t ucf_flags through into dfs_redirect().

Eventually move this down to the call to unix_convert()
inside the DFS code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
3 years agos3: smbd: DFS: Pass uint32_t ucf_flags through into resolve_dfspath_wcard().
Jeremy Allison [Fri, 25 Mar 2016 18:23:29 +0000 (11:23 -0700)]
s3: smbd: DFS: Pass uint32_t ucf_flags through into resolve_dfspath_wcard().

Eventually move this down to the call to unix_convert()
inside the DFS code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
3 years agopam_winbind: Create and use a wbclient context
Andreas Schneider [Thu, 24 Mar 2016 08:38:56 +0000 (09:38 +0100)]
pam_winbind: Create and use a wbclient context

PAM sessions are long running. If we create a pam session a connection
to winbind is established and only closed by the destructor of the
libwbclient library. If we create a wbcContext, we will free it in the
end of the PAM function being called and the socket will be closed. This
decreases the amount of allocated 'winbindd_cli_state' structures in
winbind for every logged in user.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Mar 25 17:45:24 CET 2016 on sn-devel-144

3 years agopam_winbind: Use the correct type to check the pam_parse() return code
Andreas Schneider [Thu, 24 Mar 2016 08:23:31 +0000 (09:23 +0100)]
pam_winbind: Use the correct type to check the pam_parse() return code

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
3 years agos3: smbd: DFS - Remove the last lp_posix_pathnames() from the SMB2/3 code paths.
Jeremy Allison [Sun, 20 Mar 2016 04:04:09 +0000 (21:04 -0700)]
s3: smbd: DFS - Remove the last lp_posix_pathnames() from the SMB2/3 code paths.

lp_posix_pathnames() is only used in one place in SMB1 DFS
processing - in dealing with buggy clients, and not at all in SMB2/3.

Note that the removal of lp_posix_pathnames() in the initial detection
of path separator is a change in behavior - but the case where an
incoming DFS name *doesn't* begin with the correct separator is a client bug,
so I'm comfortable with making this change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Autobuild-User(master): Uri Simchoni <uri@samba.org>
Autobuild-Date(master): Fri Mar 25 13:23:48 CET 2016 on sn-devel-144

3 years agoctdb-recovery-helper: Add banning to parallel recovery
Amitay Isaacs [Tue, 15 Mar 2016 04:08:24 +0000 (15:08 +1100)]
ctdb-recovery-helper: Add banning to parallel recovery

If one or more nodes are misbehaving during recovery, keep track of
failures as ban_credits.  If the node with the highest ban_credits exceeds
5 ban credits, then tell recovery daemon to assign banning credits.

This will ban only a single node at a time in case of recovery failure.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Mar 25 06:57:32 CET 2016 on sn-devel-144

3 years agoctdb-recoverd: Add message handler to assigning banning credits
Amitay Isaacs [Thu, 17 Mar 2016 06:26:30 +0000 (17:26 +1100)]
ctdb-recoverd: Add message handler to assigning banning credits

This will be called from recovery helper to assign banning credits to
misbehaving node.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 years agoctdb-protocol: Add srvid for assigning banning credits
Amitay Isaacs [Thu, 17 Mar 2016 06:16:09 +0000 (17:16 +1100)]
ctdb-protocol: Add srvid for assigning banning credits

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>