summaryrefslogtreecommitdiffstats
path: root/source3/smbd/server.c
Commit message (Collapse)AuthorAgeFilesLines
* s3:lib make server contexts genericSimo Sorce2010-06-101-12/+1
| | | | Pair-programmed-with: Andreas Schneider <asn@samba.org>
* Don't use the autofree context for the globals. This causes child smbd's forkedJeremy Allison2010-06-101-1/+6
| | | | | | | by modules to crash due to destructors being called (found when using the vfs_aio_fork module with smb2). Jeremy.
* s3:smbd move messaging_context and memcache into globals.cAndrew Bartlett2010-05-281-26/+0
| | | | | | This helps vfstest, which previously had duplicate copies of these functions. Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:smbd split reload services/printers functions from server.cAndrew Bartlett2010-05-281-82/+0
| | | | | | | | | This helps vfstest, as it previously had duplicate copies of these functions. Andrew Bartlett Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:smbd split smbd/server.c into smbd/server.c and smbd/server_exit.cAndrew Bartlett2010-05-281-146/+0
| | | | | | Andrew Bartlett Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3-auth: Added a function to get the server_info from the system user.Andreas Schneider2010-05-281-0/+5
| | | | Signed-off-by: Günther Deschner <gd@samba.org>
* s3-registry: only include registry headers when really needed.Günther Deschner2010-05-181-0/+1
| | | | Guenther
* s3:smbd Remove calls to namecache_enable()Andrew Bartlett2010-05-131-2/+0
| | | | | | This only prints a DEBUG() Andrew Bartlett
* s3: only include gen_ndr headers where needed.Günther Deschner2010-05-061-0/+1
| | | | | | | | | | | | | | | | | This shrinks include/includes.h.gch by the size of 7 MB and reduces build time as follows: ccache build w/o patch real 4m21.529s ccache build with patch real 3m6.402s pch build w/o patch real 4m26.318s pch build with patch real 3m6.932s Guenther
* s3-smbd: Don't close stdout if we want to log to stdout.Andreas Schneider2010-03-261-1/+1
|
* s3: Make sure our CLEAR_IF_FIRST optimization works for serverid.tdbVolker Lendecke2010-03-251-0/+4
| | | | | | In the child, we fully re-open serverid.tdb, which leads to one fcntl lock for CLEAR_IF_FIRST detection per smbd. This opens the tdb in the parent and holds it, so that tdb_reopen_all correctly catches the CLEAR_IF_FIRST bit.
* s3: Make sure our CLEAR_IF_FIRST optimization works for the notify tdbsVolker Lendecke2010-03-251-0/+4
| | | | | | The notify tdb files are opened at tconX time, which leads to one fcntl lock for CLEAR_IF_FIRST detection per smbd. This opens the tdbs in the parent and holds it, so that tdb_reopen_all correctly catches the CLEAR_IF_FIRST bit.
* s3: Make sure our CLEAR_IF_FIRST optimization works for messaging.tdbVolker Lendecke2010-03-251-0/+4
| | | | | | In the child, we fully re-open messaging.tdb, which leads to one fcntl lock for CLEAR_IF_FIRST detection per smbd. This opens the tdb in the parent and holds it, so that tdb_reopen_all correctly catches the CLEAR_IF_FIRST bit.
* s3: Add "log writeable files on exit" parameterVolker Lendecke2010-03-221-0/+31
| | | | | | | This boolean option controls whether at exit time the server dumps a list of files with debug level 0 that were still open for write. This is an administrative aid to find the files that were potentially corrupt if the network connection died.
* s3: Fix some nonempty blank linesVolker Lendecke2010-03-221-1/+0
|
* s3:smbd: make sure we always have a valid talloc stackframeStefan Metzmacher2010-03-151-0/+3
| | | | metze
* s3: Fix a long-standing problem with recycled PIDsVolker Lendecke2010-03-101-4/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a samba server process dies hard, it has no chance to clean up its entries in locking.tdb, brlock.tdb, connections.tdb and sessionid.tdb. For locking.tdb and brlock.tdb Samba is robust by checking every time we read an entry from the database if the corresponding process still exists. If it does not exist anymore, the entry is deleted. This is not 100% failsafe though: On systems with a limited PID space there is a non-zero chance that between the smbd's death and the fresh access, the PID is recycled by another long-running process. This renders all files that had been locked by the killed smbd potentially unusable until the new process also dies. This patch is supposed to fix the problem the following way: Every process ID in every database is augmented by a random 64-bit number that is stored in a serverid.tdb. Whenever we need to check if a process still exists we know its PID and the 64-bit number. We look up the PID in serverid.tdb and compare the 64-bit number. If it's the same, the process still is a valid smbd holding the lock. If it is different, a new smbd has taken over. I believe this is safe against an smbd that has died hard and the PID has been taken over by a non-samba process. This process would not have registered itself with a fresh 64-bit number in serverid.tdb, so the old one still exists in serverid.tdb. We protect against this case by the parent smbd taking care of deregistering PIDs from serverid.tdb and the fact that serverid.tdb is CLEAR_IF_FIRST. CLEAR_IF_FIRST does not work in a cluster, so the automatic cleanup does not work when all smbds are restarted. For this, "net serverid wipe" has to be run before smbd starts up. As a convenience, "net serverid wipedbs" also cleans up sessionid.tdb and connections.tdb. While there, this also cleans up overloading connections.tdb with all the process entries just for messaging_send_all(). Volker
* Revert "Fix bug #7067 - Linux asynchronous IO (aio) can cause smbd to fail ↵Karolin Seeger2010-03-081-8/+0
| | | | | | | | | to respond to a read or write." This reverts commit a6ae7a552f851a399991262377cc0e062e40ac20. This fixes bug #7222 (All users have full rigths on all shares) (CVE-2010-0728). (cherry picked from commit 1c9494c76cc9686c61e0966f38528d3318f3176f)
* s3: Abstract access to sessionid.tdb, similar to conn_tdb.cVolker Lendecke2010-03-011-1/+2
|
* s3: Consolidate server_id_self into the equivalent procid_self()Volker Lendecke2010-02-231-1/+1
|
* Fix trailing whitespace errors I added (sorry).Jeremy Allison2010-02-051-3/+3
| | | | Jeremy.
* s3-smbd: add a rate limited cleanup of brl, connections and locking dbAndrew Tridgell2010-02-051-6/+42
| | | | | | | | | | | On unclean shutdown we can end up with stale entries in the brlock, connections and locking db. Previously we would do the cleanup on every unclean exit, but that can cause smbd to be completely unavailable for several minutes when a large number of child smbd processes exit. This adds a rate limited cleanup of the databases, with the default that cleanup happens at most every 20s
* s3-brlock: we don't need these MSG_SMB_UNLOCK calls nowAndrew Tridgell2010-02-051-2/+0
| | | | These have been replaced with the min timeout in blocking.c
* Fix bug #7067 - Linux asynchronous IO (aio) can cause smbd to fail to ↵Jeremy Allison2010-01-261-0/+8
| | | | | | | | | respond to a read or write. Only works on Linux kernels 2.6.26 and above. Grants CAP_KILL capability to allow Linux threads under different euids to send signals to each other. Jeremy.
* s3/smbd: open the share_info.tdb on startup instead of tconxSteven Danneman2009-08-261-0/+9
| | | | | | | | This is a small performance optimization. Instead of opening the tdb on every smb connection in the forked child process, we now open it in the parent and share the fd. This also reduces the total fd usage in the system.
* s3:smbd: move dptr globals into struct smbd_server_connectionStefan Metzmacher2009-08-071-2/+0
| | | | metze
* Fix bug #6564 - SetPrinter fails (panics) as non root.Jeremy Allison2009-07-171-0/+1
| | | | | Missing become_root()/unbecome_root() around reload_services. Jeremy.
* Make gencache more stableVolker Lendecke2009-07-151-0/+1
| | | | | | | | | | This provides a compromise between stability and performance: gencache is a persistent database these days that for performance reasons can not use tdb transactions for all writes. This patch splits up gencache into gencache.tdb and gencache_notrans.tdb. gencache_notrans is used with CLEAR_IF_FIRST, writes to it don't use transactions. By default every 5 minutes and when a program exits, all entries from _notrans.tdb are transferred to gencache.tdb in one transaction.
* s3: forward MSG_DEBUG from smbd parent to all childrenAravind Srinivasan2009-06-221-14/+25
| | | | | | | | | | | | | | | | | | | Before 3.3, an smbcontrol debug message sent to the target "smbd" would actually be sent to all running processes including nmbd and winbindd. This behavior was changed in 3.3 so that the "smbd" target would only send a message to the process found in smbd.pid, while the "all" target would send a message to all processes. The ability to set the debug level of all processes within a single daemon, without specifying each pid is quite useful. This was implemented in winbindd in 065760ed. This patch does the same thing for smbd. Upon receiving a MSG_DEBUG the parent smbd will rebroadcast it to all of its children. The printing process has been added to the list of smbd child processes, and we now always track the number of smbd children regardless of the "max smbd processes" setting.
* Fix bug 4699: Remove pidfile on clean shutdownVolker Lendecke2009-06-181-0/+3
|
* Fix bug #6476 - more then 3000 smbd-zombies in memoryJeremy Allison2009-06-171-0/+12
| | | | | We weren't reaping children in the [x]inetd case. Jeremy.
* s3:smbd: create a connection_struct in SMB2 Tree ConnectStefan Metzmacher2009-06-031-0/+9
| | | | metze
* s3:smbd: move tcon specific globals to struct smbd_server_connectionStefan Metzmacher2009-06-031-5/+2
| | | | metze
* s3:smbd: move more session specific globals to struct smbd_server_connectionStefan Metzmacher2009-06-031-1/+3
| | | | metze
* s3:smbd: move negprot related globals to struct smbd_server_connectionStefan Metzmacher2009-06-031-2/+4
| | | | metze
* s3: Allow child processes to exit gracefully if we are out of fdsMarc VanHeyningen2009-05-271-6/+13
| | | | | | | | | | When we run out of file descriptors for some reason, every new connection forks a child that immediately panics causing smbd to coredump. This seems unnecessarily harsh; with this code change we now catch that error and merely log a message about it and exit without the core dump. Signed-off-by: Tim Prouty <tprouty@samba.org>
* Use avahi to register _smb._tcp in smbdVolker Lendecke2009-03-231-0/+11
|
* s3:smbd: use tevent_loop_once() in the parent event loopStefan Metzmacher2009-03-181-34/+5
| | | | metze
* s3:smbd: don't exit the parent when we have no connectionsStefan Metzmacher2009-03-181-7/+0
| | | | | | | | This code path can't really happen anymore, because launchd support was removed with commit e5a951325a6cac8567af3a66de6d2df577508ae4. But it's confusing to have that code there... metze
* s3-spoolss: use DSPRINT flags instead of SPOOLS_DS flags.Günther Deschner2009-02-271-1/+1
| | | | Guenther
* More warning fixes for Solaris.Jeremy Allison2009-02-231-1/+1
| | | | Jeremy.
* Do not close an fd we know is -1Volker Lendecke2009-02-211-1/+0
|
* s3: Refactor of madvise() usage in c441f58dSteven Danneman2009-02-201-7/+0
| | | | | * move to reinit_after_fork() to protect all Samba daemons * only protect parent processes
* S3: Stop creating SMBD cores when failing to create a pipe.todd stecher2009-02-181-0/+4
| | | | | | This was uncovered when the MAX FD limit was hit, causing an instant core and invoking error reporting. This fix causes SMBD to exit, but without building a core.
* S3: Allow SMBD processes to survive in low memory condidtionstodd stecher2009-02-181-0/+7
| | | | | | This commit adds a configure argument which allows for setting MADV_PROTECT in the madvise() API. With this enabled the kernel won't kill SMBD when it's running low on memory.
* Fix a valgrind errorVolker Lendecke2009-02-141-1/+5
|
* s3:smbd: make smbd_open_one_socket() staticMichael Adam2009-01-291-3/+3
| | | | Michael
* s3:smbd: ignore open_socket_in() failuresStefan Metzmacher2009-01-291-1/+4
| | | | | | | This restores the pre e0232934fbf69a9e72de1d9844b14d70b34a2d6a behavior. metze
* s3:smbd: wait for new connection via fd eventsStefan Metzmacher2009-01-271-211/+227
| | | | metze
* s3:smbd: make mdns registration event driven.Stefan Metzmacher2009-01-271-15/+10
| | | | metze