From: Kurt Zeilenga Date: Wed, 4 Aug 1999 00:11:22 +0000 (+0000) Subject: Don't have time to finish SASL right now... this is a work in progress X-Git-Tag: TWEB_OL_BASE~299 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b67eb8e2be64934d845b373cbde3dc61419fa7f8;p=openldap Don't have time to finish SASL right now... this is a work in progress but is safely tucked away behind --with-cyrus-sasl. --- diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 504fe2cbfe..d455c6eafc 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -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); diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c index 2552767e35..5ebfe68d35 100644 --- a/servers/slapd/sasl.c +++ b/servers/slapd/sasl.c @@ -12,16 +12,17 @@ char **supportedSASLMechanisms = NULL; #ifdef HAVE_CYRUS_SASL -#include +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; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index d114732e48..4bea7aca51 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -11,6 +11,10 @@ #include #include +#ifdef HAVE_CYRUS_SASL +#include +#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 */