samba.git
8 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>
8 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>
8 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

8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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

8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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

8 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>
8 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

8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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

8 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

8 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

8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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

8 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>
8 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

8 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>
8 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>
8 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

8 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>
8 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

8 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

8 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>
8 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>
8 years agoctdb-recovery-helper: Introduce new #define variable
Amitay Isaacs [Thu, 17 Mar 2016 03:22:17 +0000 (14:22 +1100)]
ctdb-recovery-helper: Introduce new #define variable

... instead of hardcoding number of retries.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-recovery-helper: Improve log message
Amitay Isaacs [Thu, 17 Mar 2016 03:13:02 +0000 (14:13 +1100)]
ctdb-recovery-helper: Improve log message

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-tests: Add a test for recovery of large databases
Amitay Isaacs [Sat, 5 Mar 2016 04:04:48 +0000 (15:04 +1100)]
ctdb-tests: Add a test for recovery of large databases

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-recovery-helper: Introduce push database abstraction
Amitay Isaacs [Thu, 25 Feb 2016 07:07:11 +0000 (18:07 +1100)]
ctdb-recovery-helper: Introduce push database abstraction

This abstraction uses capabilities of the remote nodes to either send
older PUSH_DB controls or newer DB_PUSH_START and DB_PUSH_CONFIRM
controls.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-recovery-helper: Introduce pull database abstraction
Amitay Isaacs [Wed, 24 Feb 2016 07:10:49 +0000 (18:10 +1100)]
ctdb-recovery-helper: Introduce pull database abstraction

This abstraction depending on the capability of the remote node either
uses older PULL_DB control or newer DB_PULL control.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-protocol: Add new capability
Amitay Isaacs [Tue, 23 Feb 2016 03:52:51 +0000 (14:52 +1100)]
ctdb-protocol: Add new capability

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-protocol: Add srvid for messages during recovery
Amitay Isaacs [Tue, 23 Feb 2016 07:03:10 +0000 (18:03 +1100)]
ctdb-protocol: Add srvid for messages during recovery

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-protocol: Introduce variable for checking srvid prefix
Amitay Isaacs [Wed, 23 Mar 2016 03:35:42 +0000 (14:35 +1100)]
ctdb-protocol: Introduce variable for checking srvid prefix

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-recovery-helper: Write recovery records to a recovery file
Amitay Isaacs [Tue, 8 Mar 2016 07:32:19 +0000 (18:32 +1100)]
ctdb-recovery-helper: Write recovery records to a recovery file

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-recovery-helper: Re-factor function to retain records from recdb
Amitay Isaacs [Tue, 8 Mar 2016 06:48:46 +0000 (17:48 +1100)]
ctdb-recovery-helper: Re-factor function to retain records from recdb

Also, rename traverse function and traverse state for recdb_records
consistently.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-protocol: Add file IO functions for ctdb_rec_buffer
Amitay Isaacs [Tue, 8 Mar 2016 06:20:30 +0000 (17:20 +1100)]
ctdb-protocol: Add file IO functions for ctdb_rec_buffer

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-recovery-helper: Create accessors for recdb structure fields
Amitay Isaacs [Mon, 29 Feb 2016 02:53:52 +0000 (13:53 +1100)]
ctdb-recovery-helper: Create accessors for recdb structure fields

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-recovery-helper: Rename pnn to dmaster in recdb_records()
Amitay Isaacs [Fri, 26 Feb 2016 04:42:53 +0000 (15:42 +1100)]
ctdb-recovery-helper: Rename pnn to dmaster in recdb_records()

This variable is used to set the dmaster value for each record in
recdb_traverse().

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-recovery-helper: Pass capabilities to database recovery functions
Amitay Isaacs [Thu, 25 Feb 2016 00:04:51 +0000 (11:04 +1100)]
ctdb-recovery-helper: Pass capabilities to database recovery functions

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-recovery-helper: Factor out generic recv function
Amitay Isaacs [Fri, 26 Feb 2016 06:36:39 +0000 (17:36 +1100)]
ctdb-recovery-helper: Factor out generic recv function

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-client: Add client API functions for new controls
Amitay Isaacs [Fri, 19 Feb 2016 00:14:40 +0000 (11:14 +1100)]
ctdb-client: Add client API functions for new controls

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-daemon: Implement new controls DB_PULL and DB_PUSH_START/DB_PUSH_CONFIRM
Amitay Isaacs [Fri, 19 Feb 2016 06:32:09 +0000 (17:32 +1100)]
ctdb-daemon: Implement new controls DB_PULL and DB_PUSH_START/DB_PUSH_CONFIRM

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-protocol: Add new controls DB_PULL and DB_PUSH_START/DB_PUSH_CONFIRM
Amitay Isaacs [Thu, 18 Feb 2016 23:54:15 +0000 (10:54 +1100)]
ctdb-protocol: Add new controls DB_PULL and DB_PUSH_START/DB_PUSH_CONFIRM

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-protocol: Add new data type ctdb_pulldb_ext for new control
Amitay Isaacs [Thu, 18 Feb 2016 23:45:19 +0000 (10:45 +1100)]
ctdb-protocol: Add new data type ctdb_pulldb_ext for new control

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-tunables: Add new tunable RecBufferSizeLimit
Amitay Isaacs [Tue, 8 Mar 2016 06:29:31 +0000 (17:29 +1100)]
ctdb-tunables: Add new tunable RecBufferSizeLimit

This will be used to limit the size of record buffer sent in newer
controls for recovery and existing controls for vacuuming.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agoctdb-client: Add client API for sending message to multiple nodes
Amitay Isaacs [Fri, 26 Feb 2016 03:12:19 +0000 (14:12 +1100)]
ctdb-client: Add client API for sending message to multiple nodes

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
8 years agos3: torture. Remove spurious lp_posix_pathnames() included by cut-and-paste error.
Jeremy Allison [Sun, 20 Mar 2016 04:07:01 +0000 (21:07 -0700)]
s3: torture. Remove spurious lp_posix_pathnames() included by cut-and-paste error.

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

8 years agos3: smbd: Modify vfs_stat_smb_basename() to take a const struct smb_filename * instea...
Jeremy Allison [Sat, 19 Mar 2016 05:17:30 +0000 (22:17 -0700)]
s3: smbd: Modify vfs_stat_smb_basename() to take a const struct smb_filename * instead of const char *.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
8 years agos3: vfs: vfs_acl_tdb. Remove use of vfs_stat_smb_basename().
Jeremy Allison [Sat, 19 Mar 2016 05:15:12 +0000 (22:15 -0700)]
s3: vfs: vfs_acl_tdb. Remove use of vfs_stat_smb_basename().

We only need a basic STAT here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
8 years agos3: vfs: recycle. Remove use of vfs_stat_smb_basename().
Jeremy Allison [Sat, 19 Mar 2016 05:10:34 +0000 (22:10 -0700)]
s3: vfs: recycle. Remove use of vfs_stat_smb_basename().

We only need a basic STAT here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
8 years agos3: smbd: Remove many common uses of lp_posix_pathnames().
Jeremy Allison [Sat, 19 Mar 2016 04:58:20 +0000 (21:58 -0700)]
s3: smbd: Remove many common uses of lp_posix_pathnames().

Check the smb_filename->flags field, or req->posix_pathnames
instead, depending on what is available.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>