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

102910 Commits

Author SHA1 Message Date
Stefan Metzmacher
795e796658 s3:libads/sasl: allow wrapped messages up to a size of 0xfffffff
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11872

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
2016-04-28 16:51:16 +02:00
Stefan Metzmacher
8704958fb3 s4:gensec_tstream: allow wrapped messages up to a size of 0xfffffff
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11872

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
2016-04-28 16:51:15 +02:00
Richard Sharpe
415872990e selfttest: add common_test_fns.inc
Create an include file of common functions used by several of the
blackbox tests in testprogs and then make all the users of
test_smbclient include that file so we can eliminate duplicate code. We
pass the UNC to the test_smbclient function.

Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Apr 28 16:50:35 CEST 2016 on sn-devel-144
2016-04-28 16:50:35 +02:00
Martin Schwenke
f667ff6485 ctdb-doc: Document cluster mutex helper API
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Thu Apr 28 13:18:07 CEST 2016 on sn-devel-144
2016-04-28 13:18:06 +02:00
Martin Schwenke
721f64511c ctdb-recovery: Move recovery lock latency updating to handler
The cluster mutex code already passes the latency and expects the
handler to update the statistics.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:17 +02:00
Martin Schwenke
bcb838ba1e ctdb-recovery: Move recovery lock functions to recovery daemon code
ctdb_recovery_have_lock(), ctdb_recovery_lock(),
ctdb_recovery_unlock() are only used by recovery daemon, so move them
there.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:17 +02:00
Martin Schwenke
df99d9e273 ctdb-cluster-mutex: Factor out cluster mutex code
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:17 +02:00
Martin Schwenke
ecc6751c6b ctdb-recovery: Factor out setting of cluster mutex handler
This means that the cluster mutex handle can now be treated as opaque.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:17 +02:00
Martin Schwenke
94fb2cf0ec ctdb_recovery: ctdb_cluster_mutex() now takes an argstring argument
All of the ctdb_cluster_mutex_* infrastucture can now handle an
arbitrary mutex.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:17 +02:00
Martin Schwenke
46684867b1 ctdb-recovery: Recovery lock setting can now include helper command
The underlying change is to allow the cluster mutex argstring to
optionally contain a helper command.  When the argument string starts
with '!' then the first word is the helper command to run.  This is
now the standard way of changing the helper from the default.

CTDB_CLUSTER_MUTEX_HELPER show now only be used to change the location
of the default helper when testing.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:17 +02:00
Martin Schwenke
918b0d9a9c ctdb-recovery: Parse recovery lock setting
This is currently just treated as the name of a lock file.  However,
it is really some arbitrary arguments to lock helper.

Therefore, it should be parsed and passed as separate arguments to the
lock helper.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:17 +02:00
Martin Schwenke
64d557200e ctdb-recovery: Reimplement ctdb_recovery_lock() using ctdb_cluster_mutex()
Replace the file descriptor for the recovery lock in the CTDB context
with the cluster mutex handle, where non-NULL means locked.
Attempting to take the recovery lock is now asynchronous and no longer
blocks the recovery daemon.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:16 +02:00
Martin Schwenke
0b0b954ff2 ctdb-recovery: Kill cluster mutex helper with a signal that can be caught
Unlike fcntl(2), some other helper might need to explicitly take
action to release a mutex.  This can be done by catching SIGTERM.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:16 +02:00
Martin Schwenke
e679a1731c ctdb-recovery: Switch ctdb_cluster_mutex() to use helper
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:16 +02:00
Martin Schwenke
5cf3b7a1e3 ctdb: Add new helper ctdb_mutex_fcntl_helper
This implements the type of fcntl locking that the recovery lock uses.
The intent is to use it for multiple locks and allow the choice of
helper to be configured.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:16 +02:00
Martin Schwenke
c14e0ff8e4 ctdb-tools: Simplify "ctdb getreclock" output
If the reclock is set then print it, otherwise print nothing.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:16 +02:00
Martin Schwenke
978404ecde ctdb-recovery: Add optional timeout argument to ctdb_cluster_mutex()
Timeout in seconds, 0 means no timeout.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:16 +02:00
Martin Schwenke
43e9f58d6a ctdb-recovery: Factor out reclock testing into ctdb_cluster_mutex()
This is currently only used to check whether the recovery lock can be
taken.  However, name it more generally in anticipation of using it
for general cluster mutex taking and testing.

No functional changes.  A couple of debug message simplifications and
code rearrangements.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:16 +02:00
Martin Schwenke
ab75f2a587 ctdb-recovery: Use a configurable handler when testing cluster mutex
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:16 +02:00
Martin Schwenke
419f57f378 ctdb-recovery: Factor out new function set_recmode_handler()
This is used to reply to the recmode control for all the different
cases.  The callers can later be generalised to use a pointer, which
can then be used for recovery lock handling in different contexts.

Note that the handle is now freed in set_recmode_handler() rather than
the callbacks.

