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

5733 Commits

Author SHA1 Message Date
Andrew Tridgell
f236c539ad s3-winbindd: add support for idmap type WBC_ID_TYPE_BOTH
this allows the s3 code to understand and cache responses from the s4
winbindd which may include a single SID mapped to both a uid and a gid

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>

Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Fri Sep 23 01:47:54 CEST 2011 on sn-devel-104
2011-09-23 01:47:54 +02:00
Stefan Metzmacher
66f8070dd3 lib/util: move some timespec helpers from source3 to the toplevel
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Sep 23 00:15:31 CEST 2011 on sn-devel-104
2011-09-23 00:15:31 +02:00
Günther Deschner
a9a81648e9 s3-netapi: allow to use default krb5 credential cache for libnetapi users.
Guenther
2011-09-21 17:39:08 +02:00
Michael Adam
da5224a9d2 s3:dbwrap_ctdb: skip the internal __db_sequence_number__ key from (persistent) traverse and traverse_read
This is is used internally in the persistent transactions and should not surface.

Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Tue Sep 20 07:59:20 CEST 2011 on sn-devel-104
2011-09-20 07:59:20 +02:00
Michael Adam
aa0f102fd7 s3:g_lock: add a missing \n to a debug message in g_lock_init 2011-09-20 06:28:27 +02:00
Rusty Russell
26ce47ecc0 util_tdb: return -1/0 from lock_with_timeout functions.
Keeps the tdb2 API change (which returns error codes, rather than -1)
localized.  The function returns -1 down the other path, so make it
consistent.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14 08:13:28 +09:30
Rusty Russell
5e0f62c3c2 dbwrap_tdb: handle tdb2 return values properly.
TDB2 versions of tdb_parse_record etc return an error code, not -1.
Turn those into -1/0 in dbwrap_tdb to insulate the rest of the code
from that change.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14 08:13:28 +09:30
Rusty Russell
376511ed4d tdb_compat: adapt to tdb2 API change.
Add the ecode arg to all the log functions, and log it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14 07:13:13 +09:30
Gregor Beck
350d8e56db s3:dbwrap_ctdb: improve error message in transaction destructor
Signed-off-by: Michael Adam <obnox@samba.org>
2011-09-07 19:50:05 +02:00
Gregor Beck
9c0252446f s3: let g_lock_unlock() return more specific status codes on failure
Signed-off-by: Michael Adam <obnox@samba.org>
2011-09-07 19:50:05 +02:00
Christian Ambach
4c2be3df0e s3:lib S-1-5-9 is "Enterprise Domain Controllers"
and not ServerLogon
2011-08-31 09:53:31 +02:00
Christian Ambach
8ecdb55957 s3:lib remove duplicate entry for "Anonymous Logon" 2011-08-31 09:53:31 +02:00
Christian Ambach
d3870413d1 s3:lib add S-1-5-17 to well-known SID list
http://support.microsoft.com/kb/243330/en-us says the name is
"This organization", but Windows 2008 says IUSR

Picking the Windows 2008 variant as 'This Organization' would
be duplicate to S-1-5-15
2011-08-31 09:53:31 +02:00
Christian Ambach
0decdf8ace s3:lib add some more well-known sids
add S-1-3-2/Creator Owner Server, S-1-3-3/Creator Group Server and
S-1-3-4/Owner Rights to the well-known SID list
2011-08-31 09:53:31 +02:00
Christian Ambach
74751446a2 s3:lib add new well-known SIDs for BUILTIN
Distributed COM Users, Cryptographic Operators, Event Log Readers
and Certificate Service DCOM Access were missing from the BUILTIN
well-known SID list
2011-08-31 09:53:31 +02:00
Volker Lendecke
e52fa6298a s3: Silence some warnings
Rusty, please suggest a proper fix for this.

Thanks,

Volker Lendecke

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Tue Aug 30 19:16:14 CEST 2011 on sn-devel-104
2011-08-30 19:16:14 +02:00
Andreas Schneider
b8c3bfa55b s3-lib: If we create a pipe socket, don't start to listen.
The create_pipe_sock() function should only create the socket as the
name states and not start to listen on it too. We should start to listen
on in the individual places as we need different backlog values.

