kai/samba-autobuild/.git
10 years agoctdb-tests: Add NAT gateway eventscript unit tests for static routes
Martin Schwenke [Mon, 17 Mar 2014 05:06:48 +0000 (16:06 +1100)]
ctdb-tests: Add NAT gateway eventscript unit tests for static routes

Signed-off-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed Mar 26 06:24:01 CET 2014 on sn-devel-104

10 years agoctdb-eventscripts: CTDB_NATGW_STATIC_ROUTES can specify gateways
Martin Schwenke [Fri, 7 Mar 2014 04:33:17 +0000 (15:33 +1100)]
ctdb-eventscripts: CTDB_NATGW_STATIC_ROUTES can specify gateways

Extend CTDB_NATGW_STATIC_ROUTES so that each network can have an
optional gateway that overrides CTDB_NATGW_DEFAULT_GATEWAY.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoctdb-eventscripts: New configuration variable CTDB_NATGW_STATIC_ROUTES
Martin Schwenke [Fri, 7 Mar 2014 04:11:36 +0000 (15:11 +1100)]
ctdb-eventscripts: New configuration variable CTDB_NATGW_STATIC_ROUTES

This can be used to create more specific NATGW routes than the usual
NATGW default route.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoctdb-eventscripts: Clarify that CTDB_NATGW_DEFAULT_GATEWAY is optional
Martin Schwenke [Fri, 7 Mar 2014 03:14:16 +0000 (14:14 +1100)]
ctdb-eventscripts: Clarify that CTDB_NATGW_DEFAULT_GATEWAY is optional

This has been implied since the command to add the route has had
errors redirected to /dev/null.  If infrastucture (e.g. ADS, DNS) is
on the same network as CTDB_NATGW_PUBLIC_IP then no route is
necessary.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoctdb-eventscripts: Improve check in NATGW "startup" event
Martin Schwenke [Fri, 7 Mar 2014 03:07:17 +0000 (14:07 +1100)]
ctdb-eventscripts: Improve check in NATGW "startup" event

Although the dots in $CTDB_NATGW_PUBLIC_IP could probably only help
match an invalid public IP address, this is only executed once so do
as exact a check as possible.

Use CTDB_BASE instead of hardcoding /etc/ctdb.

Make the error message less redundant.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoctdb-eventscripts: Reformat natgw_clear()
Martin Schwenke [Fri, 7 Mar 2014 02:55:47 +0000 (13:55 +1100)]
ctdb-eventscripts: Reformat natgw_clear()

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoctdb-eventscripts: Rename some NAT gateway functions
Martin Schwenke [Fri, 7 Mar 2014 02:47:43 +0000 (13:47 +1100)]
ctdb-eventscripts: Rename some NAT gateway functions

delete_all() really needed renaming for clarity.  While doing this,
might as well rename some of the others that don't start with
"natgw_".

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoctdb-tests: Add a test for NAT gateway sanity checking
Martin Schwenke [Sun, 16 Mar 2014 19:15:39 +0000 (06:15 +1100)]
ctdb-tests: Add a test for NAT gateway sanity checking

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoctdb-eventscripts: Sanity check NAT gateway configuration
Martin Schwenke [Fri, 7 Mar 2014 02:43:17 +0000 (13:43 +1100)]
ctdb-eventscripts: Sanity check NAT gateway configuration

NAT gateway really can't operate unless most of the configuration
variables are set.

A check in delete_all() can be removed - strange that this isn't also
done in the add case.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoctdb-eventscripts: Improve readability of NAT gateway update code
Martin Schwenke [Fri, 7 Mar 2014 02:35:03 +0000 (13:35 +1100)]
ctdb-eventscripts: Improve readability of NAT gateway update code

Put the code into a couple of usefully named functions.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoctdb-tests: Add some tests for 11.natgw eventscript
Martin Schwenke [Fri, 14 Mar 2014 05:29:01 +0000 (16:29 +1100)]
ctdb-tests: Add some tests for 11.natgw eventscript

This includes adding support for:

* Configuring fake NATGW state in the eventscript unit tests

* "natgwlist" and "setnatgwstate" in ctdb command stub

* ip command stub to default to "main table" when no table specified,
  allow routes to be added without "dev" option (just add a default
  dev), support "metric" option

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoctdb-eventscripts: Use set_proc() to update /proc
Martin Schwenke [Fri, 7 Mar 2014 02:37:21 +0000 (13:37 +1100)]
ctdb-eventscripts: Use set_proc() to update /proc

In case we want to write some unit tests in the future.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoselftest: Remove print_smbtorture4_version and smbtorture4_possible check
Andrew Bartlett [Thu, 20 Mar 2014 23:42:46 +0000 (12:42 +1300)]
selftest: Remove print_smbtorture4_version and smbtorture4_possible check

smbtorture is now always the same version as the rest of Samba, and is strictly required.

Andrew Bartlett

