File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -826,10 +826,28 @@ def test_tls_ext(self):
826
826
l .set_option (_ldap .OPT_X_TLS_NEWCTX , 0 )
827
827
l .start_tls_s ()
828
828
829
+ @requires_tls ()
830
+ def test_tls_require_cert (self ):
831
+ # libldap defaults to secure cert validation
832
+ # see libraries/libldap/init.c
833
+ # gopts->ldo_tls_require_cert = LDAP_OPT_X_TLS_DEMAND;
834
+
835
+ self .assertEqual (
836
+ _ldap .get_option (_ldap .OPT_X_TLS_REQUIRE_CERT ),
837
+ _ldap .OPT_X_TLS_DEMAND
838
+ )
839
+ l = self ._open_conn (bind = False )
840
+ self .assertEqual (
841
+ l .get_option (_ldap .OPT_X_TLS_REQUIRE_CERT ),
842
+ _ldap .OPT_X_TLS_DEMAND
843
+ )
844
+
829
845
@requires_tls ()
830
846
def test_tls_ext_noca (self ):
831
847
l = self ._open_conn (bind = False )
832
848
l .set_option (_ldap .OPT_PROTOCOL_VERSION , _ldap .VERSION3 )
849
+ # fails because libldap defaults to secure cert validation but
850
+ # the test CA is not installed as trust anchor.
833
851
with self .assertRaises (_ldap .CONNECT_ERROR ) as e :
834
852
l .start_tls_s ()
835
853
# known resaons:
You can’t perform that action at this time.
0 commit comments