1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

4981 Commits

Author SHA1 Message Date
Volker Lendecke
ea0f9378a0 s3: Fix indentation in conv_str_size 2010-03-28 15:25:15 +02:00
Volker Lendecke
4d8a974ddc s3: Use tdb_transaction_start_nonblock in gencache_stabilize
This avoids the thundering herd problem when 5000 smbds exit simultaneously
because the network went down.
2010-03-28 15:25:15 +02:00
Volker Lendecke
d5fd1f2077 Revert "s3: Optimize gencache for smbd exit"
This reverts commit 5ca63676dc59e83ffd9560fdcfa26063f267f283.

That does not fully fix the problem, adding a tdb_transaction_start_nonblock to fix it.
2010-03-28 15:25:15 +02:00
Karolin Seeger
4b89195f0c s3-util_sock: Rise debug level for getpeername failed messages.
Don't show all getpeername failed messages in debug level 0 and 1.

Karolin

Signed-off-by: Volker Lendecke <vl@samba.org>
2010-03-26 15:24:21 +01:00
Andrew Tridgell
772839640e s3-event: switch s3 to using tevent_re_initialise()
This correctly initialises the event backend, and checks for errors

(thanks to Metze for suggesting this)
2010-03-26 22:07:50 +11:00
Volker Lendecke
0deaff0c11 s3: Add a comment to serverid_parent_init, this is pretty confusing 2010-03-25 16:46:21 +01:00
Volker Lendecke
bb1165584f s3: Add a comment to messaging_tdb_parent_init, this is pretty confusing 2010-03-25 16:46:20 +01:00
Volker Lendecke
5a88e43c69 s3: Make sure our CLEAR_IF_FIRST optimization works for serverid.tdb
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.
2010-03-25 16:40:44 +01:00
Volker Lendecke
4cdbe07b25 s3: Make sure our CLEAR_IF_FIRST optimization works for messaging.tdb
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.
2010-03-25 16:40:44 +01:00
Volker Lendecke
f20bdd32dd s3: Fix some nonempty blank lines 2010-03-25 16:40:43 +01:00
Volker Lendecke
fbdcaa929c s3: Optimize gencache for smbd exit
If thousands of smbds try to gencache_stabilize at the same time because the
network died, all of them might be sitting in transaction_start. Don't do the
stabilize transaction if nothing has changed in gencache_notrans.tdb.

Volker
2010-03-24 08:57:29 +01:00
Jeremy Allison
7509b56b5f share_info.tdb could use non-canonicalized sharenames.
Fix this by moving canonicalization into lib/sharesec.c. Update the
db version to 3. Ensures we always find share names with security
descriptors attached.

Jeremy.
2010-03-22 15:57:31 -07:00
Volker Lendecke
70f9338bf2 s3: Add the "ctdb locktime warn threshold" parameter
This is mainly a debugging aid for post-mortem analysis in case a cluster file
system is slow.
2010-03-22 17:32:18 +01:00
Bo Yang
6e48267c28 s3: Open winbindd_cache.tdb with read/write access.
Open winbindd_cache.tdb with read/write access when validate the cache,
otherwise, validation fails to get lock in tdb_check. It results in
validation failure even the cache is good.

Signed-off-by: Bo Yang <boyang@samba.org>
2010-03-21 16:00:26 +08:00
Günther Deschner
b170ebe08b s3-eventlog: fix elog_tdbname(), we were always lower-casing entire lockdir path...
Found by RPC-EVENTLOG torture test.

Guenther
2010-03-17 23:57:30 +01:00
Volker Lendecke
2111fe5255 s3: Use a switch to implement map_nt_error_from_tdb
First, this immediately gave me the warning that TDB_ERR_NESTING was not
covered and second, this saved 48 bytes in the .o :-)
2010-03-14 17:42:49 +01:00
Volker Lendecke
6c00a3db24 s3: Remove some unused code 2010-03-14 17:42:49 +01:00
Volker Lendecke
cfc44d2441 s3: Make tdb_wrap_open more robust
This hides the use of talloc_reference from the caller, making it impossible to
wrongly call talloc_free() on the result.
2010-03-13 20:20:37 +01:00
Volker Lendecke
79100c2421 s3: Add "g_lock_do" as a convenience wrapper function 2010-03-12 14:23:25 +01:00
Volker Lendecke
89c785c47a s3: Fix a long-standing problem with recycled PIDs
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-03-10 16:07:10 +01:00
Volker Lendecke
184afeb57d s3: Make TLDAP_IS_ALPHA and TLDAP_IS_ADH static functions 2010-03-10 14:37:35 +01:00
Simo Sorce
8fa81e9909 Fix typo 2010-03-09 16:42:05 -05:00
Simo Sorce
9f53820de7 s3:tldap add own filter parsing
Also add torture test to check filter parsing.
2010-03-09 15:23:48 -05:00
Karolin Seeger
56b13ee8ed Revert "Fix bug #7067 - Linux asynchronous IO (aio) can cause smbd to fail to respond to a read or write."
This reverts commit a6ae7a552f.

