summaryrefslogtreecommitdiff
path: root/source3/nmbd/nmbd.c
AgeCommit message (Collapse)AuthorFilesLines
2010-03-26s3-smbd: Don't close stdout if we want to log to stdout.Andreas Schneider1-1/+1
2010-03-10s3: Fix a long-standing problem with recycled PIDsVolker Lendecke1-1/+6
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
2010-02-23s3: Consolidate server_id_self into the equivalent procid_self()Volker Lendecke1-1/+1
2010-02-23s3-nmbd: Remove obsolete signal type cast.Andreas Schneider1-2/+2
2010-02-08s3:nmbd: also listen explicit on the subnet broadcast addressesStefan Metzmacher1-2/+3
And send replies always via the unicast address of the subnet. This behavior is off by default (as before) and can be enabled with "nmbd:bind explicit broadcast = yes". metze
2009-07-15Make gencache more stableVolker Lendecke1-0/+2
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.
2009-06-18Fix bug 4699: Remove pidfile on clean shutdownVolker Lendecke1-0/+2
2009-05-27s3: Allow child processes to exit gracefully if we are out of fdsMarc VanHeyningen1-2/+2
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>
2009-03-21s3:nmbd: implement a MAILSLOT => CLDAP proxy for NETLOGON_SAMLOGON requestsStefan Metzmacher1-0/+6
This will be used as part a the franky setup, where nmbd will forward the MAILSLOT requests to the local samba4 CLDAP server. "nmbd_proxy_logon:cldap_server = 127.0.0.1" would configure and activate this feature. metze
2009-02-23More warning fixes for Solaris.Jeremy Allison1-7/+7
Jeremy.
2009-01-27s3:nmbd: handle SIG_TERM and SIGHUP via teventStefan Metzmacher1-48/+67
metze
2009-01-27s3:nmbd: as the sig_term() handler only sets a flag we don't need to block ↵Stefan Metzmacher1-3/+0
SIGTERM The arguments of commit d98bea900ee694cdba83149620c65bd7f8765f26 are no longer valid. metze
2009-01-27s3:nmbd: install the SIG_DFL handler for SIGTERM while we're waiting for ↵Stefan Metzmacher1-12/+4
interfaces We should handle all 3 cases where we actively wait for interfaces in the same way. metze
2009-01-22s3:nmbd: we don't need to call message_dispatch() anymore it's event ↵Stefan Metzmacher1-4/+0
triggered now metze
2009-01-15s3: make better use of ccache by not including version.h in every C-file.Michael Adam1-1/+1
version.h changes rather frequently. Since it is included via includes.h, this means each C file will be a cache miss. This applies to the following situations: * When building a new package with a new Samba version * building in a git branch after calling mkversion.sh after a new commit (i.e. virtually always) This patch improves the situation in the following way: * remove inlude "version.h" from includes.h * Use samba_version_string() instead of SAMBA_VERSION_STRING in files that use no other macro from version.h instead of SAMBA_VERSION_STRING. * explicitly include "version.h" in those files that use more macros from "version.h" than just SAMBA_VERSION_STRING. Michael
2009-01-05clean event context after child is forked.Bo Yang1-1/+2
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2008-11-03s3: fix a few "shadows a global declaration" warningsTim Prouty1-4/+4
2008-10-23Use sockaddr_storage only where we rely on the size, use sockaddrJelmer Vernooij1-2/+2
otherwise (to clarify we can also pass in structs smaller than sockaddr_storage, such as sockaddr_in).
2008-10-18Use separate make variables for libutil and libcrypto.Jelmer Vernooij1-2/+2
2008-08-19Fix bug 5697 nmbd spins in reload_interfaces when only loopback has an IPv4 ↵Jeremy Allison1-2/+2
address reported by Ted Percival <ted@midg3t.net>. Jeremy. (This used to be commit ab06efccf31fbc899536d2681a2076e6dfd65b9e)
2008-08-13first cut at adding full transactions for ctdb to samba3Andrew Tridgell1-4/+0
(This used to be commit f91a3e0f7b7737c1d0667cd961ea950e2b93e592)
2008-06-26nmbd: untangle logic in nmbd_messaging_context() slightly.Michael Adam1-2/+5
Michael (This used to be commit 3baf9eb6a2cc6a4a153303b457d3a7067948495e)
2008-06-26nmbd: don't panic if messaging_init() fails - return NULL instead.Michael Adam1-1/+1
Michael (This used to be commit e6a403209c29bd2ec2242d654ad45276de02cb44)
2008-04-23Fix CLEAR_IF_FIRST handling of messages.tdbVolker Lendecke1-1/+1
We now open messages.tdb even before we do the become_daemon. become_daemon() involves a fork and an immediate exit of the parent, thus the parent_is_longlived argument must be set to false in this case. The parent is not really long lived :-) (This used to be commit 4f4781c6d17fe2db34dd5945fec52a7685448aec)
2008-04-18nmbd: create the messaging conntext earlierStefan Metzmacher1-3/+12
metze (This used to be commit 056ff094ad2c59992cfdb8b29696c08dab4113d7)
2008-04-18nmbd: call reinit_after_fork() in all needed casesStefan Metzmacher1-0/+5
metze (This used to be commit f68829ff14c457bfa98cb2ef9e8ec2e1a0b1d64d)
2008-04-12dbwrap: wait for tdb2 change notifies in smbd, nmbd and winbinddStefan Metzmacher1-0/+8
metze (This used to be commit 64450cc1e441355aa8925b7183e90872eeab20b1)
2008-04-11Fix bug #5386, don't keep printing the same waitingJeremy Allison1-3/+6
error message. Jeremy. (This used to be commit 12e6818df1c77810a59a2896f8c44c91fc24e7ae)
2008-03-27Fix for termination problems when no interfaces found - bug #5267.Jeremy Allison1-6/+15
Jeremy. (This used to be commit 4b03f4eb2da7a523967ace3d13e79406ade07d47)
2008-03-06Fix bug #5267 - nmbd shuts down when network interfaces go down.Jeremy Allison1-29/+39
Cause nmbd to wait for an interface, in a mode where SIGTERM will kills us (same way we wait on startup for an interface). Jeremy. (This used to be commit 5440c752ff270cc674d46f2dfa2ceb47dac030f6)
2008-01-24Fix Coverity ID 454Volker Lendecke1-1/+8
(This used to be commit 902d1d6709e47fbc8b538f28cb4364b006c431f8)
2007-12-10Remove the char[1024] strings from dynconfig. ReplaceJeremy Allison1-7/+10
them with malloc'ing accessor functions. Should save a lot of static space :-). Jeremy. (This used to be commit 52dc5eaef2106015b3a8b659e818bdb15ad94b05)
2007-12-07Don't build rpctorture anymore - not maintained. Just remove.Jeremy Allison1-1/+1
Remove all vestiges of pstring (except for smbctool as noted in previous commit). Jeremy (This used to be commit 4c32a22ac50ada3275d2ffba3c1aa08bee7d1549)
2007-11-19Remove pstring from nmbd.Jeremy Allison1-4/+6
Jeremy. (This used to be commit a317f70c229f7730279eaa323f7ebfd499257f76)
2007-11-15More pstring removal. This one was tricky. I had to addJeremy Allison1-0/+2
one horror (pstring_clean_name()) which will have to remain until I've removed all pstrings from the client code. Jeremy. (This used to be commit 1ea3ac80146b83c2522b69e7747c823366a2b47d)
2007-10-30start smbd, nmbd and winbindd with the same startup messageStefan Metzmacher1-2/+2
at debug level 0. metze (This used to be commit 95f76ae7a52c6b22db22d03fed6b0848d2a61bee)
2007-10-24This is a large patch (sorry). Migrate from struct in_addrJeremy Allison1-22/+43
to struct sockaddr_storage in most places that matter (ie. not the nmbd and NetBIOS lookups). This passes make test on an IPv4 box, but I'll have to do more work/testing on IPv6 enabled boxes. This should now give us a framework for testing and finishing the IPv6 migration. It's at the state where someone with a working IPv6 setup should (theorecically) be able to type : smbclient //ipv6-address/share and have it work. Jeremy. (This used to be commit 98e154c3125d5732c37a72d74b0eb5cd7b6155fd)
2007-10-20fix move to OPT_LOG_STDOUTStefan Metzmacher1-1/+1
metze (This used to be commit 97f47e39139cef738a5f02980a0792417e0d365e)
2007-10-19Fix the popt / bool issues. Some places we used BOOLJeremy Allison1-9/+32
where we meant int. Fix this. Thanks to metze for pointing this out. Jeremy. (This used to be commit 793a9d24a163cb6cf5a3a0aa5ae30e9f8cf4744a)
2007-10-19fix startup of smbd, nmbd, winbinddStefan Metzmacher1-11/+5
jra: POPT_ARG_VAL arguments need int values. I assume there're more places like this in the cmdline tools. Please fix this properly, as my commit is just a hack to get make test working again. in samba4 we have a workaround for this see smbd/server.c metze (This used to be commit 9cb1937fe8601e526b5c924930500e0a3b52abd5)
2007-10-18RIP BOOL. Convert BOOL -> bool. I found a few interestingJeremy Allison1-17/+17
bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f)
2007-10-10Add start of IPv6 implementation. Currently most of this is avoidingJeremy Allison1-12/+43
IPv6 in winbindd, but moves most of the socket functions that were wrongly in lib/util.c into lib/util_sock.c and provides generic IPv4/6 independent versions of most things. Still lots of work to do, but now I can see how I'll fix the access check code. Nasty part that remains is the name resolution code which is used to returning arrays of in_addr structs. Jeremy. (This used to be commit 3f6bd0e1ec5cc6670f3d08f76fc2cd94c9cd1a08)
2007-10-10[GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.Gerald (Jerry) Carter1-31/+30
(This used to be commit 5c6c8e1fe93f340005110a7833946191659d88ab)
2007-10-10r24809: Consolidate the use of temporary talloc contexts.Volker Lendecke1-4/+11
This adds the two functions talloc_stackframe() and talloc_tos(). * When a new talloc stackframe is allocated with talloc_stackframe(), then * the TALLOC_CTX returned with talloc_tos() is reset to that new * frame. Whenever that stack frame is TALLOC_FREE()'ed, then the reverse * happens: The previous talloc_tos() is restored. * * This API is designed to be robust in the sense that if someone forgets to * TALLOC_FREE() a stackframe, then the next outer one correctly cleans up and * resets the talloc_tos(). The original motivation for this patch was to get rid of the sid_string_static & friends buffers. Explicitly passing talloc context everywhere clutters code too much for my taste, so an implicit talloc_tos() is introduced here. Many of these static buffers are replaced by a single static pointer. The intended use would thus be that low-level functions can rather freely push stuff to talloc_tos, the upper layers clean up by freeing the stackframe. The more of these stackframes are used and correctly freed the more exact the memory cleanup happens. This patch removes the main_loop_talloc_ctx, tmp_talloc_ctx and lp_talloc_ctx (did I forget any?) So, never do a tmp_ctx = talloc_init("foo"); anymore, instead, use tmp_ctx = talloc_stackframe() :-) Volker (This used to be commit 6585ea2cb7f417e14540495b9c7380fe9c8c717b)
2007-10-10r24621: - deferr calling build_options();exit(0);Stefan Metzmacher1-1/+2
- use poptPrintUsage() to give the user more info metze (This used to be commit a95d9d1ef99d6a2f77a289f8d2011cae482821b1)
2007-10-10r24599: patch from Karolin Seeger <ks@sernet.de>:Stefan Metzmacher1-1/+9
smbd, nmbd and winbindd can be started with invalid options currently. The first patch attached would be a possible solution. It contains an exit if an invalid option has been used. The main problem is, that existing setups with wrong options or missing arguments in start scripts will break (which is the right behaviour from my point of view). metze (This used to be commit 8532e3182ab44d4ac84823e9798293f156192aaf)
2007-10-10r23784: use the GPLv3 boilerplate as recommended by the FSF and the license textAndrew Tridgell1-2/+1
(This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07)
2007-10-10r23779: Change from v2 or later to v3 or later.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3)
2007-10-10r23510: Tidy calls to smb_panic by removing trailing newlines. Print theJames Peach1-2/+2
failed expression in SMB_ASSERT. (This used to be commit 171dc060e2a576d724eed1ca65636bdafffd7713)
2007-10-10r23055: Rewrite messages.c to use auto-generated marshalling in the tdb. I'mVolker Lendecke1-1/+1
doing this because for the clustering the marshalling is needed in more than one place, so I wanted a decent routine to marshall a message_rec struct which was not there before. Tridge, this seems about the same speed as it used to be before, the librpc/ndr overhead in my tests was under the noise. Volker (This used to be commit eaefd00563173dfabb7716c5695ac0a2f7139bb6)