]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/tls2.c
Merge remote-tracking branch 'origin/mdb.RE/0.9'
[openldap] / libraries / libldap / tls2.c
index 05fce3218b105271e89a4fbc3e47c9b1c86b7de5..d86e0a90a3a643626da49533a02581e8a9083116 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2013 The OpenLDAP Foundation.
+ * Copyright 1998-2016 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -43,9 +43,7 @@ static tls_impl *tls_imp = &ldap_int_tls_impl;
 
 #endif /* HAVE_TLS */
 
-#ifdef LDAP_DEVEL
 #define LDAP_USE_NON_BLOCKING_TLS
-#endif /* LDAP_DEVEL */
 
 /* RFC2459 minimum required set of supported attribute types
  * in a certificate DN
@@ -718,6 +716,22 @@ ldap_pvt_tls_get_option( LDAP *ld, int option, void *arg )
                *(char **)arg = retval ? LDAP_STRDUP( retval ) : NULL;
                break;
        }
+       case LDAP_OPT_X_TLS_PEERCERT: {
+               void *sess = NULL;
+               struct berval *bv = arg;
+               bv->bv_len = 0;
+               bv->bv_val = NULL;
+               if ( ld != NULL ) {
+                       LDAPConn *conn = ld->ld_defconn;
+                       if ( conn != NULL ) {
+                               Sockbuf *sb = conn->lconn_sb;
+                               sess = ldap_pvt_tls_sb_ctx( sb );
+                               if ( sess != NULL )
+                                       return ldap_pvt_tls_get_peercert( sess, bv );
+                       }
+               }
+               break;
+       }
 
        default:
                return -1;
@@ -1050,6 +1064,13 @@ ldap_pvt_tls_get_cipher( void *s )
        tls_session *session = s;
        return tls_imp->ti_session_cipher( session );
 }
+
+int
+ldap_pvt_tls_get_peercert( void *s, struct berval *der )
+{
+       tls_session *session = s;
+       return tls_imp->ti_session_peercert( session, der );
+}
 #endif /* HAVE_TLS */
 
 int