From: Kurt Zeilenga Date: Fri, 23 Dec 2005 02:20:11 +0000 (+0000) Subject: fix ITS#4283/4 segfaults X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~516 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d1bc820b2fe1eba80123a62b38cc252a14298265;p=openldap fix ITS#4283/4 segfaults --- diff --git a/servers/slapd/filter.c b/servers/slapd/filter.c index 4f7b151664..1b1c53635f 100644 --- a/servers/slapd/filter.c +++ b/servers/slapd/filter.c @@ -569,7 +569,7 @@ filter2bv_x( Operation *op, Filter *f, struct berval *fstr ) snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=%s)", f->f_av_desc->ad_cname.bv_val, - tmp.bv_val ); + tmp.bv_len ? tmp.bv_val : "(null)"); ber_memfree_x( tmp.bv_val, op->o_tmpmemctx ); break; @@ -583,7 +583,7 @@ filter2bv_x( Operation *op, Filter *f, struct berval *fstr ) snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s>=%s)", f->f_av_desc->ad_cname.bv_val, - tmp.bv_val ); + tmp.bv_len ? tmp.bv_val : "(null)"); ber_memfree_x( tmp.bv_val, op->o_tmpmemctx ); break; @@ -597,7 +597,7 @@ filter2bv_x( Operation *op, Filter *f, struct berval *fstr ) snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s<=%s)", f->f_av_desc->ad_cname.bv_val, - tmp.bv_val ); + tmp.bv_len ? tmp.bv_val : "(null)"); ber_memfree_x( tmp.bv_val, op->o_tmpmemctx ); break; @@ -611,7 +611,7 @@ filter2bv_x( Operation *op, Filter *f, struct berval *fstr ) snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s~=%s)", f->f_av_desc->ad_cname.bv_val, - tmp.bv_val ); + tmp.bv_len ? tmp.bv_val : "(null)"); ber_memfree_x( tmp.bv_val, op->o_tmpmemctx ); break; @@ -634,7 +634,7 @@ filter2bv_x( Operation *op, Filter *f, struct berval *fstr ) snprintf( &fstr->bv_val[len-2], tmp.bv_len+3, /* "(attr=" */ "%s*)", - tmp.bv_val ); + tmp.bv_len ? tmp.bv_val : "(null)"); ber_memfree_x( tmp.bv_val, op->o_tmpmemctx ); } @@ -651,7 +651,7 @@ filter2bv_x( Operation *op, Filter *f, struct berval *fstr ) snprintf( &fstr->bv_val[len-1], tmp.bv_len+3, /* "(attr=[init]*[any*]" */ "%s*)", - tmp.bv_val ); + tmp.bv_len ? tmp.bv_val : "(null)"); ber_memfree_x( tmp.bv_val, op->o_tmpmemctx ); } } @@ -667,7 +667,7 @@ filter2bv_x( Operation *op, Filter *f, struct berval *fstr ) snprintf( &fstr->bv_val[len-1], tmp.bv_len+3, /* "(attr=[init*][any*]" */ "%s)", - tmp.bv_val ); + tmp.bv_len ? tmp.bv_val : "(null)"); ber_memfree_x( tmp.bv_val, op->o_tmpmemctx ); } @@ -732,7 +732,7 @@ filter2bv_x( Operation *op, Filter *f, struct berval *fstr ) f->f_mr_dnattrs ? ":dn" : "", f->f_mr_rule_text.bv_len ? ":" : "", f->f_mr_rule_text.bv_len ? f->f_mr_rule_text.bv_val : "", - tmp.bv_val ); + tmp.bv_len ? tmp.bv_val : "(null)"); ber_memfree_x( tmp.bv_val, op->o_tmpmemctx ); } break; diff --git a/servers/slapd/saslauthz.c b/servers/slapd/saslauthz.c index 42bb8a1368..c31b931438 100644 --- a/servers/slapd/saslauthz.c +++ b/servers/slapd/saslauthz.c @@ -2055,7 +2055,8 @@ int slap_sasl_authorized( Operation *op, Debug( LDAP_DEBUG_TRACE, "==>slap_sasl_authorized: can %s become %s?\n", - authcDN->bv_val, authzDN->bv_val, 0 ); + authcDN->bv_len ? authcDN->bv_val : "(null)", + authzDN->bv_len ? authzDN->bv_val : "(null)", 0 ); /* If person is authorizing to self, succeed */ if ( dn_match( authcDN, authzDN ) ) {