]> git.sur5r.net Git - openldap/commitdiff
Don't have time to finish SASL right now... this is a work in progress
authorKurt Zeilenga <kurt@openldap.org>
Wed, 4 Aug 1999 00:11:22 +0000 (00:11 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 4 Aug 1999 00:11:22 +0000 (00:11 +0000)
but is safely tucked away behind --with-cyrus-sasl.

servers/slapd/connection.c
servers/slapd/sasl.c
servers/slapd/slap.h

index 504fe2cbfe0c13a82f0ef354426eded7eeaadd23..d455c6eafcb26c911e6b1d879fe77a7f27748639 100644 (file)
@@ -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);
 
index 2552767e35a53df6081bf527b09346ba441f8a9a..5ebfe68d357b35160b5f8e6712ac2146df9069a8 100644 (file)
 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;
index d114732e487a5553656c9b61675e4c6065cfa0a2..4bea7aca51b4e92a4cbda4e5ce2a10f8ed7414aa 100644 (file)
 #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 */