]> git.sur5r.net Git - openldap/commitdiff
Store sasl callbacks in session handle so that they can properly freed.
authorKurt Zeilenga <kurt@openldap.org>
Sat, 15 Jul 2000 00:01:09 +0000 (00:01 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 15 Jul 2000 00:01:09 +0000 (00:01 +0000)
servers/slapd/connection.c
servers/slapd/sasl.c
servers/slapd/slap.h

index e0d6fdf6dead8652b3de650d793b454b4e82a43b..153b74c9a2e0e749bffd7f7e39a176a5831d3766 100644 (file)
@@ -379,6 +379,7 @@ long connection_init(
 
                c->c_sasl_bind_mech = NULL;
                c->c_sasl_context = NULL;
+               c->c_sasl_extra = NULL;
 
         c->c_sb = ber_sockbuf_alloc( );
                c->c_currentber = NULL;
@@ -405,6 +406,7 @@ long connection_init(
     assert( c->c_pending_ops == NULL );
        assert( c->c_sasl_bind_mech == NULL );
        assert( c->c_sasl_context == NULL );
+       assert( c->c_sasl_extra == NULL );
        assert( c->c_currentber == NULL );
 
        c->c_listener_url = ch_strdup( url  );
index a877f63d4000114d487cfe9fc33855669ca7e17a..e834001b67b2157b666eb72c63e7da306796bf3a 100644 (file)
@@ -231,8 +231,14 @@ int slap_sasl_open( Connection *conn )
 
 #ifdef HAVE_CYRUS_SASL
        sasl_conn_t *ctx = NULL;
-       sasl_callback_t *session_callbacks =
+       sasl_callback_t *session_callbacks;
+
+       assert( conn->c_sasl_context == NULL );
+       assert( conn->c_sasl_extra == NULL );
+
+       session_callbacks =
                ch_calloc( 3, sizeof(sasl_callback_t));
+       conn->c_sasl_extra = session_callbacks;
 
        session_callbacks[0].id = SASL_CB_LOG;
        session_callbacks[0].proc = &sasl_cb_log;
@@ -363,6 +369,9 @@ int slap_sasl_close( Connection *conn )
        }
 
        conn->c_sasl_context = NULL;
+
+       free( conn->c_sasl_extra );
+       conn->c_sasl_extra = NULL;
 #endif
        return LDAP_SUCCESS;
 }
index 61e1a4dabc8284760875cfea4fcd5a5a8acfb13d..26a6e85b76beb25ddc893fa96f45e6d743b29d96 100644 (file)
@@ -1067,6 +1067,7 @@ typedef struct slap_conn {
        int     c_needs_tls_accept;     /* true if SSL_accept should be called */
 #endif
        void    *c_sasl_context;        /* SASL session context */
+       void    *c_sasl_extra;          /* SASL session extra stuff */
 
        long    c_n_ops_received;               /* num of ops received (next op_id) */
        long    c_n_ops_executing;      /* num of ops currently executing */