Skip to content
Snippets Groups Projects
Commit b67eb8e2 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Don't have time to finish SASL right now... this is a work in progress

but is safely tucked away behind --with-cyrus-sasl.
parent 1e7812f2
No related branches found
No related tags found
No related merge requests found
......@@ -359,6 +359,10 @@ long connection_init(
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 */
......@@ -382,6 +386,9 @@ long connection_init(
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 );
......@@ -479,6 +486,13 @@ connection_destroy( Connection *c )
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);
......
......@@ -12,16 +12,17 @@
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",
......@@ -58,7 +59,7 @@ int sasl_init( void )
#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",
......@@ -67,9 +68,9 @@ int sasl_init( void )
}
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;
......
......@@ -11,6 +11,10 @@
#include <ac/socket.h>
#include <ac/time.h>
#ifdef HAVE_CYRUS_SASL
#include <sasl.h>
#endif
#include "avl.h"
#ifndef ldap_debug
......@@ -612,6 +616,10 @@ typedef struct slap_conn {
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 */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment