]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/starttls.c
Fixup bdb_entry_release now that entry_decode uses two memory blocks
[openldap] / servers / slapd / starttls.c
index bd12f32c73d0be0c140d9c0b4cd10dad23ce2ef5..335213b5af821fd8a560e246c121884ba41fb8b6 100644 (file)
@@ -14,6 +14,8 @@
 #include <stdio.h>
 #include <ac/socket.h>
 
+#include <ldap_pvt.h>
+
 #include "slap.h"
 
 #ifdef HAVE_TLS
@@ -59,8 +61,23 @@ starttls_extop (
                goto done;
        }
 
+       if ( ( global_disallows & SLAP_DISALLOW_TLS_AUTHC ) &&
+               ( conn->c_dn != NULL ) )
+       {
+               *text = "cannot start TLS after authentication";
+               rc = LDAP_OPERATIONS_ERROR;
+               goto done;
+       }
+
+       if ( ( global_allows & SLAP_ALLOW_TLS_2_ANON ) &&
+               ( conn->c_dn != NULL ) )
+       {
+               /* force to anonymous */
+               connection2anonymous( conn );
+       }
+
        /* fail if TLS could not be initialized */
-       if (ldap_pvt_tls_get_option(NULL, LDAP_OPT_X_TLS_CERT, &ctx) != 0
+       if (ldap_pvt_tls_get_option( NULL, LDAP_OPT_X_TLS_CTX, &ctx ) != 0
                || ctx == NULL)
        {
                if (default_referral != NULL) {