]> git.sur5r.net Git - openldap/commitdiff
fix ITS#4283/4 segfaults
authorKurt Zeilenga <kurt@openldap.org>
Fri, 23 Dec 2005 02:20:11 +0000 (02:20 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 23 Dec 2005 02:20:11 +0000 (02:20 +0000)
servers/slapd/filter.c
servers/slapd/saslauthz.c

index 4f7b1516646546c82dc7d34d2a0ad4897ff23d95..1b1c53635f26734da576f58bd69004875b7aaa5e 100644 (file)
@@ -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;
 
index 42bb8a136810b99e193f7fd7f0f886832b6fe215..c31b9314381e5c6d1576daae24667c852d1131c6 100644 (file)
@@ -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 ) ) {