From: Kurt Zeilenga Date: Tue, 26 Sep 2000 17:47:24 +0000 (+0000) Subject: Fix ber_scanf and init bugs X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1883 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fcb3ccc52684018efc84df3e6062bfc06f284c67;p=openldap Fix ber_scanf and init bugs --- diff --git a/servers/slapd/back-bdb/dn2entry.c b/servers/slapd/back-bdb/dn2entry.c index b30dce4a23..c8a34fe55a 100644 --- a/servers/slapd/back-bdb/dn2entry.c +++ b/servers/slapd/back-bdb/dn2entry.c @@ -33,7 +33,10 @@ bdb_dn2entry( Debug(LDAP_DEBUG_TRACE, "bdb_dn2entry: dn: \"%s\"\n", dn, 0, 0 ); + *e = NULL; + if( matched != NULL ) { + *matched = NULL; rc = bdb_dn2id_matched( be, tid, dn, &id, &matchedDN ); } else { rc = bdb_dn2id( be, tid, dn, &id ); @@ -51,4 +54,4 @@ bdb_dn2entry( } return rc; -} \ No newline at end of file +} diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index 6cef7b7d48..cd8afb0f29 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -355,7 +355,7 @@ int entry_decode( struct berval *bv, Entry **entry ) e = (Entry *) ch_malloc( sizeof(Entry) ); if( e == NULL ) { - Debug( LDAP_DEBUG_TRACE, + Debug( LDAP_DEBUG_ANY, "<= entry_encode: entry allocation failed\n", 0, 0, 0 ); return LDAP_LOCAL_ERROR; @@ -368,12 +368,16 @@ int entry_decode( struct berval *bv, Entry **entry ) e->e_attrs = NULL; e->e_private = NULL; - rc = ber_scanf( ber, "{ss" /*"}"*/, &e->e_dn, &e->e_ndn ); - if( rc < 0 ) { + tag = ber_scanf( ber, "{aa" /*"}"*/, &e->e_dn, &e->e_ndn ); + if( tag == LBER_ERROR ) { free( e ); return LDAP_PROTOCOL_ERROR; } + Debug( LDAP_DEBUG_TRACE, + "entry_encode: \"%s\"\n", + e->e_dn, 0, 0 ); + /* get the attrs */ for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT; @@ -384,9 +388,9 @@ int entry_decode( struct berval *bv, Entry **entry ) AttributeDescription *ad; const char *text; - rc = ber_scanf( ber, "{O{V}}", &type, &vals ); + tag = ber_scanf( ber, "{O{V}}", &type, &vals ); - if ( rc == LBER_ERROR ) { + if ( tag == LBER_ERROR ) { Debug( LDAP_DEBUG_ANY, "entry_decode: decoding error\n", 0, 0, 0 ); entry_free( e ); return LDAP_PROTOCOL_ERROR;