3 * Copyright 1999 The OpenLDAP Foundation.
6 * Redistribution and use in source and binary forms are permitted only
7 * as authorized by the OpenLDAP Public License. A copy of this
8 * license is available at http://www.OpenLDAP.org/license.html or
9 * in file LICENSE in the top-level directory of the distribution.
15 #include <ac/socket.h>
23 SLAP_EXTOP_CALLBACK_FN cb,
27 struct berval * reqdata,
28 struct berval ** rspdata,
29 LDAPControl ***rspctrls,
32 if ( reqdata != NULL ) {
33 /* no request data should be provided */
34 return LDAP_PROTOCOL_ERROR;
37 /* can't start TLS if it is already started */
38 if (conn->c_is_tls != 0)
39 return(LDAP_OPERATIONS_ERROR);
41 /* can't start TLS if there are other op's around */
42 if (conn->c_ops != NULL) {
43 if (conn->c_ops != op || op->o_next != NULL)
44 return(LDAP_OPERATIONS_ERROR);
46 if (conn->c_pending_ops != NULL) {
47 if (conn->c_pending_ops != op || op->o_next != NULL)
48 return(LDAP_OPERATIONS_ERROR);
51 /* here's some pseudo-code if HAVE_TLS is defined
52 * but for some reason TLS is not available.
55 if (tls not really supported) {
56 if (referral exists) {
57 // caller will need to put the referral into the result
58 return(LDAP_REFERRAL);
60 return(LDAP_UNAVAILABLE);
65 conn->c_needs_tls_accept = 1;