From: Kurt Zeilenga Date: Sat, 15 Jul 2000 00:01:09 +0000 (+0000) Subject: Store sasl callbacks in session handle so that they can properly freed. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2444 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5bca08d71620f8f22b6e622ccd5ffae9e39b19e3;p=openldap Store sasl callbacks in session handle so that they can properly freed. --- diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index e0d6fdf6de..153b74c9a2 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -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 ); diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c index a877f63d40..e834001b67 100644 --- a/servers/slapd/sasl.c +++ b/servers/slapd/sasl.c @@ -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; } diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 61e1a4dabc..26a6e85b76 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -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 */