From 328046248b58ad85d3a9334d269bc736562592ea Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 10 Aug 2002 14:13:46 +0000 Subject: [PATCH] initialize struct timeval (fixes ITS#2014); also, check for return value of dnNormalize2: if the returned DN contains undefined attributes, the normalization fails. --- servers/slapd/back-meta/search.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/servers/slapd/back-meta/search.c b/servers/slapd/back-meta/search.c index 7d8fc6b7f8..a670ef415c 100644 --- a/servers/slapd/back-meta/search.c +++ b/servers/slapd/back-meta/search.c @@ -117,7 +117,7 @@ meta_back_search( struct metainfo *li = ( struct metainfo * )be->be_private; struct metaconn *lc; struct metasingleconn *lsc; - struct timeval tv; + struct timeval tv = { 0, 0 }; LDAPMessage *res, *e; int count, rc = 0, *msgid, sres = LDAP_NO_SUCH_OBJECT; char *match = NULL, *err = NULL; @@ -467,11 +467,13 @@ meta_back_search( #ifdef NEW_LOGGING LDAP_LOG( BACK_META, ERR, - "meta_back_search [%d] match=\"%s\" err=\"%s\"\n", + "meta_back_search [%d] " + "match=\"%s\" err=\"%s\"\n", i, match, err ); #else /* !NEW_LOGGING */ Debug( LDAP_DEBUG_ANY, - "=>meta_back_search [%d] match=\"%s\" err=\"%s\"\n", + "=>meta_back_search [%d] " + "match=\"%s\" err=\"%s\"\n", i, match, err ); #endif /* !NEW_LOGGING */ @@ -561,9 +563,9 @@ finish:; } if ( msgid ) { - free( msgid ); + ch_free( msgid ); } - + return rc; } @@ -618,7 +620,16 @@ meta_send_entry( return; } - dnNormalize2( NULL, &ent.e_name, &ent.e_nname ); + /* + * Note: this may fail if the target host(s) schema differs + * from the one known to the meta, and a DN with unknown + * attributes is returned. + * + * FIXME: should we log anything, or delegate to dnNormalize2? + */ + if ( dnNormalize2( NULL, &ent.e_name, &ent.e_nname ) != LDAP_SUCCESS ) { + return; + } /* * cache dn -- 2.39.5