Change-Id: I89d9c52275477177fa8a89050920ff8a2fec9288
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-By: Jelmer Vernooij <jelmer@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Mar 26 04:20:16 CET 2014 on sn-devel-104

10 years agodsdb: Do checks for invalid renames in samldb, before repl_meta_data
Andrew Bartlett [Mon, 24 Mar 2014 04:15:19 +0000 (17:15 +1300)]
dsdb: Do checks for invalid renames in samldb, before repl_meta_data

This ensures that conflict objects can be created in CN=System, and
that we do not stop replication just because some other DC allowed a
rename we do not like.

This is achived by doing the work in the samldb module, which is above
repl_meta_data in the stack.

Andrew Bartlett

Change-Id: I8c1a7d3e0fbd5a470cf1326cc055044ca885f7d9
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Guenter Kukkukk <kukks@samba.org>
Tested-by: Guenter Kukkukk <kukks@samba.org>
10 years agos3-nmbd: reset debug settings after reading config file (bug #10239)
Björn Baumbach [Wed, 19 Mar 2014 14:01:11 +0000 (15:01 +0100)]
s3-nmbd: reset debug settings after reading config file (bug #10239)

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Mar 25 18:29:06 CET 2014 on sn-devel-104

10 years agos3: smbd: Factor out code that calls getgroups_unix_user() into a separate function.
Jeremy Allison [Sun, 23 Mar 2014 04:23:48 +0000 (21:23 -0700)]
s3: smbd: Factor out code that calls getgroups_unix_user() into a separate function.

This code needs to special-case the guest user, as
this token can have the token_sid[0] set to the Guest
SID, not the mapping of UNIX uid -> SID.

Other users that may have a well-known SID
set in token_sid[0] (like SYSTEM) are usually
not mappable to UNIX users and can be ignored
when adding local groups from /etc/group.

Found by <linux@kukkukk.com>.

Second part of the bugfix for:

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos4:librpc/rpc: use dcerpc_binding_get_object() in order to pass the object to the...
Stefan Metzmacher [Sat, 25 Jan 2014 10:14:36 +0000 (11:14 +0100)]
s4:librpc/rpc: use dcerpc_binding_get_object() in order to pass the object to the epmapper

This way we'll be able to do epmapper lookups for the DFS-R (MS-FRS2) endpoint, by using
"5bc1ed07-f5f5-485f-9dfd-6fd0acf9a23c@ncacn_ip_tcp:hostname.exmple.com[krb5,seal]"
as binding.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Mar 25 02:43:39 CET 2014 on sn-devel-104

10 years agos4:librpc/tests: assert the the abstract syntax has the expected value (null)
Stefan Metzmacher [Fri, 7 Feb 2014 21:17:43 +0000 (22:17 +0100)]
s4:librpc/tests: assert the the abstract syntax has the expected value (null)

This makes sure that it's not mixed with the object guid anymore.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agolibrpc/rpc: finally maintain only the object guid
Stefan Metzmacher [Tue, 11 Mar 2014 07:49:07 +0000 (08:49 +0100)]
librpc/rpc: finally maintain only the object guid

This has nothing to do with ndr_syntax_id...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agolibrpc/rpc: maintain "abstract_syntax" as string option of dcerpc_binding
Stefan Metzmacher [Tue, 4 Feb 2014 12:52:26 +0000 (13:52 +0100)]
librpc/rpc: maintain "abstract_syntax" as string option of dcerpc_binding

This should not be mixed with the object guid! They are different things!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos4:librpc/tests: reset the object on the binding created from the tower
Stefan Metzmacher [Mon, 10 Mar 2014 14:52:49 +0000 (15:52 +0100)]
s4:librpc/tests: reset the object on the binding created from the tower

The tower doesn't contain information about the object only about
the abstract syntax.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos4:torture/raw: fix debug message in torture_raw_qfileinfo_pipe()
Stefan Metzmacher [Thu, 16 Jan 2014 07:23:47 +0000 (08:23 +0100)]
s4:torture/raw: fix debug message in torture_raw_qfileinfo_pipe()

We no longer use dcerpc_pipe_open_smb() there.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos4:torture/rpc: make use of dcerpc_binding_handle_auth_info() in backupkey.c
Stefan Metzmacher [Wed, 22 Jan 2014 10:19:15 +0000 (11:19 +0100)]
s4:torture/rpc: make use of dcerpc_binding_handle_auth_info() in backupkey.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos4:torture/rpc: make use of dcerpc_binding_handle_auth_info() in lsa.c
Stefan Metzmacher [Wed, 22 Jan 2014 10:19:15 +0000 (11:19 +0100)]
s4:torture/rpc: make use of dcerpc_binding_handle_auth_info() in lsa.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos4:torture/rpc: fix altercontext test against windows
Stefan Metzmacher [Wed, 22 Jan 2014 10:18:35 +0000 (11:18 +0100)]
s4:torture/rpc: fix altercontext test against windows

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos4:torture/rpc: remove bogus rpc.multibind test
Stefan Metzmacher [Wed, 22 Jan 2014 11:22:30 +0000 (12:22 +0100)]
s4:torture/rpc: remove bogus rpc.multibind test

We can later add a more useful test that tests
security context multiplexing correctly.

And another one that demonstrates that only DCERPC_BIND
must be the first (and only the first) PDU on a connection.
Otherwise DCERPC_ALTER_CONTEXT is used.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos4:selftest: don't run rpc.multibind anymore
Stefan Metzmacher [Wed, 22 Jan 2014 11:21:50 +0000 (12:21 +0100)]
s4:selftest: don't run rpc.multibind anymore

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos4:dsdb/repl: make use of dcerpc_binding_handle_is_connected()
Stefan Metzmacher [Wed, 22 Jan 2014 13:14:12 +0000 (14:14 +0100)]
s4:dsdb/repl: make use of dcerpc_binding_handle_is_connected()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos4:librpc/test: test ipv6 addresses in dcerpc_binding strings
Stefan Metzmacher [Thu, 13 Feb 2014 17:55:48 +0000 (18:55 +0100)]
s4:librpc/test: test ipv6 addresses in dcerpc_binding strings

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agolibrpc/rpc: handle ipv6 addresses without transport in dcerpc_parse_binding()
Stefan Metzmacher [Thu, 13 Feb 2014 17:55:10 +0000 (18:55 +0100)]
librpc/rpc: handle ipv6 addresses without transport in dcerpc_parse_binding()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agolibrpc/rpc: add "schannel" => DCERPC_SCHANNEL as ncacn_option
Stefan Metzmacher [Tue, 11 Mar 2014 15:28:16 +0000 (16:28 +0100)]
librpc/rpc: add "schannel" => DCERPC_SCHANNEL as ncacn_option

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos4:librpc/tests: add more no transport tests
Stefan Metzmacher [Thu, 13 Feb 2014 17:00:36 +0000 (18:00 +0100)]
s4:librpc/tests: add more no transport tests

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agolib/util: let is_ipaddress_v6() cope with "fe80::1234%3"
Stefan Metzmacher [Thu, 13 Feb 2014 18:51:30 +0000 (19:51 +0100)]
lib/util: let is_ipaddress_v6() cope with "fe80::1234%3"

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos4:librpc/rpc: correctly map the fault code of alter context to NTSTATUS
Stefan Metzmacher [Thu, 16 Jan 2014 08:22:53 +0000 (09:22 +0100)]
s4:librpc/rpc: correctly map the fault code of alter context to NTSTATUS

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos4:librpc/rpc: remove unused dcecli_connection->binding_string
Stefan Metzmacher [Thu, 23 Jan 2014 08:48:20 +0000 (09:48 +0100)]
s4:librpc/rpc: remove unused dcecli_connection->binding_string

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos4:torture/rpc: avoid using dcecli_connection->binding_string
Stefan Metzmacher [Thu, 23 Jan 2014 08:46:55 +0000 (09:46 +0100)]
s4:torture/rpc: avoid using dcecli_connection->binding_string

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agolibrpc/rpc: use dcerpc_binding_set_string_option(b, "endpoint", NULL) to reset the...
Stefan Metzmacher [Tue, 18 Mar 2014 06:07:13 +0000 (07:07 +0100)]
librpc/rpc: use dcerpc_binding_set_string_option(b, "endpoint", NULL) to reset the endpoint

We should always go through just one code path to [re]set a value.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agolibrpc/rpc: let dcerpc_binding_set_transport() also reset the assoc_group_id
Stefan Metzmacher [Tue, 18 Mar 2014 06:07:13 +0000 (07:07 +0100)]
librpc/rpc: let dcerpc_binding_set_transport() also reset the assoc_group_id

This is transport/endpoint specific.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agolibcli/smb: reuse tstream_smbXcli_np_disconnect_send/recv as helper
Stefan Metzmacher [Sun, 16 Mar 2014 10:50:39 +0000 (11:50 +0100)]
libcli/smb: reuse tstream_smbXcli_np_disconnect_send/recv as helper

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agolibcli/smb: add tstream_smbXcli_np_disconnect_cleanup() to handle talloc_free(req)
Stefan Metzmacher [Sun, 16 Mar 2014 10:50:39 +0000 (11:50 +0100)]
libcli/smb: add tstream_smbXcli_np_disconnect_cleanup() to handle talloc_free(req)

If the tevent_req of tstream_smbXcli_np_disconnect_* is explicitly or
implicitly free'ed, we need to make sure we still deliver the
close request to the server! Otherwise the SMB signing sequence gets out of
sync.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agolibcli/smb: make TSTREAM_SMBXCLI_NP_MAX_BUF_SIZE public
Stefan Metzmacher [Wed, 22 Jan 2014 10:29:15 +0000 (11:29 +0100)]
libcli/smb: make TSTREAM_SMBXCLI_NP_MAX_BUF_SIZE public

This should be used to negotiate the may fragment size
of DCERPC connections.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agolibcli/smb: keep references to smbXcli_{conn,session,tcon} in tstream_smbXcli_np
Stefan Metzmacher [Tue, 11 Mar 2014 13:29:46 +0000 (14:29 +0100)]
libcli/smb: keep references to smbXcli_{conn,session,tcon} in tstream_smbXcli_np

This fixes some valgrind errors when the smbXcli_tcon disappears before the
smbXcli_conn.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agos4:torture/rpc: fix error path in torture_leave_domain()
Stefan Metzmacher [Tue, 11 Mar 2014 14:05:37 +0000 (15:05 +0100)]
s4:torture/rpc: fix error path in torture_leave_domain()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
10 years agolibrpc: inline CHECK_SYNTAX macro logic
David Disseldorp [Mon, 24 Mar 2014 15:46:10 +0000 (16:46 +0100)]
librpc: inline CHECK_SYNTAX macro logic

The CHECK_SYNTAX macro is currently used to compare ndr_syntax_ids and
return false on mismatch. Macros affecting control flow are evil!

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Mar 24 21:46:39 CET 2014 on sn-devel-104

10 years agolibrpc: inline VT CHECK macro logic
David Disseldorp [Mon, 24 Mar 2014 15:46:09 +0000 (16:46 +0100)]
librpc: inline VT CHECK macro logic

The CHECK macro is currently used to dump error and return false on
VT condition check failure. Macros affecting control flow are evil!

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agolibrpc: split type specific VT checks into helpers
David Disseldorp [Mon, 24 Mar 2014 15:46:08 +0000 (16:46 +0100)]
librpc: split type specific VT checks into helpers

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agolibrpc: dump correct ndr_syntax_id on VT check failure
David Disseldorp [Mon, 24 Mar 2014 15:46:07 +0000 (16:46 +0100)]
librpc: dump correct ndr_syntax_id on VT check failure

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agos3:build: remove global CLUSTER_SUPPORT define
Stefan Metzmacher [Tue, 21 Jan 2014 13:34:48 +0000 (14:34 +0100)]
s3:build: remove global CLUSTER_SUPPORT define

All ctdb specific code is isolated in samba-cluster-support.so now.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Mon Mar 24 19:08:44 CET 2014 on sn-devel-104

10 years agos3:wscript: only build ctdb_dummy.c if we have no cluster support
Stefan Metzmacher [Tue, 21 Jan 2014 14:26:28 +0000 (15:26 +0100)]
s3:wscript: only build ctdb_dummy.c if we have no cluster support

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos3:wscript: only fill in CTDB_CFLAGS instead of config.h
Stefan Metzmacher [Tue, 8 Oct 2013 10:56:02 +0000 (12:56 +0200)]
s3:wscript: only fill in CTDB_CFLAGS instead of config.h

Only files in 'samba3-ctdb-client' will see HAVE_CTDB* defines.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos3:wscript: don't add ctdb include dir globally
Stefan Metzmacher [Tue, 8 Oct 2013 10:11:49 +0000 (12:11 +0200)]
s3:wscript: don't add ctdb include dir globally

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos3:serverid: use ctdb_serverids_exist_supported() runtime check
Stefan Metzmacher [Tue, 8 Oct 2013 13:31:17 +0000 (15:31 +0200)]
s3:serverid: use ctdb_serverids_exist_supported() runtime check

This is better than a compile time check for
HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos3:ctdb_conn: only use ctdb_protocol.h or ctdb_private.h in ctdb_conn.c
Stefan Metzmacher [Tue, 8 Oct 2013 11:35:41 +0000 (13:35 +0200)]
s3:ctdb_conn: only use ctdb_protocol.h or ctdb_private.h in ctdb_conn.c

We don't need them in ctdb_conn.h.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agowafsamba: use cluster_support_features in build_options.c
Stefan Metzmacher [Tue, 21 Jan 2014 13:32:49 +0000 (14:32 +0100)]
wafsamba: use cluster_support_features in build_options.c

This way 'smbd -b' returns the cluster features of the currently used
libsamba-cluster-support.so.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos3:lib: add cluster_support_[available|features]()
Stefan Metzmacher [Tue, 21 Jan 2014 13:32:30 +0000 (14:32 +0100)]
s3:lib: add cluster_support_[available|features]()

This allows runtime selection of libsamba-cluster-support.so

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos3:param: move lp_ctdbd_socket() to ctdbd_conn.c
Stefan Metzmacher [Tue, 8 Oct 2013 11:33:49 +0000 (13:33 +0200)]
s3:param: move lp_ctdbd_socket() to ctdbd_conn.c

This allows us to use CTDB_PATH only in ctdbd_conn.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos3:lib: move all ctdb related dummy functions to ctdb_dummy.c
Stefan Metzmacher [Tue, 21 Jan 2014 13:25:32 +0000 (14:25 +0100)]
s3:lib: move all ctdb related dummy functions to ctdb_dummy.c

This gets all dummy functions for the build without CLUSTER_SUPPORT.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos3:ctdbd_conn: always provide ctdb_serverids_exist()
Stefan Metzmacher [Tue, 8 Oct 2013 13:30:44 +0000 (15:30 +0200)]
s3:ctdbd_conn: always provide ctdb_serverids_exist()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos3:ctdbd_conn: add ctdb_serverids_exist_supported()
Stefan Metzmacher [Tue, 8 Oct 2013 13:30:16 +0000 (15:30 +0200)]
s3:ctdbd_conn: add ctdb_serverids_exist_supported()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agos3:wscript: create a libsamba-cluster-support.so
Stefan Metzmacher [Tue, 8 Oct 2013 09:52:23 +0000 (11:52 +0200)]
s3:wscript: create a libsamba-cluster-support.so

This collects the ctdb version dependent files,
which allows vendors to provide multiple versions
of libsamba-cluster-support.so each compiled against different
ctdb versions.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agowafsamba: add CONFIG_RESET()
Stefan Metzmacher [Tue, 8 Oct 2013 10:10:54 +0000 (12:10 +0200)]
wafsamba: add CONFIG_RESET()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agolsa.idl: define lsa.ForestTrustCollisionInfo and ForestTrustCollisionRecord as public...
Alexander Bokovoy [Tue, 18 Mar 2014 17:41:38 +0000 (19:41 +0200)]
lsa.idl: define lsa.ForestTrustCollisionInfo and ForestTrustCollisionRecord as public structs

For Python bindings PIDL wants the struct to be defined as public if we
want to use __ndr_print/pack/unpack.

Define the [public] attribute to ForestTrustCollisionInfo/Record to
allow easier debugging when there is collision in establishing a trust.

This change does not affect C code as NDR functions are always
generated, only not exposed in Python bindings.

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

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Autobuild-User(master): Alexander Bokovoy <ab@samba.org>
Autobuild-Date(master): Mon Mar 24 12:44:50 CET 2014 on sn-devel-104

10 years agoctdb/daemon: Optimise deletion of IPs
Martin Schwenke [Wed, 22 Jan 2014 06:01:19 +0000 (17:01 +1100)]
ctdb/daemon: Optimise deletion of IPs

Previous commits maintained the ordering between
ctdb_remove_orphaned_ifaces() and ctdb_vnn_unassign_iface().  This
meant that ctdb_remove_orphaned_ifaces() needed to steal the orphaned
interfaces and they would be freed later.

Unassign the interface first and things get simpler.
ctdb_remove_orphaned_ifaces() is now self-contained.

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): Sun Mar 23 06:20:43 CET 2014 on sn-devel-104

10 years agoctdb/daemon: Make delete IP wait until the IP is released
Martin Schwenke [Wed, 22 Jan 2014 02:30:47 +0000 (13:30 +1100)]
ctdb/daemon: Make delete IP wait until the IP is released

reloadips really expects deleted IPs to be released before completing.
Otherwise the recovery daemon starts failing the local IP check.  The
races that follow can cause a node to be banned.

To make the error handling simple, do the actual deletion in
release_ip_callback().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tests: Improve tickle tests
Martin Schwenke [Fri, 28 Feb 2014 04:54:05 +0000 (15:54 +1100)]
ctdb-tests: Improve tickle tests

It is hard to diagnose failures in the NFS tickle test because there's
no way of telling if the test node doesn't have the tickle or if it
didn't get propagated.

Factor out check_tickles() into local.bash and give it some
parameters.

Have the NFS test call it first to ensure the tickle has been
registered.  Then use new function check_tickles_all() to ensure the
tickle has been propagated to all nodes.  Give this a bit of extra
time (double the timeout) just in case we're racing with the update.

Add a useful comment to the CIFS test so that I stop asking myself how
the test could ever have worked reliably.  :-)

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

