summaryrefslogtreecommitdiff
path: root/source3/smbd/server.c
Commit message (Collapse)AuthorAgeFilesLines
* s3:rpc_server: Return NTSTATUS in rpc_ep_setup and setup functionsSamuel Cabrero2019-07-221-1/+3
| | | | | | Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:notifyd: Handle sigup in notifyd to reparse smb.confShyamsunder Rathi2019-06-271-1/+23
| | | | | | | | | | | | | | | | | | | At present, SIGHUP is blocked on notifyd. So, if parent smbd is started with "log level" 10 in smb.conf, and later changed to 0, the SIGHUP will not change the log level to 0 in notify smbd process and it will keep printing verbose logs in the corresponding log files. Proposed fix is to write a SIGHUP handler for notifyd and set it to reload services. Reviewed-by: Hemanth Thummala <hemanth.thummala@nutanix.com> Signed-off-by: Shyamsunder Rathi <shyam.rathi@nutanix.com> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by:Volker Lendecke <vl@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Jun 27 17:57:12 UTC 2019 on sn-devel-184
* smbd: Remove unused brlock codeVolker Lendecke2019-06-201-82/+0
| | | | | | | No PENDING locks in brlock.tdb anymore. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:smbd: call reinit_guest_session_info() in the conf updated handlerRalph Boehme2019-06-051-0/+6
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13944 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3: smbd: Don't log at WARNING level when exiting the server on error.Richard Sharpe2019-05-161-1/+1
| | | | | Signed-off-by: Richard Sharpe <realrichardsharpe@gmail.com> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Remove some unused includesVolker Lendecke2019-04-111-1/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* rpc_server: Give mdssd its header fileVolker Lendecke2019-03-181-3/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* rpc_server: Give fssd its header fileVolker Lendecke2019-03-181-3/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* rpc_server: Give lsasd its header fileVolker Lendecke2019-03-181-3/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* rpc_server: Give epmd its header fileVolker Lendecke2019-03-181-3/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:smbd: Use C99 initializer for poptOption in smbd serverAndreas Schneider2019-01-281-11/+67
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* s3:smbd: prepare the usage of per_thread_cwd_*() functionsStefan Metzmacher2019-01-111-0/+7
| | | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3 server: Add support for smbcontrol sleepGary Lockyer2018-12-191-0/+34
| | | | | | | | | | Add a sleep command that pauses the target process for the specified number of seconds This command is only enabled on self test and developer builds. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:smbd: Use #ifdef instead of #if for config.h definitionsAndreas Schneider2018-11-281-3/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* s3: Rename server_messaging_context() to global_messaging_context()Christof Schmitt2018-09-071-1/+1
| | | | | | | | | | | This reflects that the messaging context is also used outside of the server processes. The command used for the rename: find . -name '*.[hc]' -print0 | xargs -0 sed -i 's/server_messaging_context/global_messaging_context/' Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: Rename server_event_context() to global_event_context()Christof Schmitt2018-09-071-1/+1
| | | | | | | | | | | This reflects that the event context is also used outside of the server processes. The command used for the rename: find . -name '*.[hc]' -print0 | xargs -0 sed -i 's/server_event_context/global_event_context/' Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* smbd: Call smbXsrv_client_global_init in the parent smbdVolker Lendecke2018-05-251-0/+5
| | | | | | | | | | | Otherwise we're missing the clear-if-first optimization for smbXsrv_client_global.tdb. 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): Fri May 25 16:00:08 CEST 2018 on sn-devel-144
* s3:cleanupd: use MSG_SMB_BRL_VALIDATE to signal cleanupd unclean process ↵Ralph Boehme2018-05-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | shutdown Since 6423ca4bf293cac5e2f84b1a37bb29b06b5c05ed messaging_send_all() broadcasts messages in a cluster, so cleanupd receives those broadcasts and acts upon it by re-broadcasting the message. Result: message storm. By reactivating the currently unused MSG_SMB_BRL_VALIDATE for the trigger message to cleanupd we avoid the storm. Note that MSG_SMB_BRL_VALIDATE was unused only in the sense that noone *listened* to it, but we were still *sending* the message in smbd_parent_ctdb_reconfigured(). de6fe2a1dd6ab03b1c369b61da17fded72305b2d removed listening for MSG_SMB_BRL_VALIDATE from cleanupd. This commits brings it back. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13414 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:auth: Pass mem_ctx to init_system_session_info()Andreas Schneider2018-02-211-1/+1
| | | | | | | | | | We have a stackframe we can use for the lifetime of the session. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Feb 21 02:46:40 CET 2018 on sn-devel-144
* s3:auth: Pass mem_ctx to init_guest_session_info()Andreas Schneider2018-02-201-1/+1
| | | | | | | Use a mem_ctx which gets freed if possible. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Make g_lock_dump use TDB_DATAVolker Lendecke2018-02-081-1/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Make g_lock_write_data use TDB_DATAVolker Lendecke2018-02-081-1/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Make g_lock_unlock use TDB_DATAVolker Lendecke2018-02-081-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Make g_lock_lock use TDB_DATAVolker Lendecke2018-02-081-3/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* source3/smbd/server.c set socket close on execGary Lockyer2017-12-181-0/+1
| | | | | | | | | | Set SOCKET_CLOEXEC on the sockets returned by accept. This ensures that the socket is unavailable to any child process created by system(). Making it harder for malicious code to set up a command channel, as seen in the exploit for CVE-2015-0240 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib: Remove unused serverid.tdbVolker Lendecke2017-12-051-20/+0
| | | | | | | | 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 Dec 5 04:58:26 CET 2017 on sn-devel-144
* s4:samba: Allow samba daemon to run in foregroundAndreas Schneider2017-11-281-1/+1
| | | | | | | | | | | | | | We are passing the no_process_group to become_daemon() that setsid() is not called. In case we are double forking, we run in SysV daemon mode, setsid() should be called! See: https://www.freedesktop.org/software/systemd/man/daemon.html BUG: https://bugzilla.samba.org/show_bug.cgi?id=13129 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ctdb_conn: Use messaging_ctdb_connectionVolker Lendecke2017-07-251-3/+3
| | | | | | | Replace messaging_ctdbd_connection Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* ctdbd_conn: Pass "ev" through ctdb connection callbacksVolker Lendecke2017-07-251-0/+1
| | | | | | | | | This prepares the same logic we've implemented in messages_dgm for clustering that is used in 6d3c064f1a5: We need to reply for messages from ctdb in nested event contexts properly. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3/notifyd: ensure notifyd doesn't return from smbd_notifyd_initRalph Boehme2017-07-151-1/+7
| | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=12910 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* notifyd: Only ask for messaging_ctdb_conn when clusteringVolker Lendecke2017-07-071-2/+6
| | | | | | | | | Without clustering, messaging_ctdb_conn will fail anyway. Review with "git show -b". Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Give messages_ctdbd.c its own headerVolker Lendecke2017-06-211-0/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Claim version in g_lockVolker Lendecke2017-06-151-0/+114
| | | | | | | | | | | | | | | Protect smbd against version incompatibilities in a cluster. At first startup smbd locks "samba_version_string" and writes its version string. It then downgrades the lock to a read lock. Subsequent smbds check against the version string and also keep the read lock around. If the version does not match, we try to write our own version. But as there's a read lock, the lock upgrade to write lock will fail due the read lock being around. So as long as there's one smbd with this read lock, no other version of smbd will be able to start. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Add lib/util/server_id.hVolker Lendecke2017-01-221-0/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: server: s3_tevent_context_init() -> samba_tevent_context_init()Jeremy Allison2016-09-241-1/+0
| | | | | | | | We can now remove source3/lib/events.c Bug: https://bugzilla.samba.org/show_bug.cgi?id=12283 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3/smbd: use correct talloc memory context for tevent subrequestsRalph Boehme2016-09-191-4/+4
| | | | | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Mon Sep 19 23:25:37 CEST 2016 on sn-devel-144
* s3/notifyd: add async send/recv functionsRalph Boehme2016-07-281-3/+108
| | | | | | | | | | | | | | | Previously, without this patch, if notifyd died for whatever reason, it would be restarted from smbd. However, if its initialization failed and it exitted again, there would be no child entry in smbd for it and it wouldn't be attempted to restart it again. This patch adds async send/recv methods for starting cleanupd that will reschedule restart attempt every second in case initilisation failed. Bug: https://bugzilla.samba.org/show_bug.cgi?id=12022 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3/cleanupd: use smbd_cleanupd.tdbRalph Boehme2016-07-281-11/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using messaging to send individual cleanup events, it works this way: o parent smbd stores cleanup events (ie exitted children) in smbd_cleanup.tdb o it sends cleanupd an empty MSG_SMB_NOTIFY_CLEANUP message o cleanupd does a traverse on the smbd_cleanupd.tdb and collects all childs in a list o after the traverse cleanupd walks the list and does the real work It would have been possible to optimize for the common case by passing info about exitted childs with the message (as was done before this patch), adding a new message type for triggering a db traverse that would be used when cleanupd had to be restarted and cleanup events may have been accumulated in cleanup.tdb. But this could be subject to subtle race conditions and could loose events if cleanupd dies randomly. Bug: https://bugzilla.samba.org/show_bug.cgi?id=12022 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3/smbd: add cleanupd_init_send()/recv()Ralph Boehme2016-07-281-3/+105
| | | | | | | | | | | | | | | Previously, without this patch, if cleanupd died for whatever reason, it would be restarted from smbd. However, if cleanupd initialization failed and it exitted again, there would be no child entry in smbd for it and it wouldn't be attempted to restart it again. This patch adds async send/recv methods for starting cleanupd that will reschedule restart attempt every second in case initilisation failed. Bug: https://bugzilla.samba.org/show_bug.cgi?id=12022 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* notifyd: Move BlockSignals calls to server.cVolker Lendecke2016-07-201-0/+4
| | | | | | | | | | | | | notifyd_send() is called as part of smbd initialization both in normal daemon mode after a fork, but also in interactive mode. In interactive mode, notifyd should not modify the global signal state with BlockSignals(). This patch moves the signal blocking to the place where we know that notifyd is a child daemon. 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 Jul 20 09:04:00 CEST 2016 on sn-devel-144
* smbd: Re-register notify requestsVolker Lendecke2016-07-201-0/+6
| | | | | | | | When notifyd is restarted, the parent will broadcast that fact to all workers. They will then re-register their notify requests. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Restart notifydVolker Lendecke2016-07-201-0/+12
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Remember notifyd's serveridVolker Lendecke2016-07-201-2/+8
| | | | | | | Similarly to cleanupd, this is necessary to restart notifyd Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Don't stop sending to children when one send failsVolker Lendecke2016-07-201-1/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Convert smbXsrv_open_global.tdb to new dbwrap_watchVolker Lendecke2016-07-151-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd/notifyd: use smbd_reinit_after_fork()Ralph Boehme2016-07-101-1/+1
| | | | | | | | | | | | Using smbd_reinit_after_fork() rather then reinit_after_fork() ensures am_parent is reset to NULL. Otherwise, when exiting for some reason, the inherited atexit handler killkids() calls kill(0,SIGTERM) terminating our whole process group including the main smbd. Bug: https://bugzilla.samba.org/show_bug.cgi?id=12016 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* smbd/cleanupd: use smbd_reinit_after_fork()Ralph Boehme2016-07-101-1/+1
| | | | | | | | | | | | Using smbd_reinit_after_fork() rather then reinit_after_fork() ensures am_parent is reset to NULL. Otherwise, when exiting for some reason, the inherited atexit handler killkids() calls kill(0,SIGTERM) terminating our whole process group including the main smbd. Bug: https://bugzilla.samba.org/show_bug.cgi?id=12016 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* smbd: Fix a valgrind errorVolker Lendecke2016-06-241-1/+1
| | | | | | | | | | "child" has been free'd via "tmp" 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 Jun 24 14:07:56 CEST 2016 on sn-devel-144
* Add yet another error code when forking an smbd and ctdb is not there. We ↵Peter Somogyi2016-06-061-5/+8
| | | | | | | | | | | can see NT_STATUS_CONNECTION_REFUSED in the logs upon such a rare case. Signed-off-by: Peter Somogyi <psomogyi@hu.ibm.com> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Jun 6 16:10:19 CEST 2016 on sn-devel-144
* cleanupd: restart as neededRalph Boehme2016-04-191-10/+25
| | | | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=11855 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 19 20:35:33 CEST 2016 on sn-devel-144