]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/starttls.c
ITS#6164 avoid conn->c_mutex in send_ldap_ber
[openldap] / servers / slapd / starttls.c
index 7ab7328012bb2a3966fe2c2f08c2233175f67df2..59cfbe367716525ef4c2d387b2a198efb4b2571e 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2013 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 
 #include <stdio.h>
 #include <ac/socket.h>
+#include <ac/string.h>
 
 #include "slap.h"
+#include "lber_pvt.h"
 
-#ifdef HAVE_TLS
+const struct berval slap_EXOP_START_TLS = BER_BVC(LDAP_EXOP_START_TLS);
 
+#ifdef HAVE_TLS
 int
 starttls_extop ( Operation *op, SlapReply *rs )
 {
-       void *ctx;
        int rc;
 
+       Statslog( LDAP_DEBUG_STATS, "%s STARTTLS\n",
+           op->o_log_prefix, 0, 0, 0, 0 );
+
        if ( op->ore_reqdata != NULL ) {
                /* no request data should be provided */
                rs->sr_text = "no request data expected";
@@ -55,7 +60,7 @@ starttls_extop ( Operation *op, SlapReply *rs )
                goto done;
        }
 
-       if ( !( SLAPD_GLOBAL(disallows) & SLAP_DISALLOW_TLS_2_ANON ) &&
+       if ( !( global_disallows & SLAP_DISALLOW_TLS_2_ANON ) &&
                ( op->o_conn->c_dn.bv_len != 0 ) )
        {
                Statslog( LDAP_DEBUG_STATS,
@@ -66,7 +71,7 @@ starttls_extop ( Operation *op, SlapReply *rs )
                connection2anonymous( op->o_conn );
        }
 
-       if ( ( SLAPD_GLOBAL(disallows) & SLAP_DISALLOW_TLS_AUTHC ) &&
+       if ( ( global_disallows & SLAP_DISALLOW_TLS_AUTHC ) &&
                ( op->o_conn->c_dn.bv_len != 0 ) )
        {
                rs->sr_text = "cannot start TLS after authentication";
@@ -75,8 +80,8 @@ starttls_extop ( Operation *op, SlapReply *rs )
        }
 
        /* fail if TLS could not be initialized */
-       if ( SLAPD_GLOBAL(tls_ctx) == NULL ) {
-               if (SLAPD_GLOBAL(default_referral) != NULL) {
+       if ( slap_tls_ctx == NULL ) {
+               if (default_referral != NULL) {
                        /* caller will put the referral in the result */
                        rc = LDAP_REFERRAL;
                        goto done;