10 years agoctdb-eventscripts: Fix regression in IP add/delete functions
Martin Schwenke [Fri, 14 Mar 2014 02:14:18 +0000 (13:14 +1100)]
ctdb-eventscripts: Fix regression in IP add/delete functions

Commit 176ae6c704528c021fcc34a41878584f43a00119 caused these functions
to exit on failure.  This is incorrect and broke NAT gateway.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-daemon: Do not disable monitoring when running eventscripts
Martin Schwenke [Tue, 4 Mar 2014 04:06:11 +0000 (15:06 +1100)]
ctdb-daemon: Do not disable monitoring when running eventscripts

This is racy and cbffbb7c2f406fc1d8ebad3c531cc2757232690e makes it
unnecessary.

The eventscript code still knows that monitor events are special
compared to other events.  However, the general concept of monitoring
is no longer tangled up with running scripts.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-eventscripts: Attach to persistent ctdb.tdb in "startup" event
Martin Schwenke [Sun, 2 Mar 2014 18:50:14 +0000 (05:50 +1100)]
ctdb-eventscripts: Attach to persistent ctdb.tdb in "startup" event

"statd-callout notify" currently complains until an add-client or
del-client is done.

Given that we might use ctdb.tdb for something else in the future it
makes sense attach to it in the "startup" event.  This could be done
in the background but it should be so lightweight that a timeout will
indicate serious problems.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-daemon: Fix tickle updates to recently started nodes
Martin Schwenke [Thu, 13 Mar 2014 05:53:15 +0000 (16:53 +1100)]
ctdb-daemon: Fix tickle updates to recently started nodes

