summaryrefslogtreecommitdiffstats
path: root/ssl.c
diff options
context:
space:
mode:
authorAdriaan de Jong <dejong@fox-it.com>2011-06-30 13:51:16 +0200
committerDavid Sommerseth <davids@redhat.com>2011-10-21 14:51:45 +0200
commit06d22777e9172efe3b3dc15c1bc2c6ef5d292cfa (patch)
tree84a5685bb717b30e73743b9d81a670f78d0ac878 /ssl.c
parentfe100528c780548c21d664d1c14b37cbfd4c3e0f (diff)
downloadopenvpn-06d22777e9172efe3b3dc15c1bc2c6ef5d292cfa.tar.gz
openvpn-06d22777e9172efe3b3dc15c1bc2c6ef5d292cfa.tar.xz
openvpn-06d22777e9172efe3b3dc15c1bc2c6ef5d292cfa.zip
Refactored: Netscape certificate type verification
Signed-off-by: Adriaan de Jong <dejong@fox-it.com> Acked-by: James Yonan <james@openvpn.net> Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'ssl.c')
-rw-r--r--ssl.c38
1 files changed, 3 insertions, 35 deletions
diff --git a/ssl.c b/ssl.c
index ac337e0..e16f1a3 100644
--- a/ssl.c
+++ b/ssl.c
@@ -387,26 +387,6 @@ bool verify_cert_ku (X509 *x509, const unsigned * const expected_ku, int expecte
#endif /* OPENSSL_VERSION_NUMBER */
-/*
- * nsCertType checking
- */
-
-#define verify_nsCertType(x, usage) (((x)->ex_flags & EXFLAG_NSCERT) && ((x)->ex_nscert & (usage)))
-
-static const char *
-print_nsCertType (int type)
-{
- switch (type)
- {
- case NS_SSL_SERVER:
- return "SERVER";
- case NS_SSL_CLIENT:
- return "CLIENT";
- default:
- return "?";
- }
-}
-
static void
string_mod_sslname (char *str, const unsigned int restrictive_flags, const unsigned int ssl_flags)
{
@@ -532,21 +512,9 @@ verify_cert(struct tls_session *session, x509_cert_t *cert, int cert_depth)
/* export current untrusted IP */
setenv_untrusted (session);
- /* verify certificate nsCertType */
- if (opt->ns_cert_type && cert_depth == 0)
- {
- if (verify_nsCertType (cert, opt->ns_cert_type))
- {
- msg (D_HANDSHAKE, "VERIFY OK: nsCertType=%s",
- print_nsCertType (opt->ns_cert_type));
- }
- else
- {
- msg (D_HANDSHAKE, "VERIFY nsCertType ERROR: %s, require nsCertType=%s",
- subject, print_nsCertType (opt->ns_cert_type));
- goto err; /* Reject connection */
- }
- }
+ /* If this is the peer's own certificate, verify it */
+ if (cert_depth == 0 && verify_peer_cert(opt, cert, subject, common_name))
+ goto err;
#if OPENSSL_VERSION_NUMBER >= 0x00907000L