From 88990a5c6ab659906acb9961d79cecd45671b6d7 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Wed, 26 Feb 2003 00:48:37 +0000 Subject: [PATCH] SLAP_BVALUES fixes --- servers/slapd/entry.c | 29 ++++++++++++++++++----------- servers/slapd/tools/slapadd.c | 8 +++++--- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index 23d58ed758..346bb87b83 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -46,7 +46,7 @@ str2entry( char *s ) char *type; struct berval vals[2]; #ifdef SLAP_NVALUES - struct berval nvals[2]; + struct berval nvals[2], *nvalsp; #endif AttributeDescription *ad; const char *text; @@ -92,6 +92,7 @@ str2entry( char *s ) e->e_id = NOID; /* dn + attributes */ + vals[1].bv_len = 0; vals[1].bv_val = NULL; next = s; @@ -239,7 +240,14 @@ str2entry( char *s ) } #ifdef SLAP_NVALUES - if( ad->ad_type->sat_syntax->ssyn_normalize ) { + nvalsp = NULL; + nvals[0].bv_val = NULL; + +#if 0 + if( ad->ad_type->sat_equality && + ad->ad_type->sat_equality->smr_match && + ad->ad_type->sat_syntax->ssyn_normalize ) + { rc = ad->ad_type->sat_syntax->ssyn_normalize( ad->ad_type->sat_syntax, &vals[0], &nvals[0] ); @@ -259,20 +267,19 @@ str2entry( char *s ) } #endif - } else { - nvals[0].bv_len = 0; - nvals[0].bv_val = NULL; - } + nvals[1].bv_len = 0; + nvals[1].bv_val = NULL; - nvals[1].bv_len = 0; - nvals[1].bv_val = NULL; + nvalsp = &nvals[0]; + } +#endif #endif - rc = attr_merge( e, ad, vals #ifdef SLAP_NVALUES - , nvals + rc = attr_merge( e, ad, vals, nvalsp ); +#else + rc = attr_merge( e, ad, vals ); #endif - ); if( rc != 0 ) { #ifdef NEW_LOGGING LDAP_LOG( OPERATION, DETAIL1, diff --git a/servers/slapd/tools/slapadd.c b/servers/slapd/tools/slapadd.c index 72e9121a0a..af26cdd4e7 100644 --- a/servers/slapd/tools/slapadd.c +++ b/servers/slapd/tools/slapadd.c @@ -135,10 +135,12 @@ main( int argc, char **argv ) break; } + vals[1].bv_len = 0; vals[1].bv_val = NULL; + #ifdef SLAP_NVALUES - attr_merge( e, slap_schema.si_ad_structuralObjectClass, vals, - NULL /* FIXME */ ); + attr_merge( e, slap_schema.si_ad_structuralObjectClass, + vals, NULL /* FIXME */ ); #else attr_merge( e, slap_schema.si_ad_structuralObjectClass, vals ); #endif @@ -209,7 +211,7 @@ main( int argc, char **argv ) vals[0].bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ) ); vals[0].bv_val = uuidbuf; #ifdef SLAP_NVALUES - attr_merge( e, slap_schema.si_ad_entryUUID, vals, vals ); + attr_merge( e, slap_schema.si_ad_entryUUID, vals, NULL ); #else attr_merge( e, slap_schema.si_ad_entryUUID, vals ); #endif -- 2.39.5