Commit 0723fedcedd4a97870f7b1224945f1587363c9bf added a cheap
implemention of ctdb_control_startup() that simply flags the recipient
node as needing to send updates for each IP when the tickle update
loop next fires.  Commit 026996550d726836091ff5ebd1ebf925bf237bb0
ensures that a node only sends tickle updates once being flagged to do
so.

CTDB_CONTROL_STARTUP is broadcast to all nodes, so this is a good
start.  However, the tickle updates are only broadcast to connected
nodes.  A recently started node may not yet be considered to be
connected because the keepalive monitoring loop may not yet have
marked the node as connected.  This means that the tickle update loop
races with the keepalive monitoring loop.  If the tickle update loop
wins then updates will not be sent to the recently started node.

The simplest improvement is to stop the tickle update from depending
on whether a node is connected or not.  So instead of broadcasting
tickle updates to connected nodes, they are broadcast to all nodes.
Since no reply is expected, this should work just fine.

While looking at this code, ctdb_ctrl_set_tcp_tickles() is named like
a client function.  It isn't a client function.  Also, 2 of the
arguments are ignored.  So rename this function to
ctdb_send_set_tcp_tickles_for_ip() and remove the ignored arguments.

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

10 years agoctdb-tools-ctdb: Parse IP addresses when reading a list from a file
Martin Schwenke [Mon, 3 Mar 2014 02:20:06 +0000 (13:20 +1100)]
ctdb-tools-ctdb: Parse IP addresses when reading a list from a file

