X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=servers%2Fslapd%2Fstarttls.c;h=3e26f5e2fbacc894dc932f22fbdbb1db85462a0f;hb=04311cc7163ce54d63bd2e764c13d69ea1fce57b;hp=7ab7328012bb2a3966fe2c2f08c2233175f67df2;hpb=fda3d6260e25f1d0b9c035b0d520b2c9d0f22e49;p=openldap diff --git a/servers/slapd/starttls.c b/servers/slapd/starttls.c index 7ab7328012..3e26f5e2fb 100644 --- a/servers/slapd/starttls.c +++ b/servers/slapd/starttls.c @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2004 The OpenLDAP Foundation. + * Copyright 1998-2011 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -17,17 +17,22 @@ #include #include +#include #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;