This fixes bug #7222 (All users have full rigths on all shares) (CVE-2010-0728).
(cherry picked from commit 1c9494c76c)
2010-03-08 16:55:07 -08:00
Volker Lendecke
a5db27936e s3: Remove the unused parameter "persistent" from fetch_locked_internal 2010-03-05 15:33:06 +01:00
Volker Lendecke
c7835a4845 s3: db->persistent==true was handled earlier, make this more obvious 2010-03-05 15:33:05 +01:00
Volker Lendecke
d6a6872506 s3: Abstract access to sessionid.tdb, similar to conn_tdb.c 2010-03-01 17:53:22 +01:00
Volker Lendecke
8bebb380e8 s3: Add connections_forall_read()
In a cluster, this makes a large difference: For r/w traverse, we have to do a
fetch_locked on every record which for most users of connections_forall is just
overkill.
2010-03-01 14:51:34 +01:00
Volker Lendecke
3deba6349c s3: Make the difference between r/o and r/w in connections_db_ctx more obvious 2010-03-01 14:04:45 +01:00
Volker Lendecke
c571ecdfc4 s3: Make connections_forall open connections.tdb r/w
connections_forall is called from count_current_connections() which potentially
deletes dead records. This needs r/w access to connections.tdb.
connections_traverse says it does not provide this. Does not really matter in
the smbd case, because we have opened it before r/w, so this is "just" cleanup.
2010-03-01 14:02:35 +01:00
Günther Deschner
166a3821c9 s3-nltest: fix uninitialized query level.
Guenther
2010-02-25 19:31:06 +01:00
Volker Lendecke
d980268680 s3: Make connections_fetch_record() static 2010-02-24 16:11:03 +01:00
Volker Lendecke
752bffc53f s3: Consolidate server_id_self into the equivalent procid_self() 2010-02-23 15:30:00 +01:00
Andreas Schneider
c6c21f489d s3-lib: Remove obsolete signal type cast. 2010-02-23 12:23:43 +01:00
Volker Lendecke
77dd1b29bb s3: Make string_to_sid survive the LOCAL-string_to_sid test 2010-02-20 21:35:03 +01:00
Björn Jacke
c0ebca237c s3: optimize strict allocate for XFS on IRIX 2010-02-18 22:45:46 +01:00
Volker Lendecke
f8b246e44c s3: Fix timeout calculation if g_lock_lock is given a timeout < 60s
Detected while showing this code to obnox :-)
2010-02-16 15:28:42 +01:00
Volker Lendecke
83542d973c s3: Slightly increase parallelism in g_lock
There's no need to still hold the g_lock tdb-level lock while telling the
waiters to retry
2010-02-16 13:21:10 +01:00
Volker Lendecke
be919d6fae s3: Avoid starving locks when many processes die at the same time
In g_lock_unlock we have a little race between the process_exists and
messaging_send call: We only send to 5 waiters now, they all might have died
between us checking their existence and sending the message. This change makes
g_lock_lock retry at least once every minute.
2010-02-16 13:21:10 +01:00
Volker Lendecke
725b3654f8 s3: Avoid a thundering herd in g_lock_unlock
Only notify the first 5 pending lock waiters. This avoids a thundering herd
problem that is really nasty in a cluster. It also makes acquiring a lock a bit
more FIFO, lock waiters are added to the end of the array.
2010-02-16 13:21:10 +01:00
Volker Lendecke
07978bd175 s3: Optimize g_lock_lock for a heavily contended case
Only check the existence of the lock owner in g_lock_parse, check the rest of
the records only when we got the lock successfully. This reduces the load on
process_exists which can involve a network roundtrip in the clustered case.
2010-02-16 13:21:10 +01:00
Volker Lendecke
f3bdb163f4 s3: Fix handling of processes that died in g_lock
g_lock_parse might have thrown away entries from the locks array because the
processes were not around anymore. Don't store the orphaned entries.
2010-02-16 13:21:10 +01:00
Volker Lendecke
bac235dd30 s3: Fix a typo 2010-02-15 16:36:20 +01:00
Peter Watkins
d3a42946cc s3: Fix initgroups return check
A return code of 1 from initgroups() is OK since apparently it means
the gid has already been set. The man page doesn't mention this.
2010-02-14 12:45:04 +01:00
Andrew Tridgell
007f24f29d s3-lib: use TYPESAFE_QSORT() in s3 interfaces code 2010-02-14 18:44:20 +11:00
Volker Lendecke
613777e6dc s3: Remove unused comparison fn from "struct sorted_tree" 2010-02-13 13:26:11 +01:00
Volker Lendecke
3ab78e31f0 s3: Make adt_tree data definitions private to adt_tree.c 2010-02-13 13:26:11 +01:00
Volker Lendecke
2260732084 s3: SORTED_TREE -> struct sorted_tree 2010-02-13 13:26:11 +01:00
Volker Lendecke
ceebed6ce1 s3: TREE_NODE -> struct tree_node 2010-02-13 13:26:10 +01:00
Volker Lendecke
65b26ba985 s3: Fix some nonempty blank lines 2010-02-13 13:26:10 +01:00