summaryrefslogtreecommitdiff
path: root/source3/lib
AgeCommit message (Collapse)AuthorFilesLines
2011-08-21s3-prefork: do not use a lock_fd, just race on accept()Simo Sorce2-375/+21
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-21s3-prefork: Add common utilities for daemonsSimo Sorce2-0/+166
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-21s3-prefork: Allow better management of allowed_clientsSimo Sorce2-5/+54
Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-21s3-prefork: Fix cast warning.Andreas Schneider1-2/+2
Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-20Ensure we never wait past absolute entime to do a get_cached_ldap_connect().Jeremy Allison1-8/+15
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Aug 20 20:09:37 CEST 2011 on sn-devel-104
2011-08-19Remove the tortured logic in another_ldap_try() and turn it intoJeremy Allison1-58/+70
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-19Factor out the ldap_get_option calls into a function.Jeremy Allison1-20/+14
2011-08-19Simplify the logic on the another_ldap_try() loops by breakingJeremy Allison1-95/+105
early out of the loop on success.
2011-08-19Move the alarm setup/teardown out of another_ldap_try() and into separateJeremy Allison1-48/+43
functions that bracket the another_ldap_try() loop. We now never leave a dangling alarm pending on success.
2011-08-19Allow the timeout pointer to ldap_search_ext_s() to be NULL if ↵Jeremy Allison1-4/+8
lp_ldap_timeout() == 0.
2011-08-19Make it clear the time here is an absolute endtime. Don't set the alarm if ↵Jeremy Allison1-15/+35
the LDAP timeout is zero.
2011-08-19Always remove the alarm before changing the handler, not the other way around.Jeremy Allison1-1/+1
2011-08-19Remove old_handler as alarms can't be nested. Use SIG_IGN instead.Jeremy Allison1-4/+2
2011-08-19Change got_alarm from bool to the correct type of SIG_ATOMIC_T.Jeremy Allison1-3/+3
2011-08-20Re-arrange the optimization to reduce tdb fcntl calls if smbd is notIra Cooper1-1/+5
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-15s3:dbwrap_ctdb: improve transaction start/commit/cancel debuggingMichael Adam1-2/+8
* also log nesting transaction start/commit/cancel * unify transaction log messages slightly
2011-08-15s3:lib: fix a comment in tdb_unpack()Michael Adam1-1/+1
2011-08-15s3: avoid reading past the end of buffer in tdb_unpack 'f' if zero ↵Gregor Beck1-1/+1
termination is missing Signed-off-by: Michael Adam <obnox@samba.org>
2011-08-15s3: avoid reading past the end of buffer in tdb_unpack 'P' if zero ↵Gregor Beck1-1/+3
termination is missing Signed-off-by: Michael Adam <obnox@samba.org>
2011-08-15s3-prefork: Do not use mmap/mremap/munmap directlySimo Sorce1-9/+11
Use the wrappers in util.h as they deal with trying to do the best they can on platfroms that do not support mmap extensions. Autobuild-User: Simo Sorce <idra@samba.org> Autobuild-Date: Mon Aug 15 04:13:51 CEST 2011 on sn-devel-104
2011-08-11s3-messaging: Fix messaging classes.Simo Sorce1-8/+11
This has been broken since ff0ac5b0 (May 2007). Basically all messages were belonging to the General class except for CTDB messages. This fixed the message_send_all() function to correctly compute the class, and fixes registrations to include all they need to cope with the fact not all messages are of calss general (registrations rotted a bit because as long as FLAG_MSG_GENERAL was defined the process woould receive all messages). Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-11s3-messaging: Remove obsolete class.Simo Sorce1-2/+0
The FLAG_MSG_PRINT_NOTIFY class is actually obsolete and never used, as the only message belonging to it is not used either. Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10s3: Fix some typos -- Simo, please checkVolker Lendecke1-7/+7
2011-08-10s3-prefork: Fix use of child id.Simo Sorce1-2/+2
Children Ids must start at 1 as 0 represent the father. Also fix callbacks that restart logs to use a procedd global variable that holds the Id so that they work correctly both fot the parent process and the children. Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10s3-prefork: Pass the child a child_idSimo Sorce2-2/+3
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10s3-prefork: Return tsocket_address for client and serverSimo Sorce2-25/+63
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10s3-prefork: Pass messaging context around tooSimo Sorce2-5/+17
Pair-Programmed-With: Andreas Schneider <asn@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10s3-prefork: Set up a SIGCHLD handler by defaultSimo Sorce2-13/+80
We need to properly handle preforked children so it is better to just do that automatically. If the parent needs/wants to intercept SIGCHLD events it can set a callback that will be called by the prefork code once the internal cleanup function that checks all prefork children has been executed. Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10s3-prefork: Provide a cleanup functionSimo Sorce2-17/+21
This way the parent doesn't need to know how to handle dead children and keeps all of that within the prefork abstraction. Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10s3-prefork: Inline Doxygen DocumentationSimo Sorce1-0/+160
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10s3-prefork: better timing out semanticsSimo Sorce1-4/+14
If this child has no clients, let the lock functions block for 1 second, and then immediately reschedule the operation. This means we catch the lock as soon as possible on a free child. If, instead, we are already serving a client, we want to be non blocking, so we timeout immediately on getting the lock, and then we sleep a 1/10th of a second. This means that a busy child will be slightly slower on picking up the lock, but we won't block the existing client from communicating with us as we immediately react to activity on the already opened file handler. Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10s3-prefork: add support for multiple listning file descriptorsSimo Sorce2-90/+73
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10s3-prefork: provide way to send a signal to all childrenSimo Sorce2-0/+15
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10s3-prefork: provide means to expand the pool sizeSimo Sorce2-0/+33
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10s3-prefork: add way to manage number of clients per childSimo Sorce2-3/+38
The allowed_clients var is a parent managed variable that tell children how many clients they are allowed to handle at the same time. This way children can overcommit but within parent controlled limits. Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10s3-prefork: add asynchronous functionsSimo Sorce2-1/+267
To get a client connection it is now possible to use asynchronous functions. Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10s3-prefork: implement prefork frameworkSimo Sorce2-0/+578
Primarily built for forked off rpc service daemons, but not tied to rpc services and generic enough to be used elsewhere easily. Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10s3: Remove an unnecessary includeVolker Lendecke1-1/+0
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Wed Aug 10 18:10:39 CEST 2011 on sn-devel-104
2011-08-09s3:lib/events: Fix a bug in run_poll_events().Stefan Metzmacher1-0/+4
Ignore fd events without EVENT_FD_READ or EVENT_FD_WRITE also in run_events_poll(). They are ignore when building the array for the syscall in event_add_to_poll_args(), so we need to ignore them run_events_poll() too. metze Signed-off-by: Andreas Schneider <asn@samba.org> Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Tue Aug 9 10:11:54 CEST 2011 on sn-devel-104
2011-08-08s3:smbconf let drop leave the smbconf key in place to match a virgin ↵Gregor Beck1-1/+1
registry.tdb Signed-off-by: Michael Adam <obnox@samba.org>
2011-08-05s3/ldap: delay the ldap search alarm termination a bitBjörn Jacke1-2/+13
do the alarm termination of the the ldap search a bit delayed so the LDAP server has a chance to tell us that the time limit was reached and the search was abandoned. If the search is terminated this way we also get the correct LDAP return code in the logs. If alarm() stops the search the ldap search routine will report that the LDAP server is down which would trigger us to rebind to the server needlessly which we also want to avoid.
2011-08-03s3-auth remove sanitized_username from auth_serversupplied_infoAndrew Bartlett1-8/+0
This structure element was only written to, not read. It is filled into the companion structure, auth_session_info() by create_local_token(). Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-29s3: Make map_open_params_to_ntcreate() available in lib/Volker Lendecke1-0/+148
2011-07-29s3: Make is_executable() available in lib/Volker Lendecke1-0/+17
2011-07-29s3:dbwrap: move all .c and .h files of dbwrap to lib/dbwrap/Michael Adam16-13/+151
Autobuild-User: Michael Adam <obnox@samba.org> Autobuild-Date: Fri Jul 29 13:34:22 CEST 2011 on sn-devel-104
2011-07-29s3:dbwrap: move db_is_local() from dbwrap.c to dbwrap_open.cMichael Adam3-32/+33
2011-07-29s3:dbwrap: move db_open() to a file dbwrap_open.c of its own.Michael Adam9-71/+182
Also start new folder lib/dbwrap/ where dbwrap_open.c is stored and make the fallbacke implementation functoins non-static and create a dbwrap_private.h header file that contains their prototypes.
2011-07-29s3:g_lock: explicitly include dbwrap.hMichael Adam1-0/+1
2011-07-29s3:dbwrap: explicitly include dbwrap.h in dbwrap_ctdb.cMichael Adam1-0/+1
This used to come in via g_lock.h Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>
2011-07-28s3:libsmbconf: use lp_load_global() in the testsuiteMichael Adam1-6/+1