Autobuild-User: Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date: Mon Aug 29 13:21:43 CEST 2011 on sn-devel-104
2011-08-29 13:21:43 +02:00
Michael Adam
9d3fa10c35 s3:dbwrap_tdb: correctly catch the error from the return code of tdb_parse in db_tdb_fetch() 2011-08-25 23:55:06 +02:00
Volker Lendecke
77810431c9 s3: Remove a bogus comment 2011-08-25 21:36:19 +02:00
Volker Lendecke
16888be44a s3: Fix some nonempty blank lines 2011-08-25 21:36:18 +02:00
Volker Lendecke
5007ad3026 s3: Slightly simplify serverid_exists
procid_is_me() works fine in the clustering case as well

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Mon Aug 22 21:28:13 CEST 2011 on sn-devel-104
2011-08-22 21:28:13 +02:00
Andreas Schneider
1152aa8e03 s3-passdb: Keep caches coherent
When deleting a user send a message to all interested parties so they can
purge their caches. Otherwise some processes may positively respond with a
cached getpwnam, when the user have actully been removed.

Without this some tests that remove and then immediately create users are
flakey.

Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:08:25 -04:00
Andreas Schneider
61ada700a6 s3-id_cache: Use better names for id cache management ops
The IDMAP term is normally associated with Winbind's idmap stuff.
These functions deal with id caching not id mapping.

Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:08:25 -04:00
Andreas Schneider
177db0a880 s3-id_cache: Move id caches mgmt out of smbd
We must leave the MSG_IDMAP_KILL operation in SMBD as it uses smbd
specific internal globals and makes sense only in the context of a smbd
daemon.
The rest is moved under lib/ as we need to deal with id cache cleanups
in other daemons too (like lsasd).

Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:08:25 -04:00
Simo Sorce
51d4b3c55d s3-prefork: Listening fds must be in non-blocking mode
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:07 -04:00
Simo Sorce
7bb4b991a5 s3-prefork: Fix code to retire children
We have to be more careful when retiring children. We cannot stop
accepting connections as soon as the server tells us to quit because if
max_children is reached and we still have clients connected, the server will
not be able to spawn new children until one exits. And children will not exit
until all the clients closed the connections. So we keep operating past our
recall until we have 0 connections.
Also do not try to recall children that still have >= 1 clients connected, they
couldn't anyway.
Also use messaging to warn children and not SIGHUP.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:06 -04:00
Simo Sorce
91ba8aec13 s3-prefork: Add parent->client messaging
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:06 -04:00
Simo Sorce
0f71639d33 s3-prefork: Improve error detection when handling new connections
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:05 -04:00
Simo Sorce
75f3da76e4 s3-prefork: Improve heuristics
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:05 -04:00
Simo Sorce
308e4e0126 s3-prefork: add a few more utility functions
Add a few util functions children side so that daemons do not have
to care about properly setting num_clients and state. Let a common
helper do it so that they are all consistent.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:05 -04:00
Simo Sorce
df6f320aa4 s3-prefrok: Handle only valid children
Children that are about to exit shouldn't be counted as a source of
connections, and also makes no sense to chenge their allowances if they are
about to exit.
Also children with negative num_clients are faulty, exclude them as well.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:05 -04:00
Simo Sorce
e3736f826b s3-prefork: Fix worker flags handling.
We can't have a clear idea of wether the worker is IDLE or BUSY.
The only things we can tell is if it is Alive, whether it is currently
Accepting connections or wether it is Exiting soon.

