summaryrefslogtreecommitdiff
path: root/source3/smbd/server.c
Commit message (Collapse)AuthorAgeFilesLines
* s3:rpc_server: Reinitialize dcesrv_context in external spoolssd daemonSamuel Cabrero2020-03-201-3/+12
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:rpc_server: Reinitialize dcesrv_context in external lsasd daemonSamuel Cabrero2020-03-201-1/+1
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:rpc_server: Reinitialize dcesrv_context in external mdssd daemonSamuel Cabrero2020-03-201-1/+1
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:rpc_server: Reinitialize dcesrv_context in external fssd daemonSamuel Cabrero2020-03-201-1/+1
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:rpc_server: Reinitialize dcesrv_context in external epmd daemonSamuel Cabrero2020-03-201-6/+4
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:rpc_server: Initialize global dcesrv_context for embedded servicesSamuel Cabrero2020-03-201-4/+13
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* smbd: Fix a typoVolker Lendecke2020-02-191-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* smbd: Call string_term_tdb_data() once instead of 6 timesVolker Lendecke2020-01-231-12/+11
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Fix claiming versionVolker Lendecke2020-01-191-1/+1
| | | | | | | | | | | We now have to do an explicit DOWNGRADE when we want to change from G_LOCK_WRITE to G_LOCK_READ. 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): Sun Jan 19 19:58:01 UTC 2020 on sn-devel-184
* smbd: Add close-denied-share messageVolker Lendecke2020-01-151-0/+2
| | | | | | | | This is like close-share, but kicks out only active users where share access controls are changed such that now access would be denied Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Call reopen_logs() in the notifydVolker Lendecke2019-12-091-0/+2
| | | | | | | | If you have per-process logfiles with %d, the notifyd will get its own logfile Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* smbd: Use NULL instead of 0 for a pointer typeVolker Lendecke2019-12-091-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* smbdotconf: mark "logfile" with substitution="1"Ralph Boehme2019-11-271-1/+3
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* sharesec: Return NTSTATUS from share_info_db_initChristof Schmitt2019-11-261-1/+2
| | | | | Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Change the g_lock data modelVolker Lendecke2019-11-221-1/+1
| | | | | | | | | | | | | | | | | | | | Now we have one fixed field for the exclusive lock holder and an array of shared locks. This way we now prioritize writers over readers: If a pending write comes in while readers are active, it will put itself into the exclusive slot. Then it waits for the readers to vanish. Only when all readers are gone the exclusive lock request is granted. New readers will just look at the exclusive slot and see it's taken. They will then line up as watchers, retrying whenever things change. This also means that it will be cheaper to support many shared locks: Granting a shared lock just means to extend the array. We don't have to walk the array for possible conflicts. This also adds explicit UPGRADE and DOWNGRADE operations for better error checking. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: Change prototype of g_lock_dumpVolker Lendecke2019-11-221-2/+3
| | | | | | | | | | Soon the g_lock database format will change. There will be one exclusive entry and an array of shared entries. In that format, there's no need to attach a lock_type to each entry in the g_lock database. Reflect this change in the g_lock_dump API Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* 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>