Commit Graph

2596 Commits

Author SHA1 Message Date
Hallvard Furuseth
e1d42189fa ITS#4990: Fix LDAP_MEMORY_DEBUG and LDAP_MEMORY_DEBUG=0 compilation.
Declare ber_int_meminuse.  Fix '#if' -> '#ifdef' LDAP_MEMORY_DEBUG.
2007-07-04 22:55:24 +00:00
Hallvard Furuseth
2ea3d3f621 Ensure ltp_max_pending >= 0; negative values confused pool_query().
Remove accidentally added #define LDAP_MAX_PENDING from last commit.
2007-07-03 11:34:14 +00:00
Hallvard Furuseth
bc8631183c Remove bogus pause wait near end of pool_wrapper(). Add/fix comments. 2007-07-01 16:44:59 +00:00
Pierangelo Masarati
848ea293a3 cleanup 2007-06-19 22:59:53 +00:00
Pierangelo Masarati
7e12342b3b add sub-second result timeout accuracy (for which is which; ITS#4963 with changes) 2007-06-14 22:35:41 +00:00
Hallvard Furuseth
90fe4bd927 ITS#4983: Partly revert tls_thread_self() paranoia from rev 1.154: Only
require that ldap_pvt_thread_t can be cast to u.long and is not wider.
ITS#5010: In ldap_X509dn2bv(), catch error return from ber_decode_oid().
2007-06-12 23:57:08 +00:00
Hallvard Furuseth
ed0c9d223a Rename thread contexts to tasks, leaving user contexts the only context.
Remove ldap_int_thread_ctx_t.ltc_next.al (active list) left over from rev 1.75.
2007-06-10 23:58:38 +00:00
Hallvard Furuseth
c60f7c1fd2 For ITS#4943: Axe thread pool semaphore code 2007-06-10 23:37:49 +00:00
Hallvard Furuseth
25a7729a12 int -> ber_socklen_t for getsockname() 2007-06-10 20:35:30 +00:00
Hallvard Furuseth
5d083f3859 int -> ber_socklen_t for getsockopt() 2007-06-10 20:34:05 +00:00
Hallvard Furuseth
28da797a3a ITS#5007: Wrap code using MSG_WAITALL in #ifdef MSG_WAITALL. 2007-06-09 23:43:02 +00:00
Hallvard Furuseth
bfdb026fab ITS#5007: Remove void* pointer arithmetic, that's a gcc extension. 2007-06-09 23:41:36 +00:00
Hallvard Furuseth
3750520f6f Fix HP-UX crash: Replace socklen_t with ber_socklen_t from configure. ITS#4629. 2007-06-09 23:35:20 +00:00
Howard Chu
469a45a62f ITS#4992 fix cldap 2007-06-08 09:40:17 +00:00
Howard Chu
431f6fd810 ITS#4955 fix typo in referral chasing 2007-06-08 09:17:00 +00:00
Hallvard Furuseth
b327239618 Remove ltp_active_list. It became unneeded when rev 1.24 added thread_keys[].
Tighten loop in pool_pause(): Omit unneeded ltp_pcond signals since rev 1.64.
Fix comment.
2007-06-04 22:18:01 +00:00
Hallvard Furuseth
b3e4305131 Simplify: Remove tid_zero, thread_keys[].id and ldap_int_main_tid.
Not needed after ldap_int_thread_userctx_t.ltu_id was added and
_pool_wrapper took care not to update thread_keys[] during pauses.
Fix bogus thread_keys[].ctx comment.
2007-06-01 15:24:19 +00:00
Hallvard Furuseth
1b890689b1 Add comments. Constify tid_zero. Shut up gcc -Wswitch. if(!tpool)->assert(). 2007-05-31 19:47:38 +00:00
Hallvard Furuseth
1f3e6110b9 Add variable ldap_int_has_thread_pool, assert(at most one pool); 2007-05-31 17:15:54 +00:00
Hallvard Furuseth
9a9d216526 Shut up gcc -Wformat 2007-05-31 17:07:57 +00:00
Hallvard Furuseth
1b15fa9c6e In pool_submit():
- Move problematic mutex_unlock()-mutex_lock() into the unused #ifdef
  LDAP_PVT_THREAD_POOL_SEM_LOAD_CONTROL and add a FIXME comment inside.
- Delay ltp_starting--; until pool_wrapper().  Nonzero value could otherwise
  no longer be exposed when !defined LDAP_PVT_THREAD_POOL_SEM_LOAD_CONTROL.
2007-05-31 12:47:24 +00:00
Hallvard Furuseth
45389c0341 Preserve key order when deleting, so context_reset will free last keys first. 2007-05-31 12:08:50 +00:00
Hallvard Furuseth
7c6b26a68f Make get_thread_info() static. Handle ldap_pvt_thread_pool_t = int (not ptr). 2007-05-30 22:20:20 +00:00
Hallvard Furuseth
101b6b9363 Fix --without-tls (ITS#4975). Enable certificate matching. 2007-05-20 22:48:21 +00:00
Hallvard Furuseth
c47e444698 libldap/tls.c calls CRYPTO_set_id_callback(ldap_pvt_thread_self), which
causes ldap_pvt_thread_self to be called with the wrong prototype.

That can cause OpenSSL to use a garbage value, e.g. if the unsigned
long it expects takes two words but ldap_pvt_thread_t is an int.

I'm fixing it in HEAD now and also provoking an error if unsigned
long cannot hold a ldap_pvt_thread_t.  Otherwise it can silently
compile to broken code.  Maybe the latter should go in configure,
but since OpenSSL presumably breaks anyway if that fails I don't
see much point at this time.
2007-05-20 20:02:52 +00:00
Hallvard Furuseth
eb351d9e33 ITS#4972: $LDAP_THREAD_DEBUG, detached threads, debug_already_initialized().
Also plug a memory leak, set state vars even when unused for the sake of
debugging, and tweak some readability issues & data types.
2007-05-18 17:49:38 +00:00
Hallvard Furuseth
6f3cf907b8 Readability patch: ERRVAL() macro for pthreads < 7 vs. >= 7 return values. 2007-05-18 15:28:09 +00:00
Hallvard Furuseth
f906a99eec Only define x509_cert_get_dn() when HAVE_GNUTLS. Remove unused variable. 2007-05-18 15:10:15 +00:00
Howard Chu
d9a43aee44 Fix GNUtls acknowledgement, initial work by Matt Backes. Sponsored by
The Written Word and Stanford University.
2007-05-14 23:35:36 +00:00
Ralf Haferkamp
6ee5d7d3da make openssl builds working again 2007-05-14 12:19:32 +00:00
Howard Chu
423f20c915 GNUtls - ignore free of NULL ctx 2007-05-13 09:43:41 +00:00
Howard Chu
5f36d32596 Don't NUL-terminate bervals during DN parsing 2007-05-13 09:37:37 +00:00
Howard Chu
47a8f3213b Merged GNUtls support into main tls.c 2007-05-13 00:15:27 +00:00
Pierangelo Masarati
7601a1f3fb fix read off by one (spotted by valgrind) 2007-05-12 12:38:09 +00:00
Hallvard Furuseth
e509d3ed9a Comment fixes.
Corrected rev 1.67 cvs comment: ltu_key[] is NULL-terminated _when not full_.
2007-05-11 18:48:13 +00:00
Howard Chu
236e5f50b3 Added ciphersuite support 2007-05-10 21:49:43 +00:00
Howard Chu
c51fd6c96e Add LDAP_OPT_X_TLS_CRLFILE, peer cert verification for GNUtls 2007-05-10 19:43:28 +00:00
Hallvard Furuseth
810b2389dc Since we only have LDAP_MAXTHR thread_keys, allow max LDAP_MAXTHR
threads per pool, even when ltp_max_count <= 0 ("unlimited").
Keep ltp_max_count in range [0, LDAP_MAXTHR].
2007-05-09 23:25:03 +00:00
Hallvard Furuseth
f0a1511422 Make ldap_int_thread_userctx_t.ltu_key[] a proper NULL-terminated array.
(setkey/getkey expected that, but purgekey could set a NULL in the middle.)
Added some checks for input key!=NULL.

API changes, need review - I'm not sure what's indented here:
- setkey(data=NULL, kfree!=NULL) searched as if intended to reset
  the key, but updated by setting the key.  Now always updates.
- setkey(key=<not found>, data=NULL) could return either success or
  failure.  Now succeeds iff (data == NULL && kfree == NULL).
2007-05-09 22:59:04 +00:00
Hallvard Furuseth
f5da908c49 thread_keys is a (poor) open-addessed hash table, but it lacked a
"deleted item" mark.  Add DELETED_THREAD_CTX.
Also improve the hash function a bit, and make the hash unsigned.
2007-05-09 22:22:44 +00:00
Hallvard Furuseth
8a92825225 Protect thread_keys[] with ldap_pvt_thread_pool_mutex, except in
ldap_pvt_thread_pool_purgekey() which may only be called during pauses.

Thus, also wait for pauses to finish before accessing thread_keys in
ldap_int_thread_pool_wrapper().  This may prevent pending tasks from
being started when a pause had been requested, which seems to have been
possible.  If that was a feature, we can split ltp_pause==1 in 2 states:
in pause (causes wait), and pause requested.

Also move 'thread_keys[].id = <thread id>' from pool_submit to
pool_wrapper.  Until pool_wrapper set the ctx as well, thread context
lookup would just return NULL anyway.
2007-05-09 21:38:28 +00:00
Hallvard Furuseth
92afeb8ef7 Replace state LDAP_INT_THREAD_POOL_PAUSING with member ltp_pause,
so a pause will work during states FINISHING and STOPPING.

Add missing waits and signals, and move waits in pool_wrapper().
Replace if(test) with while(test) when waiting for the multi-purpose
condition variable ltp_cond.
2007-05-09 19:53:25 +00:00
Hallvard Furuseth
9e9bf22a64 ITS#4943:
In ldap_pvt_thread_pool_submit(), when backing out of thread creation:
  ltp_pending_count '++' -> '--'.  Signal if there are no more threads.
In ldap_int_thread_pool_wrapper():
  if() -> assert() where false would result in eternal loop.
2007-05-09 19:34:49 +00:00
Hallvard Furuseth
bb890724d4 Don't complain if detached threads exit after ldap_debug_thread_destroy(). 2007-05-09 19:21:08 +00:00
Hallvard Furuseth
7b7b137832 Cast Debug(%p) pointer argument to void* 2007-05-09 18:38:10 +00:00
Hallvard Furuseth
bbc719ca56 ITS#4948: '#if <undefined macro>' -> '#ifdef' warning cleanup 2007-05-09 18:17:10 +00:00
Howard Chu
b7cfa97817 coverity error, u->lud_scheme is mandatory 2007-05-08 14:13:18 +00:00
Howard Chu
4803e9ba67 Revert prev commit, unnecessary 2007-04-23 14:27:07 +00:00
Howard Chu
7eb1f62f9d ITS#4935 SASL_MAX_BUFF_SIZE should be 2^24 - 1 2007-04-23 14:21:48 +00:00
Pierangelo Masarati
f29a4e140e don't assert(0); apparently, other responses may result from a simple bind (but log them, at least; ITS#4924) 2007-04-11 08:57:41 +00:00