Remove PF_WORKER_IDLE, PF_WORKER_BUSY and replace their use with
PF_WORKER_ALIVE. Also properly assign PF_WORKER_ACCEPTING so that
users of the API can rely on the flag.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:05 -04:00
Simo Sorce
ee0c69a25e s3-prefork: do not use a lock_fd, just race on accept()
We used a lock mimicking what apache does for preforked children.
But it doesn't work properly in our case because we do not stop once a request
has been served. Clients are allowed to perform multiple requests and keep the
connection open.
This means that if we allow multiple clients per children, then a child could
take the lock and then be asked to do a long or even locking operation by a
client it already is serving. This woulkd cause the whole server to deadlock,
as the child is now busy and also holding on the lock.
Using a race on accept() by having a tevent_fd on the listening socket wait
for read events we never deadlock. At most we cause a bit of contention among
children. But in the generic case connections are much less frequent for us as
clients tend to be long lived. So the little contention we may have is not a
big deal.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:05 -04:00
Simo Sorce
3451f423d6 s3-prefork: Add common utilities for daemons
Daemons using the prefork infrastructure may want to use these utils to
configure and manage a pool of children.

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:04 -04:00
Simo Sorce
2a0aac0adc s3-prefork: Allow better management of allowed_clients
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:04 -04:00
Andreas Schneider
5169dff380 s3-prefork: Fix cast warning.
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21 09:05:02 -04:00
Jeremy Allison
e25345a7a6 Ensure we never wait past absolute entime to do a get_cached_ldap_connect().
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Aug 20 20:09:37 CEST 2011 on sn-devel-104
2011-08-20 20:09:37 +02:00
Jeremy Allison
6c3779c80b Remove the tortured logic in another_ldap_try() and turn it into
get_cached_ldap_connect(), which much better describes it's function.

Now we always break at the right places in the loop, we can replace
the while (another_ldap_try(ldap_state, &rc, &attempts, abs_endtime))
construct with simply while (1).
2011-08-19 21:40:54 -07:00
Jeremy Allison
ce8a1a29ad Factor out the ldap_get_option calls into a function. 2011-08-19 21:30:04 -07:00
Jeremy Allison
832dce1a0a Simplify the logic on the another_ldap_try() loops by breaking
early out of the loop on success.
2011-08-19 21:27:18 -07:00
Jeremy Allison
03bdb26c5b Move the alarm setup/teardown out of another_ldap_try() and into separate
functions that bracket the another_ldap_try() loop. We now never leave a
dangling alarm pending on success.
2011-08-19 21:19:28 -07:00
Jeremy Allison
a357d044d4 Allow the timeout pointer to ldap_search_ext_s() to be NULL if lp_ldap_timeout() == 0. 2011-08-19 21:08:10 -07:00
Jeremy Allison
da89f7e24c Make it clear the time here is an absolute endtime. Don't set the alarm if the LDAP timeout is zero. 2011-08-19 21:01:49 -07:00
Jeremy Allison
f00c6c8561 Always remove the alarm before changing the handler, not the other way around. 2011-08-19 20:55:41 -07:00
Jeremy Allison
ec07aca7d5 Remove old_handler as alarms can't be nested. Use SIG_IGN instead. 2011-08-19 20:54:41 -07:00
Jeremy Allison
7cbcbee484 Change got_alarm from bool to the correct type of SIG_ATOMIC_T. 2011-08-19 20:53:49 -07:00
Ira Cooper
f6e3484ba6 Re-arrange the optimization to reduce tdb fcntl calls if smbd is not
clustered. procid_is_me() is much cheaper to test and can optimize
up to 50% of the calls to serverid_exists(). Volker please check.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Aug 20 01:15:07 CEST 2011 on sn-devel-104
2011-08-20 01:15:07 +02:00
Michael Adam
7eeb168523 s3:dbwrap_ctdb: improve transaction start/commit/cancel debugging
* also log nesting transaction start/commit/cancel
* unify transaction log messages slightly
2011-08-15 17:15:15 +02:00
Michael Adam
0aa85ec43a s3:lib: fix a comment in tdb_unpack() 2011-08-15 17:15:15 +02:00
Gregor Beck
8a36e72140 s3: avoid reading past the end of buffer in tdb_unpack 'f' if zero termination is missing
Signed-off-by: Michael Adam <obnox@samba.org>
2011-08-15 17:15:14 +02:00