1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00
Commit Graph

98298 Commits

Author SHA1 Message Date
Christof Schmitt
8a46da3280 debug: Set backends from logging parameter in smb.conf
Fallback to the settings of 'syslog' and 'syslog only' if logging has not
been set.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 21:22:11 +01:00
Christof Schmitt
5a3eddc7b9 param: Add new 'logging' parameter
This parameter allows to configure multiple backends at the same time.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 21:22:11 +01:00
Christof Schmitt
2681c31170 debug: Add syslog backend
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 21:22:11 +01:00
Christof Schmitt
978fee84d0 debug: Add file backend
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 21:22:11 +01:00
Christof Schmitt
289a7b41bc debug: Add infrastructure for supporting multiple backends
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 21:22:11 +01:00
Christof Schmitt
364e8768d6 debug: Move mapping from level to syslog priority to helper function
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 21:22:11 +01:00
Christof Schmitt
1270813691 debug: Move logging to callback to separate function
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 21:22:11 +01:00
Christof Schmitt
17bd9b7349 debug: Always store short version of prog_name in debug state
Storing the prog_name in the debug state is not necessary at this point,
but it will be used later.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 21:22:11 +01:00
Christof Schmitt
8eba2cfa51 debug: Remove some unneeded function declarations
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 21:22:11 +01:00
Christof Schmitt
ba86450b27 debug: Remove FORMAT_BUFR_MAX, use FORMAT_BUFR_SIZE - 1 instead
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 21:22:11 +01:00
Christof Schmitt
0509790ec3 build: Move systemd checks to lib/util
Only lib/util uses the systemd library, so it makes sense to have the
checks there. This also removes the need for the ctdb build script to
specify an empty tag for the systemd library.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 21:22:11 +01:00
Volker Lendecke
dee2b958c0 lib: Move get_iconv_handle() call down
We only need this in the slow path. A good compiler might detect this,
but as get_iconv_handle() might have side-effects from a compiler's
point of view, I'm not sure it's legal to skip the call in the fast
path. Might be premature optimization, but it's low hanging fruit :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed by: Ira Cooper <ira@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Mar 23 21:21:15 CET 2015 on sn-devel-104
2015-03-23 21:21:15 +01:00
Michael Adam
8de2164835 s4:torture: avoid use of uninitialized variable in error case.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Mon Mar 23 18:40:18 CET 2015 on sn-devel-104
2015-03-23 18:40:18 +01:00
Michael Adam
1dc770ce81 s4:torture: avoid free of uninitialized variable in error case.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2015-03-23 16:04:19 +01:00
Michael Adam
2bf66d95d8 s4:torture: avoid free of uninitialized variable in error case.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2015-03-23 16:04:19 +01:00
Michael Adam
b92d51f98c s4:torture: avoid free of uninitialized variables in error-case.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2015-03-23 16:04:19 +01:00
Michael Adam
59cce7cbeb lib/crypto: fix header guard for crypto.h
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2015-03-23 16:04:19 +01:00
Anoop C S
73f951e98f libnetapi: Fix CID 1272947 Fix logically dead code
Signed-off-by: Anoop C S <achiraya@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-03-23 16:04:19 +01:00
Volker Lendecke
b024ea84ff dsdb: Fix CID 1034681 Copy-paste error
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-03-23 16:04:18 +01:00
Volker Lendecke
9b73a477f6 smbd: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-03-23 16:04:18 +01:00
Martin Schwenke
c8918b70b9 ctdb-tools: Use a broadcast to connected nodes for "reloadnodes"
There is no reason to serialise these or even handle remote nodes
first.  Using a broadcast is more efficient and is less code.

Update expected test results to reflect changed order of messages.

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): Mon Mar 23 15:04:00 CET 2015 on sn-devel-104
2015-03-23 15:04:00 +01:00
Martin Schwenke
c99d2702ee ctdb-tests: Add unit tests for "reloadnodes" sanity checking
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
1cebd75f62 ctdb-tools: Sanity check changes before processing "reloadnodes"
"ctdb reloadnodes" currently does no sanity checking of the nodes
file.  This can cause chaos if a line is deleted from the nodes file
rather than commented out.  It also repeatedly produces a spurious
warning for each deleted node, even if the node was deleted a long
time ago.

Instead compare the nodemap with the contents of the local nodes file
to sanity check before attempting any reloads.  Note that this is
still imperfect if the nodes files are inconsistent across nodes but
it is better.  Also ensure that any nodes that are to be deleted are
already disconnected.  Avoid trying to talk to deleted nodes.

The current implementation is a bit unfortunate when it comes to
deleting nodes.  The most obvious alternative to the above complexity
would be to reloadnodes on the specified node first, then fetch the
node map (in which newly deleted nodes would be marked as such) and
then handle the remote nodes.  However, the implementation of
reloadnodes is asynchronous and it only actions the reload after 1
second.  This is presumably to avoid the recovery master noticing the
inconsistency between nodemaps and triggering a recovery before all
nodes have had their nodemaps updated.

Note that this recovery can still occur if the check is done at an
inconvenient time.  A better long term approach might be to quiesce
the recovery master checks while reloadnodes is in progress.

Update a unit test to reflect the change.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
2cb2aa58d0 ctdb-tests: Add "ctdb reloadnodes" unit tests
A basic test and some for cross-node consistency checking.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
16c79eb887 ctdb-tools: Add cross-node file comparison to "reloadnodes"
This compares the nodes file on the current node with that on all
nodes.  If any are different then do not reload nodes.