There is one difference in behaviour.  Deferred attach calls are now
processed in the timeout case, where they weren't before.  That's a
bug fix!

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:16 +02:00
Martin Schwenke
14a2330692 ctdb-recovery: Use single char ASCII numbers for status from child
'0' = Child took the mutex
  '1' = Unable to take mutex - contention
  '2' = Unable to take mutex - timeout
  '3' = Unable to take mutex - error

This is a straightforward API.  When the child is generalised to an
external helper then this makes it easier for a helper to be, for
example, a simple script.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:16 +02:00
Martin Schwenke
4842b6bb91 ctdb-recovery: Rename recovery lock functions and struct
Use the more general name "cluster mutex", since we are likely to end
up with more than one cluster-wide lock.  There will probably be a
dedicated recovery lock, held only during recovery, and also a second
lock that is held by the master node.  Currently one lock is used for
both purposes.

At the moment the struct and functions are involved with setting the
recovery mode.  However, they'll be abstracted out to more generally
deal with the cluster mutexes, so "recmode" -> "cluster_mutex".  Drop
"set" from names, since this is used to test the lock.  Also drop
"ctdb" prefix from functions, since they are local to this file.  The
struct will eventually be a long-lived handle that will release the
mutex when freed, so name it accordingly.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:16 +02:00
Martin Schwenke
1b607f2032 ctdb-build: ctdb-system depends on samba-util for debug
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:16 +02:00
Volker Lendecke
10b0a8baa2 smbd: Avoid large reads beyond EOF
With unix extensions and oplocks=no mount.cifs from jessie reads beyond the
file end forever, and we are happy to return zeros....

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr 27 23:57:56 CEST 2016 on sn-devel-144
2016-04-27 23:57:56 +02:00
Partha Sarathi
07e2f4731e Fix the smb2_setinfo to handle FS info types and FSQUOTA infolevel
Signed-off-by: Partha Sarathi  <partha@exablox.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>

Autobuild-User(master): Uri Simchoni <uri@samba.org>
Autobuild-Date(master): Wed Apr 27 05:39:01 CEST 2016 on sn-devel-144
2016-04-27 05:39:01 +02:00
Robin Hack
f4181f25b4 ldb-samba/ldb_matching_rules: Fix CID 1349424 - Uninitialized pointer read
Fix unitialized 'visited' value (pointer to pointer) in
ldb_eval_transitive_filter() which passes 'visited' value later to
ldb_eval_transitive_filter_helper().

Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr 27 02:12:39 CEST 2016 on sn-devel-144
2016-04-27 02:12:39 +02:00
Robin Hack
51f221c86e dcesrv_backupkey_heimdal: Fix CID 1321647 - Unchecked return value
Unchecked return value of gnutls_global_init().

Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-04-26 22:48:22 +02:00
Robin Hack
9a7a38a6dd lib/http/http_auth: Fix CID 1273428 - Unchecked return value
There is missing check of status value in
http_auth.c:http_create_auth_request() which can leave values
inside 'DATA_BLOB in' unitialized.

http_auth.c:http_create_auth_request() calls
http_auth.c:http_parse_auth_response() which can return NT_STATUS_NOT_SUPPORTED
and which is not checked by caller and later passed as argument to other functions.

For example:
'DATA_BLOB in' can be passed to
auth/gensec/spnego.c:gensec_spnego_update() later:

