]> git.sur5r.net Git - openldap/commitdiff
Fix ber_scanf and init bugs
authorKurt Zeilenga <kurt@openldap.org>
Tue, 26 Sep 2000 17:47:24 +0000 (17:47 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 26 Sep 2000 17:47:24 +0000 (17:47 +0000)
servers/slapd/back-bdb/dn2entry.c
servers/slapd/entry.c

index b30dce4a23bec04b6e71df1e1d5ce97b4e6cfc21..c8a34fe55a3de41ae7f1d596887c6365afe75b9d 100644 (file)
@@ -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
+}
index 6cef7b7d48014caf008cab5eb8055bb681eaf94a..cd8afb0f29add6b67dabf51c54743853f43f8a13 100644 (file)
@@ -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;