This way this logic is centralised.  It also means that the IP address
comparisons in the NAT gateway code are IPv6 safe.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tools-ctdb: Remove redundant filtering of trailing empty lines
Martin Schwenke [Mon, 3 Mar 2014 05:23:42 +0000 (16:23 +1100)]
ctdb-tools-ctdb: Remove redundant filtering of trailing empty lines

There is a check for empty lines in the loop just below.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tools-ctdb: Use DLIST_ADD_END() to avoid reversing the list
Martin Schwenke [Mon, 3 Mar 2014 02:04:25 +0000 (13:04 +1100)]
ctdb-tools-ctdb: Use DLIST_ADD_END() to avoid reversing the list

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tools-ctdb: Factor out function read_pnn_node_file()
Martin Schwenke [Mon, 3 Mar 2014 01:57:30 +0000 (12:57 +1100)]
ctdb-tools-ctdb: Factor out function read_pnn_node_file()

Factor it from read_nodes_file().  Use it there and in
read_natgw_nodes_file().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tests: Add "ctdb listnodes" and "ctdb xpnn" stub tests
Martin Schwenke [Mon, 17 Mar 2014 02:42:35 +0000 (13:42 +1100)]
ctdb-tests: Add "ctdb listnodes" and "ctdb xpnn" stub tests