...
switch (spnego_state->state_position) {
..
	case SPNEGO_SERVER_START:
		if (in.length) {

Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-04-26 22:48:22 +02:00
Robin Hack
b9ffb9322b talloc/testsuite: Fix CID 1291641 - Logically dead code
Add check for snprintf return code.

Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-04-26 22:48:21 +02:00
Andreas Schneider
f9099d3c46 s3-libads: Fix compilation with MIT Kerberos
ENCTYPE_NULL is defined by the RFC and used by MIT Kerberos. Heimdal
also provides ENCTYPE_NULL.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Apr 26 22:47:19 CEST 2016 on sn-devel-144
2016-04-26 22:47:19 +02:00
Robin Hack
2a81893291 ctdb-tests: Fix CID 1358704 use of "=" where "==" may have been intended
Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Uri Simchoni <uri@samba.org>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Apr 26 19:21:24 CEST 2016 on sn-devel-144
2016-04-26 19:21:24 +02:00
Volker Lendecke
cce6b677ff dbwrap_ctdb: Fix ENOENT->NT_STATUS_NOT_FOUND
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11844
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 26 14:34:14 CEST 2016 on sn-devel-144
2016-04-26 14:34:14 +02:00
Petr Cech
32b1f78b23 LDB: Redudant test on NULL context remove
There is redudant test on NULL context in ldb_dn_new_fmt() function.
We use this (NULL) context in talloc_vasprintf() function which is
able to work with NULL at all. And at the end, we free this newly
created (by talloc_vasprintf) context. So it should be safe to remove
this check.

Signed-off-by: Petr Cech <pcech@redhat.com>
Reviewed-by: Simo Sorce <idra@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 26 08:09:25 CEST 2016 on sn-devel-144
2016-04-26 08:09:25 +02:00
Ralph Boehme
3e3e72ff9b s3/rpc_server: mdssvc: suppress compiler warnings from glib headers
Several glib headers produce cast-qual warnings, eg:

/usr/include/glib-2.0/gio/gliststore.h: In function ‘G_LIST_STORE’:
/usr/include/glib-2.0/gio/gliststore.h:36:382: error: cast discards
‘const’ qualifier from pointer target type [-Werror=cast-qual]
/usr/include/glib-2.0/gio/gliststore.h: In function ‘G_IS_LIST_STORE’:
/usr/include/glib-2.0/gio/gliststore.h:36:550: error: cast discards
‘const’ qualifier from pointer target type [-Werror=cast-qual]
cc1: all warnings being treated as errors

This break compiling with --picky-developer, so lets suppress the
warning for glibs in order to see our own --picky-developer compiler
diagnostics.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Apr 26 04:44:44 CEST 2016 on sn-devel-144
2016-04-26 04:44:44 +02:00
Richard Sharpe
81ca7eac3d Refactor the dns_open_connection code so that duplicate code is removed and ensure that EINTR is handled in the UDP path.
Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2016-04-26 01:20:25 +02:00
Jérémie Courrèges-Anglas
53e0860122 Fix CHECK_CODE usage in atomics builtin detection
CHECK_CODE already wraps the code with main().  Adding another layer
results in a nested function, eg

  int main(void) { int main(void) { __sync_fetch_and_add(); } }

Since the inner function isn't called it is optimized out at cc -O2,
thus the linker doesn't fail if __sync_fetch_and_add() isn't available.

Issue noticed on OpenBSD/hppa.

Signed-off-by: Jérémie Courrèges-Anglas <jca@wxcvbn.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 26 01:19:40 CEST 2016 on sn-devel-144
2016-04-26 01:19:40 +02:00
Volker Lendecke
ad5a4a9e36 ctdbd_conn: Make "cstatus" int32_t
This converts the "cstatus" parameter of ctdbd_control_local to what it is
defined as in the packet: int32_t. It was used inconsistently throughout the
code.

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 25 21:54:24 CEST 2016 on sn-devel-144
2016-04-25 21:54:24 +02:00
Volker Lendecke
2bd1bcf50c ctdbd_conn: Add some more debug info
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:21 +02:00
Volker Lendecke
aad53cf595 ctdbd: Use talloc_memdup where appropriate
.... 40 bytes .text less ;-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:21 +02:00
Volker Lendecke
445ad6e8e4 ctdbd_conn: Use ctdbd_control_local where possible
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:21 +02:00
Volker Lendecke
f0525d4e07 ctdbd_conn: Avoid "includes.h"
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:21 +02:00
Volker Lendecke
d36def84ae lib: serverid.h references struct server_id
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:21 +02:00
Volker Lendecke
ff72a8ae82 lib: Move ctdbd_init_connection out of ctdbd_traverse()
2 effects: This removes the [un]become_root calls from ctdbd_conn,
and it makes it possible to re-use the traversal connections, should
the setup/teardown become a problem in the future.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:20 +02:00
Volker Lendecke
966cef0d41 ctdbd_conn: Remove unused ctdbd_messaging_connection
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:20 +02:00
Volker Lendecke
e2d39aefae lib: Use ctdbd_init_connection in messaging_ctdbd_init
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:20 +02:00
Volker Lendecke
1ff4002b23 ctdbd_conn: Make ctdbd_init_connection public
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:20 +02:00
Volker Lendecke
b1277acb44 ctdbd_conn: Use ctdbd_init_connection in ctdbd_probe
We are only interested in ctdb connectability here.
ctdbd_messaging_connection() does a few more calls not required here

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:20 +02:00
Volker Lendecke
14beae7cc9 ctdbd_conn: Use sys_poll_intr
This pulls in far less dependencies than poll_intr_one_fd and is not much more
complex to call

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:20 +02:00
Volker Lendecke
d59ae31cca ctdbd_conn: Adapt loop counter's type to the loop limit
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-04-25 18:29:20 +02:00
Noel Power
39bbd40cda fix Invalid read of size 8
running rpc.dsgetinfo.DsGetReplicaInfo results in the following valgrind
trace

==14966== Invalid read of size 8
==14966==    at 0x88B2D5D: dcerpc_binding_handle_call (binding_handle.c:538)
==14966==    by 0x978F33B: dcerpc_drsuapi_DsUnbind_r (ndr_drsuapi_c.c:319)
==14966==    by 0x2E9F19: torture_dsgetinfo_tcase_teardown (dsgetinfo.c:431)
==14966==    by 0x95536EF: internal_torture_run_test (torture.c:452)
==14966==    by 0x9553A4B: torture_run_test_restricted (torture.c:542)
==14966==    by 0x260074: run_matching (smbtorture.c:110)
==14966==    by 0x25FF36: run_matching (smbtorture.c:95)
==14966==    by 0x260195: torture_run_named_tests (smbtorture.c:143)
==14966==    by 0x261E14: main (smbtorture.c:665)
==14966==  Address 0x28 is not stack'd, malloc'd or (recently) free'd
==14966==

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Apr 25 14:01:33 CEST 2016 on sn-devel-144
2016-04-25 14:01:33 +02:00