/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2015 The OpenLDAP Foundation.
+ * Copyright 1998-2017 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
}
/* we don't know anything about this, ignore it */
- if ( !conn )
- return SASL_OK;
+ if ( !conn ) {
+ rc == LDAP_SUCCESS;
+ goto done;
+ }
/* Now see what else needs to be fetched */
for( i = 0; sl.list[i].name; i++ ) {
}
}
}
+done:;
#if SASL_VERSION_FULL >= 0x020118
return rc != LDAP_SUCCESS ? SASL_FAIL : SASL_OK;
#endif
/* If we already authenticated once, must use a new context */
if ( op->o_conn->c_sasl_done ) {
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 );
}
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 );
}