Tests for xpnn need to implement a stub for ctdb_sys_have_ip().  The
cheapest way of doing this is to read a fake nodemap using the
existing code and check if the IP of the "current" node is the one
being asked about.  However, the fake state initialisation isn't
currently available to without_daemon commands because it is meant to
represent daemon state.  However, it can be made available by moving
the relevant code into a new stub for tevent_context_init().  The stub
still needs to initialise a tevent context - this can be done by
calling a lower level function.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tools-ctdb: Read NAT gateway nodes from a separate function
Martin Schwenke [Mon, 3 Mar 2014 01:45:23 +0000 (12:45 +1100)]
ctdb-tools-ctdb: Read NAT gateway nodes from a separate function

Now it gets easier to refactor.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tools-ctdb: Add and use function filter_nodemap_by_natgw_nodes()
Martin Schwenke [Mon, 3 Mar 2014 00:41:32 +0000 (11:41 +1100)]
ctdb-tools-ctdb: Add and use function filter_nodemap_by_natgw_nodes()

Add another filter function, like the ones for capabilities and flags
to, for filtering by NAT gateway nodes.  This makes the main
natgw_list function more readable.

Note that this drops the early filtering of disconnected nodes, so
they will now be listed in a NAT gateway group.  This makes sense.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tools-ctdb: Update LVS commands to use filter_nodemap_by_flags()
Martin Schwenke [Wed, 19 Feb 2014 07:45:18 +0000 (18:45 +1100)]
ctdb-tools-ctdb: Update LVS commands to use filter_nodemap_by_flags()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tools-ctdb: Update LVS commands to use filter_nodemap_by_capabilities()
Martin Schwenke [Wed, 19 Feb 2014 06:12:08 +0000 (17:12 +1100)]
ctdb-tools-ctdb: Update LVS commands to use filter_nodemap_by_capabilities()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tools-ctdb: Fixes for "lvs" and "lvsmaster" commands
Martin Schwenke [Fri, 28 Feb 2014 09:16:34 +0000 (20:16 +1100)]
ctdb-tools-ctdb: Fixes for "lvs" and "lvsmaster" commands

