From 52f7daab0101648d1713cbc7764a6c209d103cb4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= Date: Mon, 15 Jan 2018 16:07:59 +0000 Subject: [PATCH] ITS#8796 Fix SSF reset Maintain the SSF across SASL binds. --- servers/slapd/sasl.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c index 934e92239d..7ae580a32c 100644 --- a/servers/slapd/sasl.c +++ b/servers/slapd/sasl.c @@ -1643,11 +1643,16 @@ int slap_sasl_bind( Operation *op, SlapReply *rs ) if ( !op->o_conn->c_sasl_bind_in_progress ) { /* If we already authenticated once, must use a new context */ if ( op->o_conn->c_sasl_done ) { - sasl_ssf_t *ssf = NULL; + sasl_ssf_t ssf = 0; + sasl_ssf_t *ssfp = NULL; const char *authid = NULL; - sasl_getprop( ctx, SASL_SSF_EXTERNAL, (void *)&ssf ); + + sasl_getprop( ctx, SASL_SSF_EXTERNAL, (void *)&ssfp ); + if ( ssfp ) ssf = *ssfp; + sasl_getprop( ctx, SASL_AUTH_EXTERNAL, (void *)&authid ); if ( authid ) authid = ch_strdup( authid ); + if ( ctx != op->o_conn->c_sasl_sockctx ) { sasl_dispose( &ctx ); } @@ -1655,8 +1660,8 @@ int slap_sasl_bind( Operation *op, SlapReply *rs ) slap_sasl_open( op->o_conn, 1 ); ctx = op->o_conn->c_sasl_authctx; + sasl_setprop( ctx, SASL_SSF_EXTERNAL, &ssf ); if ( authid ) { - sasl_setprop( ctx, SASL_SSF_EXTERNAL, ssf ); sasl_setprop( ctx, SASL_AUTH_EXTERNAL, authid ); ch_free( (char *)authid ); } -- 2.39.5