From ea4d5606f18e30c512da211fdb24c639e9b80162 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Thu, 17 Sep 2015 15:36:50 -0700 Subject: [PATCH] Ticket #48188 - segfault in ns-slapd, unknown cause Description: In the crashed stacktrace, corrupted dn strings are observed. Other thread shows slapi-nis/compat plug-in is involved. The plug-in has a chance to trash the original sdn and reset a new one to Slapi_PBlock. The frontend bind function do_bind must retrieve "sdn" from Slapi_PBlock after SLAPI_PLUGIN_PRE_BIND_FN. --- ldap/servers/slapd/bind.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c index 1bd604f..418afb8 100644 --- a/ldap/servers/slapd/bind.c +++ b/ldap/servers/slapd/bind.c @@ -677,8 +677,7 @@ do_bind( Slapi_PBlock *pb ) * the backend bind function. then call the post-bind * plugins. */ - if ( plugin_call_plugins( pb, SLAPI_PLUGIN_PRE_BIND_FN ) - == 0 ) { + if ( plugin_call_plugins( pb, SLAPI_PLUGIN_PRE_BIND_FN ) == 0 ) { rc = 0; /* @@ -693,6 +692,11 @@ do_bind( Slapi_PBlock *pb ) * */ + /* + * SLAPI_BIND_TARGET_SDN could be modified in SLAPI_PLUGIN_PRE_BIND_FN. + * sdn needs to be refreshed from pb. + */ + slapi_pblock_get(pb, SLAPI_BIND_TARGET_SDN, &sdn); /* get the entry now, so that we can give it to slapi_check_account_lock and reslimit_update_from_dn */ if (! slapi_be_is_flag_set(be, SLAPI_BE_FLAG_REMOTE_DATA)) { bind_target_entry = get_entry(pb, slapi_sdn_get_ndn(sdn)); -- 1.9.3