The index of the nodes array in nodemap isn't the PNN.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tools-ctdb: Generalise find_natgw() -> filter_nodemap_by_flags()
Martin Schwenke [Tue, 18 Feb 2014 06:11:53 +0000 (17:11 +1100)]
ctdb-tools-ctdb: Generalise find_natgw() -> filter_nodemap_by_flags()

Instead of just finding the first node that doesn't have any flags in
flag_mask set, change it into a function that filters a nodemap to
exclude nodes with the given flags.

This makes the NATGW code simpler but also provides a function that
can be used in other code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tools-ctdb: Update natgwlist to filter nodes by NATGW capability
Martin Schwenke [Tue, 18 Feb 2014 04:52:37 +0000 (15:52 +1100)]
ctdb-tools-ctdb: Update natgwlist to filter nodes by NATGW capability

Check capabilities once to build a filtered node list instead of
repeatedly checking capabilities

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tests: New natgwlist tests where nodes capability not set
Martin Schwenke [Tue, 18 Feb 2014 01:29:44 +0000 (12:29 +1100)]
ctdb-tests: New natgwlist tests where nodes capability not set

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tests: Update ctdb stub LVS tests and add some new ones
Martin Schwenke [Tue, 18 Feb 2014 01:12:06 +0000 (12:12 +1100)]
ctdb-tests: Update ctdb stub LVS tests and add some new ones

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tests: Support fake capabilities in CTDB tool stub
Martin Schwenke [Tue, 18 Feb 2014 00:34:11 +0000 (11:34 +1100)]
ctdb-tests: Support fake capabilities in CTDB tool stub

... and add a test to make sure it works.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tests: Remove old, unused copy of a CTDB tool unit test
Martin Schwenke [Tue, 18 Feb 2014 00:02:49 +0000 (11:02 +1100)]
ctdb-tests: Remove old, unused copy of a CTDB tool unit test

This looks to have got left behind a long time ago when things got
moved around...

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb-tools-ctdb: Don't close stderr when running without_daemon commands
Martin Schwenke [Mon, 17 Mar 2014 02:28:14 +0000 (13:28 +1100)]
ctdb-tools-ctdb: Don't close stderr when running without_daemon commands

It looks like the original without_daemon code still tried to
establish a client connection to the daemon.  Closing stderr looks to
be a cheap way of hiding the errors when this failed.

However, later cleanups avoid the client connection altogether, so do
not close stderr.  Now debug output from without_daemon commands
actually appears.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb/pmda: Fix metric identifiers
David Disseldorp [Thu, 20 Mar 2014 13:23:01 +0000 (14:23 +0100)]
ctdb/pmda: Fix metric identifiers

The commit "pmda: Use upstream assigned PCP domain id" updated the
Performance Metrics Namespace (pmns) file, without changing the
corresponding metric identifiers used by the agent.

This change fixes the agent metric identifier values to match the pmns
definitions.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Mar 22 00:07:31 CET 2014 on sn-devel-104

10 years agosmbd: Remove unused "share_mode_data->id"
Volker Lendecke [Thu, 20 Mar 2014 13:58:19 +0000 (14:58 +0100)]
smbd: Remove unused "share_mode_data->id"

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): Fri Mar 21 21:22:24 CET 2014 on sn-devel-104

10 years agosmbd: Keep "the_lock"s file id separately
Volker Lendecke [Thu, 20 Mar 2014 13:57:19 +0000 (14:57 +0100)]
smbd: Keep "the_lock"s file id separately

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agosmbd: Avoid checking the_lock->id for fresh locks
Volker Lendecke [Thu, 20 Mar 2014 13:53:14 +0000 (14:53 +0100)]
smbd: Avoid checking the_lock->id for fresh locks

