#endif
static tls_impl *tls_imp = &ldap_int_tls_impl;
+#define HAS_TLS( sb ) ber_sockbuf_ctrl( sb, LBER_SB_OPT_HAS_IO, \
+ (void *)tls_imp->ti_sbio )
#endif /* HAVE_TLS */
int err;
tls_session *ssl = NULL;
- ber_sockbuf_ctrl( sb, LBER_SB_OPT_GET_SSL, (void *)&ssl );
- if ( !ssl ) {
+ if ( HAS_TLS( sb )) {
+ ber_sockbuf_ctrl( sb, LBER_SB_OPT_GET_SSL, (void *)&ssl );
+ } else {
struct ldapoptions *lo;
tls_ctx *ctx;
int err;
tls_session *ssl = NULL;
- ber_sockbuf_ctrl( sb, LBER_SB_OPT_GET_SSL, (void *)&ssl );
- if ( !ssl ) {
+ if ( HAS_TLS( sb )) {
+ ber_sockbuf_ctrl( sb, LBER_SB_OPT_GET_SSL, (void *)&ssl );
+ } else {
ssl = alloc_handle( ctx_arg, 1 );
if ( ssl == NULL ) return -1;
int
ldap_pvt_tls_inplace ( Sockbuf *sb )
{
- tls_session *ssl = NULL;
-
- ber_sockbuf_ctrl( sb, LBER_SB_OPT_GET_SSL, (void *)&ssl );
- return ssl != NULL;
+ return HAS_TLS( sb ) ? 1 : 0;
}
int