summaryrefslogtreecommitdiff
path: root/source4/lib/messaging
AgeCommit message (Collapse)AuthorFilesLines
2018-07-12s4:messaging: make sure only imessaging_client_init() can be used with a ↵Stefan Metzmacher1-2/+26
wrapper tevent_context wrapper imessaging_client_init() can be used with a wrapper tevent_context, but only if a global messaging_dgm_ref() already exist. All other uses of imessaging_init() and imessaging_client_init() require a raw tevent_context. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Thu Jul 12 02:23:37 CEST 2018 on sn-devel-144
2018-07-11s4:messaging: allow imessaging_post_handler() to free the messaging context ↵Stefan Metzmacher1-0/+33
from a handler In usecases like using messaging_client_init() with irpc processing we may free the imessaging_context during the messaging handler. imessaging_post_handler() is not yet really used, but it will change in the next commits. imessaging_post_state is a child of imessaging_context and might be implicitly free'ed before the explicit TALLOC_FREE(state). Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2018-07-10s4:messaging: add local.messaging.multi_ctx.multi_ctx testStefan Metzmacher1-0/+221
This tests the usage of multiple imessaging_contexts in one process and also freeing two of them during a message handler. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13514 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2018-04-13wscript_build: make sure we link extra-python versions of librariesNoel Power1-1/+1
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2017-10-23python: Port samba.messaging module to Python 3 compatible form.Lumir Balhar2-11/+25
Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Andrew Bartlet <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2017-04-26s4-messaging: Add helpful commentsAndrew Bartlett1-0/+7
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): Wed Apr 26 03:09:19 CEST 2017 on sn-devel-144
2017-04-17s4: messaging: When talloc_free()'ing an event context, only remove ↵Jeremy Allison2-4/+6
msg_dgm_ref's that point to *that* context. Defensive programming change. Not strictly needed to prevent any crash/error. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2017-04-17s4: messaging. Minor cleanup. Check for error returns on imessaging_register ↵Jeremy Allison1-5/+23
calls. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2017-03-31s4: messaging. Add imessaging_reinit_all() function.Jeremy Allison2-0/+44
Ensure it is called from process_standard.c after every fork(). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Fri Mar 31 14:48:17 CEST 2017 on sn-devel-144
2017-03-29s4-messaging: split up messaging into a smaller library for send onlyAndrew Bartlett3-80/+121
This will help avoid a dep loop when the low-level auth code relies on the message code to deliver authentication messages Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2017-03-28pymessaging: add single element tupple form of the server_idGary Lockyer1-1/+8
This avoids the python code needing to call getpid() internally, while declaring a stable task_id. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-03-28pymessaging: Add a hook to run the event loop, make callbacks practicalAndrew Bartlett3-26/+117
These change allow us to write a messaging server in python. The previous ping_speed test did not actually test anything, so we use .loop_once() to make it actually work. To enable practial use a context is supplied in the tuple with the callback, and the server_id for the reply is not placed inside an additional tuple. In order to get at the internal event context on which to loop, we expose imessaging_context in messaging_internal.h and allow the python bindings to use that header. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-03-28pymessaging: Add irpc_remove_nameAndrew Bartlett1-0/+18
This allows tests to be indirectly added for server_id_db_lookup() and server_id_db_prune_name() Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> BUG: https://bugzilla.samba.org/show_bug.cgi?id=12705
2017-03-28pymessaging: Add support for irpc_add_nameAndrew Bartlett1-1/+25
This allows tests to be indirectly added for server_id_db_lookup() Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz> Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> BUG: https://bugzilla.samba.org/show_bug.cgi?id=12705
2017-01-22lib: Add lib/util/server_id.hVolker Lendecke1-0/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2017-01-20s4/messaging: register for MSG_REQ_RINGBUF_LOGRalph Boehme1-0/+22
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2016-10-14messaging: Fix CID 1373625 Unused valueVolker Lendecke1-0/+1
Hmm. I wonder how that cut&paste happened... Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-10-13messaging: add an overflow checkVolker Lendecke1-1/+186
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-10-05messaging4: Postpone messages to the right tevent contextVolker Lendecke1-0/+65
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-10-05messages_dgm_ref: Pass receiving "ev" to recv_cbVolker Lendecke1-2/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-10-05messaging: add an overflow testVolker Lendecke1-0/+76
Send 1000 messages without picking them up. Then destroy the sending messaging context. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-10-05messaging4: Fix signed/unsigned hickupsVolker Lendecke1-2/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-19s4/messaging: let the imessaging ctx destructor free msg_dgm_refRalph Boehme1-0/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12272 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-13messaging: Call messaging_dgm_send under become_root only if necessaryRalph Boehme1-2/+7
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-13s4/messaging: messaging_dgm_ref talloc hierarchy fixRalph Boehme2-0/+30
Ensure the messaging dgm context goes away *before* the tevent context. The messaging dgm context will likely have active fd or timer events, their rundown will touch the associated tevent context. Otoh, I deliberately don't free the imessaging context here, that's going to happen as part of freeing the talloc_autofree_context() as before. I think it suffers the same problem, eg imessaging_deregister() works on an imessaging_context that might already be freed. But as it works, don't change it. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-23s4: messaging: Remove bool auto_remove parameter from imessaging_init().Jeremy Allison5-20/+8
With modern messaging this doesn't do anything (it's an empty destructor). Clean up so we can add a proper destructor in future. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-07-12pyrpc: Allow control of RPC timeout for IRPCAndrew Bartlett1-0/+2
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-03-15build: mark explicit dependencies on pytalloc-utilGarming Sam1-1/+1
All subsystems that include pytalloc.h need to link against pytalloc-util. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11789 Signed-off-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): Tue Mar 15 07:08:16 CET 2016 on sn-devel-144
2016-01-07pymessaging: Adjust to use of PY_SSIZE_T_CLEANAndrew Bartlett1-1/+1
This changes the type used for # arguments to PyArg_ParseTupleAndKeywords Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2015-10-20s4:lib/messaging: use a helper variable for tdb flagsRalph Boehme1-4/+4
Small refactoring that eliminates a nested function call. These are a pita when stepping with gdb. Bug: https://bugzilla.samba.org/show_bug.cgi?id=11562 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Tue Oct 20 14:54:57 CEST 2015 on sn-devel-104
2015-10-20s4:lib/messaging: use correct path for names.tdbRalph Boehme1-1/+7
source3 messaging_init() calls server_id_db_init() (where names.tdb is created) with lock_path. source4 imessaging_init() otoh wrongly used the special lock_path subdirectory "msg.lock": > find /opt/samba/ -name names.tdb /opt/samba/var/lock/msg.lock/names.tdb /opt/samba/var/lock/names.tdb > tdbdump /opt/samba/var/lock/names.tdb { key(14) = "notify-daemon\00" data(27) = "28609/12756565486113779780\00" } > tdbdump /opt/samba/var/lock/msg.lock/names.tdb { key(15) = "winbind_server\00" data(8) = "28593/0\00" } With this patch both source3 and source4 messaging now use the same names.tdb which is what we want: > find /opt/samba/ -name names.tdb /opt/samba/var/lock/names.tdb > tdbdump /opt/samba/var/lock/names.tdb { key(15) = "winbind_server\00" data(8) = "26434/0\00" } { key(14) = "notify-daemon\00" data(26) = "26452/3454520012124001687\00" } Bug: https://bugzilla.samba.org/show_bug.cgi?id=11562 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-10-19lib: Push down unique generation one levelVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2015-09-17s4:lib/messaging: use 'msg.lock' and 'msg.sock' for messaging related subdirsStefan Metzmacher1-2/+2
In Samba 4.2, we used lock_path("msg") (with 0700) for the socket directory, while we use lock_path("msg") (with 0755) for the lock file directory. This generates a conflict that prevents samba, smbd, nmbd and winbindd from starting after an upgrade. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11515 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Thu Sep 17 09:04:59 CEST 2015 on sn-devel-104
2015-02-16s4-messaging: Unify list of possible messages into messaging.idlAndrew Bartlett1-16/+1
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Pair-programmed-with: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Feb 16 14:48:41 CET 2015 on sn-devel-104
2015-02-16s4-messaging: Remove unused struct imessaging_recAndrew Bartlett1-19/+0
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Pair-programmed-with: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org>
2015-02-14messaging4: Enable POOL_USAGEVolker Lendecke3-2/+22
With this you can watch "samba"'s talloc hierarchy live using smbcontrol <pid> pool-usage Enjoy :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Sat Feb 14 01:59:19 CET 2015 on sn-devel-104
2015-02-13messaging4: Use messages_dgmVolker Lendecke2-337/+107
This replaces the transport mechanism in source4 with calls to the messages_dgm code. It is supposed to enable "smbcontrol samba pool-usage" as an example without having to rewrite smbcontrol using the source4 based messaging subsystem. This moves the source3 based names.tdb (which is unused so far) to the lock directory, source4 does not have a cache directory. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-02-13messaging4: Use server_id_dbVolker Lendecke2-126/+30
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-11-27messaging4: Fix typesVolker Lendecke1-2/+12
According to python docs, PyArg_ParseTuple takes "int" and "unsigned long long". With pointers down to functions, in particular with varargs, there is no automatic conversion. So we need to be very strict about types. Automatic conversion to for example uint64_t happes only with assignment. This fixes a crash on FreeBSD10/clang. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <rb@sernet.de> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Nov 27 21:32:18 CET 2014 on sn-devel-104
2014-11-25s4:lib/messaging: remove unused allow_warnings=TrueStefan Metzmacher1-1/+0
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2014-09-18messaging4: Fix an error path memleakVolker Lendecke1-0/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-07-29messaging4: Simplify imessaging_pathVolker Lendecke1-9/+4
Use server_id_str_buf 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): Tue Jul 29 00:30:55 CEST 2014 on sn-devel-104
2014-07-24messaging4: Simplify ping_message with server_id_str_buf()Volker Lendecke1-3/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-07-22messaging4: Fix a just-introduced error memleakVolker Lendecke1-0/+5
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Jul 22 15:31:38 CEST 2014 on sn-devel-104
2014-07-21messaging4: Change irpc_servers_by_name to NTSTATUSVolker Lendecke3-30/+36
For me, counted arrays are easier to deal with than NULL-terminated ones. Here we also had a "server_id_is_disconnection" convention, which was not really obvious. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Jul 21 20:28:53 CEST 2014 on sn-devel-104
2014-07-21messaging4: Fix a memleak in an error pathVolker Lendecke1-0/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-07-21messaging4: Remove unnecessary lockingVolker Lendecke1-6/+0
We don't do any modifying operations on the database, so locking is not needed here Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-07-21messaging4: Remove an unused NTSTATUS varVolker Lendecke1-2/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-07-21messaging4: Move str_list_addVolker Lendecke1-6/+7
If this fails, we'd have to revert the tdb_append. str_list_remove is simpler :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-07-21messaging4: Add NULL check to irpc_add_nameVolker Lendecke1-0/+3
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>