If any nodes files can't be fetched then do not reload nodes.  This
could be because some nodes are running an older version without this
feature.  This is unsupported: why make a major cluster
reconfiguration while a cluster is half upgraded?

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
5207d13152 ctdb-tests: Test stub for ctrl_getnodesfile()
Also stub support for CTDB_CONTROL_GET_NODES_FILE

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
81e526965c ctdb-daemon: New control CTDB_CONTROL_GET_NODES_FILE
This is like CTDB_CONTROL_GET_NODEMAP but it loads from the nodes file
instead of the daemon.

Also new client function ctdb_ctrl_getnodesfile()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
8e12e112f8 ctdb-tools: "reloadnodes" should only run against current node
It should not be possible to specify "-n <othernode>", unless
<othernode> is the current node.  To support this, add new function
assert_current_node_only().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
77e879253b ctdb-tools: Remove unused struct pnn_node and function read_pnn_node_file()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
3703e8aadd ctdb-tools: Reimplement read_natgw_nodes_file() using ctdb_read_nodes_file()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
c5538a464f ctdb-tools: Reimplement read_nodes_file() using ctdb_get_nodes_file()
Update the implementation of "ctdb xpnn" and "ctdb listnodes"
accordingly.  Update associated tests too.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
5148228f41 ctdb-daemon: Move ctdb_read_nodes_file() to utilities
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
1ada9c4ef7 ctdb-daemon: Factor out node parsing code
New function ctdb_read_nodes_file() reads a nodes file into a node
map, which is a useful intermediate format.  This function should
replace the node reading code in the ctdb CLI tool.  It will also be
useful for sanity checking of nodes files across the cluster.

New function convert_node_map_to_list() converts a node map to a node
array (and associated node count).  This fills in the details that
aren't present in the node map.  This may also useful as a separate
function later if node list reloading stages the data after a sanity
check - the approach is not yet finalised.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
a5be2c245d ctdb-daemon: Store node addresses as ctdb_sock_addr rather than strings
Every time a nodemap is contructed the node IP addresses all need to
be parsed.  This isn't very productive use of CPU.

Instead, parse each string once when the nodes file is loaded.  This
results in much simpler code.

This code also removes the use of ctdb_address.  Duplicating the port
is pointless without an abstraction layer around ctdb_address.  If
CTDB gets an incompatible transport in the future then add an
abstraction layer.

Note that the infiniband code is not updated.  Compilation of the
infiniband code is already broken.  Fixing it will be a separate,
properly tested effort.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
3cbeb17d0f ctdb-common: Drop ctdb context from ctdb_parse_address()
Having it require a CTDB context stops ctdb_parse_address() from being
used in more generic code.  Just use the existing talloc context for
memory allocations.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
a1e65d0c8d ctdb-daemon: Remove function ctdb_add_deleted_node()
Just add a flags parameter to ctdb_add_nodes() and use the same code.
Less is more.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
876529054a ctdb-daemon: Set node PNN in one place
This is currently set in 2 places.  One of them makes the node loading
code difficult to refactor.  Also, when the surrounding code in either
place is touched then it might get broken.

This only needs to be done once at startup, not on every reload.  So
do it once in a very obvious way, sacrificing a few CPU cycles for
some added clarity.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
db6385afe9 ctdb-daemon: Move VNN map initialisation out of node loading
Each node reload unnecessarily and incorrectly resets the VNN map,
causing a potentially unnecessary recovery.  When nodes are reloaded
any newly deleted nodes should already be disconnected and any newly
added nodes should also be disconnected.  This means that reloading
the nodes file should not cause a change in the VNN map.

The current implementation also leaks memory every time the nodes are
reloaded.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
ee073f60b1 ctdb-tests: Fix error return for ctdb_client_async_control_stub()
It should be -1 even without a failure callback registered.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
c0891339ec ctdb-tests: Add asserts to ensure that pointers are set
These can be unset if a NODEMAP, IFACES or VNNMAP section is missing.
Affected functions would then dereference a NULL pointer and the test
program would crash.  Adding some helpful messages makes the problem
easier to diagnose when writing tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Andreas Schneider
c07a54b294 torture: Fix the usage of the MEMORY credential cache.
Pair-Programmed-With: Guenther Deschner <gd@samba.org>
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Mar 21 02:03:34 CET 2015 on sn-devel-104
2015-03-21 02:03:34 +01:00
Andreas Schneider
a9bcc86504 kdc-db-glue: Remove unused code.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-03-20 23:25:54 +01:00
Andreas Schneider
b21b2d596e kdc-db-glue: Do not allocate memory for the principal
The function we are calling already allocate memory.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-03-20 23:25:54 +01:00
Andreas Schneider
aa1431e53f kdc-db-glue: Fix memory cleanup to avoid crashes.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-03-20 23:25:54 +01:00
Andreas Schneider
6ada266dcf kdc-db-glue: Fix function format of samba_kdc_message2entry()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-03-20 23:25:54 +01:00
Andreas Schneider
b9072d9741 kdc-db-glue: Fix a NULL pointer dereference.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-03-20 23:25:54 +01:00
Günther Deschner
13cd1d5c58 s4-kdc/db_glue: bad idea to free parent mem_ctx when sub function got a failure.
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-03-20 23:25:54 +01:00
Günther Deschner
6d6712fdde s4-kdc/pac_glue: only include required headers.
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-03-20 23:25:54 +01:00
Günther Deschner
c5965c41ae s4-kdc/pac_glue: use ENCTYPE_ARCFOUR_HMAC just like in db_glue.
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-03-20 23:25:54 +01:00
Günther Deschner
e49802a02d s4-kdc/db-glue: use krb5_copy_data_contents in samba_kdc_message2entry_keys().
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-03-20 23:25:54 +01:00