Commit Graph

1762 Commits

Author SHA1 Message Date
Hallvard Furuseth
ffbad797c8 Fix typo in ldap_int_client_controls() comment 2012-02-07 16:11:43 +01:00
Jan Vcelak
4e9926ca97 ITS#7136 MozNSS: store TLS params until the deferred initialization is finished
Deferred TLS initialization is used with Mozilla NSS. The real
initialization takes place when the TLS context is needed for the first
time. If the initialization parameters were freed immediately after
tlsm_ctx_init was called, they were not available at the time of
deferred initialization which caused segmentation fault.

With this patch, initialization parameters are copied and stored until
the deferred initialization is finished. The parameters are freed
afterwards.

Red Hat Bugzilla: #783431
2012-01-25 21:24:28 -08:00
Jan Vcelak
1107103dd7 ITS#7135 MozNSS, PEM: fix segfault when TLS certificate key is not set
Red Hat Bugzilla: #772890
2012-01-25 21:22:47 -08:00
Howard Chu
ce2c041671 Cleanup gssapi_flags -> ldo_gssapi_flags 2012-01-24 15:43:39 -08:00
Howard Chu
7ff18967d7 More for prev commit (270ef33acf) 2012-01-24 15:43:14 -08:00
Howard Chu
270ef33acf ITS#7118, #7133 tentative fix
Move mutexes to end of structs, so libldap can ignore them
2012-01-24 13:32:52 -08:00
Hallvard Furuseth
1a931a86ee Silence 'assign away const' warning 2012-01-24 01:45:51 +01:00
Kurt Zeilenga
2bbf9804b9 Happy New Year! 2012-01-01 07:10:53 -08:00
Howard Chu
277a8edd2e Android defines wctomb but doesn't provide it 2011-10-12 19:18:05 -07:00
Howard Chu
8a5d0952ad ITS#7006 fix MozNSS wildcard cert match 2011-09-30 03:27:19 -07:00
Rich Megginson
8e9af53fb6 ITS#7034 use mutex for connection handshake when using PEM nss
PEM nss is not thread safe when establishing the initial connection
using SSL_ForceHandshake.  Create a new mutex - tlsm_pem_mutex - to
protect this function call.
The call to SSL_ConfigServerSessionIDCache() is not thread-safe - move it
to the init section and protect it with the init mutex.
2011-09-30 03:16:57 -07:00
Howard Chu
9b082bf716 ITS#7051 fix GNUtls cert dn parse 2011-09-30 00:41:13 -07:00
Howard Chu
c7d6c0fab3 Add a few NULL checks to defend against dumb API checkers.
Unfortunately automated checkers don't seem to read the documentation
for how APIs are expected to be used, and the C declaration syntax
isn't expressive enough to encode the documented usage.
2011-09-08 23:41:06 -07:00
Pierangelo Masarati
568e3b7faa fix uninit'ed vars (ITS#7039) 2011-09-08 23:32:58 +02:00
Howard Chu
06ec9f1db2 ITS#7035 don't loop forever in wait4msg 2011-09-06 21:13:49 -07:00
Howard Chu
6546ecd39c ITS#7022 cleanup prev commit 2011-08-24 15:37:52 -07:00
Rich Megginson
a7aac14d2a ITS#7022 NSS_Init* functions are not thread safe
The NSS_InitContext et. al, and their corresponding shutdown functions,
are not thread safe.  There can only be one thread at a time calling
these functions.  Protect the calls with a mutex.  Create the mutex
using a PR_CallOnce to ensure that the mutex is only created once and
not used before created.  Move the registration of the nss shutdown
callback to also use a PR_CallOnce.  Removed the call to
SSL_ClearSessionCache() because it is always called at shutdown, and we must
not call it more than once.
2011-08-24 15:34:47 -07:00
Jan Vcelak
3dae953fd6 ITS#7014 TLS: don't check hostname if reqcert is 'allow'
If server certificate hostname does not match the server hostname,
connection is closed even if client has set TLS_REQCERT to 'allow'. This
is wrong - the documentation says, that bad certificates are being
ignored when TLS_REQCERT is set to 'allow'.
2011-08-24 15:27:29 -07:00
Rich Megginson
210b156ece ITS#7002 MozNSS: fix VerifyCert allow/try behavior
If the olcTLSVerifyClient is set to a value other than "never", the server
should request that the client send a client certificate for possible use
with client cert auth (e.g. SASL/EXTERNAL).
If set to "allow", if the client sends a cert, and there are problems with
it, the server will warn about problems, but will allow the SSL session to
proceed without a client cert.
If set to "try", if the client sends a cert, and there are problems with
it, the server will warn about those problems, and shutdown the SSL session.
If set to "demand" or "hard", the client must send a cert, and the server
will shutdown the SSL session if there are problems.
I added a new member of the tlsm context structure - tc_warn_only - if this
is set, tlsm_verify_cert will only warn about errors, and only if TRACE
level debug is set.  This allows the server to warn but allow bad certs
if "allow" is set, and warn and fail if "try" is set.
2011-07-28 14:09:55 -07:00
Rich Megginson
fb4b4f7445 ITS#7001 MozNSS: free the return of tlsm_find_and_verify_cert_key
If tlsm_find_and_verify_cert_key finds the cert and/or key, and it fails
to verify them, it will leave them allocated for the caller to dispose of.
There were a couple of places that were not disposing of the cert and key
upon error.
2011-07-28 14:00:15 -07:00
Jan Vcelak
e8ac17e17c ITS#6998 MozNSS: when cert not required, ignore issuer expiration
When server certificate is not required in a TLS session (e.g.
TLS_REQCERT is set to 'never'), ignore expired issuer certificate error
and do not terminate the connection.
2011-07-21 11:59:06 -07:00
Rich Megginson
d944920fd3 ITS#6980 free the result of SSL_PeerCertificate
In tlsm_auth_cert_handler, we get the peer's cert from the socket using
SSL_PeerCertificate.  This value is allocated and/or cached.  We must
destroy it using CERT_DestroyCertificate.
2011-06-29 16:56:26 -07:00
Howard Chu
7ee3dee647 ITS#6828 set ld_errno on connect failures 2011-06-27 18:43:31 -07:00
Howard Chu
052ac2f64a ITS#6828 silence warning in prev commit 2011-06-24 18:03:11 -07:00
Howard Chu
d0973003f7 ITS#6978 bail out on invalid input 2011-06-23 13:17:08 -07:00
Rich Megginson
5e467e4899 ITS#6862 MozNSS - workaround PR_SetEnv bug 2011-06-21 15:58:49 -07:00
Rich Megginson
d78cf81648 ITS#6975 MozNSS - allow cacertdir in most cases
OpenLDAP built with OpenSSL allows most any value of cacertdir - directory
is a file, directory does not contain any CA certs, directory does not
exist - users expect if they specify TLS_REQCERT=never, no matter what
the TLS_CACERTDIR setting is, TLS/SSL will just work.
TLS_CACERT, on the other hand, is a hard error.  Even if TLS_REQCERT=never,
if TLS_CACERT is specified and is not a valid CA cert file, TLS/SSL will
fail.  This patch makes CACERT errors hard errors, and makes CACERTDIR
errors "soft" errors.  The code checks CACERT first and, even though
the function will return an error, checks CACERTDIR anyway so that if the
user sets TRACE mode they will get CACERTDIR processing messages.
2011-06-21 15:56:55 -07:00
Jan Vcelak
65e163d268 ITS#6947 Handle missing '\n' termination in LDIF input 2011-06-20 18:18:34 -07:00
Howard Chu
9f7d119ce3 Add LDAP_OPT_X_TLS_PACKAGE
to return the name of the underlying TLS implementation
2011-06-10 02:11:26 -07:00
Howard Chu
33f3de77f1 ITS#6828 fix TLS setup with async connect 2011-06-08 18:27:54 -07:00
Hallvard Furuseth
fac36dcba7 ITS#6932: Clean up strange asserts & nearby code.
Mostly found by Klocwork: Issues #213,298-300,331,342-343,374,390,410.
2011-05-05 15:55:29 +02:00
Hallvard Furuseth
06dca7858e ITS#6931 Catch NULL ld for LDAP_OPT_SESSION_REFCNT.
Klocwork issue#111, ldap_get_option().
2011-05-05 14:10:32 +02:00
Hallvard Furuseth
a1cb490d0c ITS#6930 Plug ldapi://too-long-path socket leak.
Klocwork issue#117, ldap_connect_to_path().
2011-05-05 13:52:08 +02:00
Howard Chu
9b463b59ec ITS#6898 fix regression from ITS#6625
compound statements need brackets, duh.
2011-04-09 16:55:00 -07:00
Howard Chu
f8a5ce4a6e ITS#6870 move ldif.c and fetch.c from liblutil to libldap 2011-03-24 06:49:04 +00:00
Howard Chu
31a8460417 ITS#6863, fix crashes in ITS#6714 patch. From Jan Vcelak @ Red Hat 2011-03-16 18:23:26 +00:00
Howard Chu
6f1d218652 ITS#6832 #elif cleanup 2011-02-17 00:36:30 +00:00
Howard Chu
bbecfa740d ITS#6811, more for #6802 PKCS11 fork() handling from Rich Megginson @ Red Hat 2011-01-29 20:40:20 +00:00
Pierangelo Masarati
45d580e941 do not hijack loop counter (ITS#6813; blind fix) 2011-01-29 11:05:08 +00:00
Howard Chu
2d545befdd Cleanup version checking 2011-01-27 21:43:22 +00:00
Howard Chu
d27f458b37 ITS#6802 restart modules for fork() - from Rich Megginson @ Red Hat 2011-01-27 21:38:40 +00:00
Howard Chu
ba70ec8b2c ITS#6791 fix cert usage types/values - from Rich Megginson @ Red Hat 2011-01-27 21:34:35 +00:00
Howard Chu
5224536a8e ITS#6790 fix default cipher suites - from Rich Megginson @ Red Hat 2011-01-27 21:32:39 +00:00
Hallvard Furuseth
9eb5ecba15 ITS#5421 comment ldapoptions vs ldapoptions_prefix 2011-01-20 10:45:14 +00:00
Pierangelo Masarati
6d8e0d5b3e increment lconn_refcnt so connection does not get closed (ITS#6788) 2011-01-18 23:53:24 +00:00
Hallvard Furuseth
b9609cedf5 Catch ber errors in vc (Verify Credentials) 2011-01-17 13:15:27 +00:00
Hallvard Furuseth
8021cbd8f1 ITS#6738 Catch ber errors in libldap/ldap_sync.c.
Also remove variable tag in ldap_sync_search_intermediate()
and reduce  ber_scanf("tm", &tag, foo)  to  tag=ber_scanf("m", foo).
2011-01-17 12:20:56 +00:00
Hallvard Furuseth
dd640af54f Fix ITS#6672: Do not return LDAP_MUTEX_LOCK().
It has type void.
2011-01-12 14:25:37 +00:00
Hallvard Furuseth
77f78f1d57 vc.c: ber_printf/flatten rc==LBER_ERROR -> rc<0 2011-01-12 14:23:07 +00:00
Howard Chu
6a544b7193 Silence stupid MUTEX_FIRSTCREATE warnings 2011-01-11 21:34:55 +00:00