If we just fetched the lock, this check will always be true.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agosmbd: Explicitly pass "file_id" to rename_share_filename
Volker Lendecke [Thu, 20 Mar 2014 13:36:11 +0000 (14:36 +0100)]
smbd: Explicitly pass "file_id" to rename_share_filename

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agosmbd: Use fsp->file_id in open_file_ntcreate
Volker Lendecke [Thu, 20 Mar 2014 13:45:42 +0000 (14:45 +0100)]
smbd: Use fsp->file_id in open_file_ntcreate

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agosmbd: Explicitly pass "file_id" to schedule_defer_open
Volker Lendecke [Thu, 20 Mar 2014 13:36:11 +0000 (14:36 +0100)]
smbd: Explicitly pass "file_id" to schedule_defer_open

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agosmbd: Explicitly pass "file_id" to rename_open_files
Volker Lendecke [Thu, 20 Mar 2014 13:36:11 +0000 (14:36 +0100)]
smbd: Explicitly pass "file_id" to rename_open_files

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 years agodfs_server: randomize the server redirect set
Arvid Requate [Thu, 20 Mar 2014 21:49:08 +0000 (22:49 +0100)]
dfs_server: randomize the server redirect set

comply with [MS-DFSC] section 3.2.1.1

Signed-off-by: Arvid Requate <requate@univention.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agos3: smbd: Ensure we always go via getgroups_unix_user() when creating an NT token.
Jeremy Allison [Thu, 20 Mar 2014 19:39:10 +0000 (12:39 -0700)]
s3: smbd: Ensure we always go via getgroups_unix_user() when creating an NT token.

This has to be done in every code path that creates
an NT token, as remote users may have been added to
the local /etc/group database. Tokens created merely
from the info3 structs (via the DC or via the krb5 PAC)
won't have these local groups.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Simo Sorce <idra@samba.org>
10 years agobuild: Exclude source4/selftest/provisions/release-4-1-0rc3 from the tarball
Andrew Bartlett [Mon, 3 Mar 2014 01:26:36 +0000 (14:26 +1300)]
build: Exclude source4/selftest/provisions/release-4-1-0rc3 from the tarball

Change-Id: Id4ddaabb91363174d2fbef09e823f53b13912a51
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Mar 21 10:06:04 CET 2014 on sn-devel-104

10 years agodbcheck: Ensure dbcheck can operate with --attrs set
Andrew Bartlett [Thu, 27 Feb 2014 02:17:35 +0000 (15:17 +1300)]
dbcheck: Ensure dbcheck can operate with --attrs set

This also includes a test to ensure we do not regress on this point.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agos3-rpc_server: Fix handling of fragmented rpc requests.
Andreas Schneider [Thu, 20 Mar 2014 13:45:01 +0000 (14:45 +0100)]
s3-rpc_server: Fix handling of fragmented rpc requests.

We need to call pipe_init_outgoing_data() as the first thing in
process_complete_pdu(). Otherwise the caller may use uninitialized
memory and tries to write a response into the socket.

The problem happens only if a real socket is used, which means
in all cases for master and only with external rpc daemons in v4-0
and v4-1.

The problem looks like this in the logs.

    [2014/03/20 14:49:35.531663, 10, pid=7309, effective(0, 0), real(0, 0), class=rpc_srv] ../source3/rpc_server/srv_pipe.c:1627(process_complete_pdu)
      Processing packet type 0
    [2014/03/20 14:49:35.531695, 10, pid=7309, effective(0, 0), real(0, 0), class=rpc_srv] ../source3/rpc_server/srv_pipe.c:1472(dcesrv_auth_request)
      Checking request auth.
    [2014/03/20 14:49:35.531738, 10, pid=7309, effective(0, 0), real(0, 0)] ../source3/rpc_server/rpc_server.c:521(named_pipe_packet_process)
      Sending 1 fragments in a total of 0 bytes
    [2014/03/20 14:49:35.531769, 10, pid=7309, effective(0, 0), real(0, 0)] ../source3/rpc_server/rpc_server.c:526(named_pipe_packet_process)
      Sending PDU number: 0, PDU Length: 4294967228
    [2014/03/20 14:49:35.531801,  2, pid=7309, effective(0, 0), real(0, 0)] ../source3/rpc_server/rpc_server.c:565(named_pipe_packet_done)
      Writev failed!
    [2014/03/20 14:49:35.531845,  2, pid=7309, effective(0, 0), real(0, 0)] ../source3/rpc_server/rpc_server.c:595(named_pipe_packet_done)
      Fatal error(Message too long). Terminating client(127.0.0.1) connection!

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Guenther Deschner <gd@samba.org
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Mar 20 18:30:17 CET 2014 on sn-devel-104

10 years agos4-torture: add some tests for pre-allocated buffers in enumprinterdrivers call.
Günther Deschner [Thu, 20 Mar 2014 14:57:10 +0000 (15:57 +0100)]
s4-torture: add some tests for pre-allocated buffers in enumprinterdrivers call.

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>