c->c_authmech = NULL;
c->c_authstate = NULL;
+#ifdef HAVE_CYRUS_SASL
+ c->c_sasl_context = NULL;
+#endif
+
c->c_sb = ber_sockbuf_alloc( );
/* should check status of thread calls */
assert( c->c_pending_ops == NULL );
assert( c->c_authmech == NULL );
assert( c->c_authstate == NULL );
+#ifdef HAVE_CYRUS_SASL
+ assert( c->c_sasl_context == NULL );
+#endif
c->c_listener_url = ch_strdup( url );
c->c_peer_domain = ch_strdup( dnsname );
c->c_authstate = NULL;
}
+#ifdef HAVE_CYRUS_SASL
+ if(c->c_sasl_context != NULL ) {
+ sasl_dispose( &c->c_sasl_context );
+ c->c_sasl_context = NULL;
+ }
+#endif
+
if ( ber_pvt_sb_in_use(c->c_sb) ) {
int sd = ber_pvt_sb_get_desc(c->c_sb);
char **supportedSASLMechanisms = NULL;
#ifdef HAVE_CYRUS_SASL
-#include <sasl.h>
+static sasl_callback_t callbacks[] = {
+ { SASL_CB_LIST_END, NULL, NULL }
+};
int sasl_init( void )
{
int rc;
- char *data;
- unsigned len, count;
+ char *mechs;
sasl_conn_t *server = NULL;
- rc = sasl_server_init( NULL, "slapd" );
+ rc = sasl_server_init( callbacks, "slapd" );
if( rc != SASL_OK ) {
Debug( LDAP_DEBUG_ANY, "sasl_server_init failed\n",
#endif
rc = sasl_listmech( server, NULL, NULL, ",", NULL,
- &data, &len, &count);
+ &mechs, NULL, NULL);
if( rc != SASL_OK ) {
Debug( LDAP_DEBUG_ANY, "sasl_listmech failed: %d\n",
}
Debug( LDAP_DEBUG_TRACE, "SASL mechanisms: %s\n",
- data, 0, 0 );
+ mechs, 0, 0 );
- supportedSASLMechanisms = str2charray( data, "," );
+ supportedSASLMechanisms = str2charray( mechs, "," );
sasl_dispose( &server );
return 0;
#include <ac/socket.h>
#include <ac/time.h>
+#ifdef HAVE_CYRUS_SASL
+#include <sasl.h>
+#endif
+
#include "avl.h"
#ifndef ldap_debug
char *c_peer_name; /* peer name (trans=addr:port) */
char *c_sock_name; /* sock name (trans=addr:port) */
+#ifdef HAVE_CYRUS_SASL
+ sasl_conn_t *c_sasl_context;
+#endif
+
/* only can be changed by binding thread */
int c_bind_in_progress; /* multi-op bind in progress */