diff --git a/servers/slapd/back-dnssrv/search.c b/servers/slapd/back-dnssrv/search.c index 2e0f14fca4..fa49178673 100644 --- a/servers/slapd/back-dnssrv/search.c +++ b/servers/slapd/back-dnssrv/search.c @@ -179,8 +179,8 @@ dnssrv_back_search( e.e_attrs = NULL; e.e_private = NULL; - attr_mergeit_one( &e, ad_objectClass, &slap_schema.si_oc_referral->soc_cname ); - attr_mergeit_one( &e, ad_objectClass, &slap_schema.si_oc_extensibleObject->soc_cname ); + attr_merge_one( &e, ad_objectClass, &slap_schema.si_oc_referral->soc_cname, NULL ); + attr_merge_one( &e, ad_objectClass, &slap_schema.si_oc_extensibleObject->soc_cname, NULL ); if ( ad_dc ) { char *p; @@ -200,17 +200,17 @@ dnssrv_back_search( bv.bv_len = strlen( bv.bv_val ); } - attr_mergeit_one( &e, ad_dc, &bv ); + attr_merge_normalize_one( &e, ad_dc, &bv, NULL ); } if ( ad_associatedDomain ) { struct berval bv; ber_str2bv( domain, 0, 0, &bv ); - attr_mergeit_one( &e, ad_associatedDomain, &bv ); + attr_merge_normalize_one( &e, ad_associatedDomain, &bv, NULL ); } - attr_mergeit( &e, ad_ref, urls ); + attr_merge_normalize_one( &e, ad_ref, urls, NULL ); rc = test_filter( op, &e, op->oq_search.rs_filter ); diff --git a/servers/slapd/back-passwd/search.c b/servers/slapd/back-passwd/search.c index a2d13ae06c..e32e8b9b6d 100644 --- a/servers/slapd/back-passwd/search.c +++ b/servers/slapd/back-passwd/search.c @@ -103,7 +103,7 @@ passwd_back_search( goto done; } - attr_mergeit_one( &e, desc, &rdn[0]->la_value ); + attr_merge_normalize_one( &e, desc, &rdn[0]->la_value, NULL ); ldap_rdnfree(rdn); rdn = NULL; @@ -116,7 +116,7 @@ passwd_back_search( * should be a configuratable item */ BER_BVSTR( &val, "organizationalUnit" ); - attr_mergeit_one( &e, ad_objectClass, &val ); + attr_merge_one( &e, ad_objectClass, &val, NULL ); if ( test_filter( op, &e, op->ors_filter ) == LDAP_COMPARE_TRUE ) { rs->sr_entry = &e; @@ -300,23 +300,17 @@ pw2entry( Backend *be, struct passwd *pw, Entry *e ) e->e_attrs = NULL; /* objectclasses should be configurable items */ -#if 0 - /* "top" is redundant */ - BER_BVSTR( &val, "top" ); - attr_mergeit_one( e, ad_objectClass, &val ); -#endif - BER_BVSTR( &val, "person" ); - attr_mergeit_one( e, slap_schema.si_ad_objectClass, &val ); + attr_merge_one( e, slap_schema.si_ad_objectClass, &val, NULL ); BER_BVSTR( &val, "uidObject" ); - attr_mergeit_one( e, slap_schema.si_ad_objectClass, &val ); + attr_merge_one( e, slap_schema.si_ad_objectClass, &val, NULL ); val.bv_val = pw->pw_name; val.bv_len = pwlen; - attr_mergeit_one( e, slap_schema.si_ad_uid, &val ); /* required by uidObject */ - attr_mergeit_one( e, slap_schema.si_ad_cn, &val ); /* required by person */ - attr_mergeit_one( e, ad_sn, &val ); /* required by person */ + attr_merge_normalize_one( e, slap_schema.si_ad_uid, &val, NULL ); /* required by uidObject */ + attr_merge_normalize_one( e, slap_schema.si_ad_cn, &val, NULL ); /* required by person */ + attr_merge_normalize_one( e, ad_sn, &val, NULL ); /* required by person */ #ifdef HAVE_PW_GECOS /* @@ -328,7 +322,7 @@ pw2entry( Backend *be, struct passwd *pw, Entry *e ) char *s; ber_str2bv( pw->pw_gecos, 0, 0, &val ); - attr_mergeit_one( e, ad_desc, &val ); + attr_merge_normalize_one( e, ad_desc, &val, NULL ); s = strchr( val.bv_val, ',' ); if ( s ) *s = '\0'; @@ -350,12 +344,12 @@ pw2entry( Backend *be, struct passwd *pw, Entry *e ) val.bv_len = strlen( val.bv_val ); if ( val.bv_len && strcasecmp( val.bv_val, pw->pw_name ) ) { - attr_mergeit_one( e, slap_schema.si_ad_cn, &val ); + attr_merge_normalize_one( e, slap_schema.si_ad_cn, &val, NULL ); } if ( ( s = strrchr(val.bv_val, ' ' ) ) ) { ber_str2bv( s + 1, 0, 0, &val ); - attr_mergeit_one( e, ad_sn, &val ); + attr_merge_normalize_one( e, ad_sn, &val, NULL ); } } #endif /* HAVE_PW_GECOS */ diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 0e05bc2561..01bc45880b 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -1885,7 +1885,7 @@ config_syncrepl(ConfigArgs *c) { static int config_referral(ConfigArgs *c) { - struct berval vals[2]; + struct berval val; if (c->op == SLAP_CONFIG_EMIT) { if ( default_referral ) { value_add( &c->rvalue_vals, default_referral ); @@ -1912,9 +1912,8 @@ config_referral(ConfigArgs *c) { return(1); } - ber_str2bv(c->argv[1], 0, 0, &vals[0]); - vals[1].bv_val = NULL; vals[1].bv_len = 0; - if(value_add(&default_referral, vals)) return(LDAP_OTHER); + ber_str2bv(c->argv[1], 0, 0, &val); + if(value_add_one(&default_referral, &val)) return(LDAP_OTHER); return(0); } @@ -2205,7 +2204,7 @@ config_updatedn(ConfigArgs *c) { static int config_updateref(ConfigArgs *c) { - struct berval vals[2]; + struct berval val; if (c->op == SLAP_CONFIG_EMIT) { if ( c->be->be_update_refs ) { value_add( &c->rvalue_vals, c->be->be_update_refs ); @@ -2238,9 +2237,8 @@ config_updateref(ConfigArgs *c) { c->log, c->argv[1], 0); return(1); } - ber_str2bv(c->argv[1], 0, 0, &vals[0]); - vals[1].bv_val = NULL; - if(value_add(&c->be->be_update_refs, vals)) return(LDAP_OTHER); + ber_str2bv(c->argv[1], 0, 0, &val); + if(value_add_one(&c->be->be_update_refs, &val)) return(LDAP_OTHER); return(0); } @@ -4084,7 +4082,7 @@ static int config_build_entry( ConfigArgs *c, Entry *e, ObjectClass *oc, struct berval *rdn, ConfigTable *ct, int table ) { - struct berval vals[2]; + struct berval val; struct berval ad_name; AttributeDescription *ad = NULL; int rc, i; @@ -4095,10 +4093,8 @@ config_build_entry( ConfigArgs *c, Entry *e, ObjectClass *oc, AttributeType **at; Attribute *oc_at; - BER_BVZERO( &vals[1] ); - - vals[0] = oc->soc_cname; - attr_merge_normalize(e, slap_schema.si_ad_objectClass, vals, NULL ); + val = oc->soc_cname; + attr_merge_normalize_one(e, slap_schema.si_ad_objectClass, &val, NULL ); ptr = strchr(rdn->bv_val, '='); ad_name.bv_val = rdn->bv_val; ad_name.bv_len = ptr - rdn->bv_val; @@ -4106,9 +4102,9 @@ config_build_entry( ConfigArgs *c, Entry *e, ObjectClass *oc, if ( rc ) { return rc; } - vals[0].bv_val = ptr+1; - vals[0].bv_len = rdn->bv_len - (vals[0].bv_val - rdn->bv_val); - attr_merge_normalize(e, ad, vals, NULL ); + val.bv_val = ptr+1; + val.bv_len = rdn->bv_len - (val.bv_val - rdn->bv_val); + attr_merge_normalize_one(e, ad, &val, NULL ); for (at=oc->soc_required; at && *at; at++) { /* Skip the naming attr */ @@ -4169,9 +4165,8 @@ config_build_entry( ConfigArgs *c, Entry *e, ObjectClass *oc, } } oc_at = attr_find( e->e_attrs, slap_schema.si_ad_objectClass ); - rc = structural_class(oc_at->a_vals, vals, NULL, &text, textbuf, textlen); - BER_BVZERO( &vals[1] ); - attr_merge_normalize(e, slap_schema.si_ad_structuralObjectClass, vals, NULL ); + rc = structural_class(oc_at->a_vals, &val, NULL, &text, textbuf, textlen); + attr_merge_normalize_one(e, slap_schema.si_ad_structuralObjectClass, &val, NULL ); return 0; } diff --git a/servers/slapd/root_dse.c b/servers/slapd/root_dse.c index 057b9061e9..78c70e6d12 100644 --- a/servers/slapd/root_dse.c +++ b/servers/slapd/root_dse.c @@ -52,8 +52,8 @@ root_dse_info( const char **text ) { Entry *e; - struct berval vals[2], *bv; - struct berval nvals[2]; + struct berval val, *bv; + struct berval nval; int i, j; char ** supportedSASLMechanisms; BackendDB *be; @@ -79,9 +79,6 @@ root_dse_info( AttributeDescription *ad_ref = slap_schema.si_ad_ref; - vals[1].bv_val = NULL; - nvals[1].bv_val = NULL; - e = (Entry *) SLAP_CALLOC( 1, sizeof(Entry) ); if( e == NULL ) { @@ -102,18 +99,16 @@ root_dse_info( e->e_private = NULL; - vals[0].bv_val = "top"; - vals[0].bv_len = sizeof("top")-1; - if( attr_merge( e, ad_objectClass, vals, NULL ) ) { + BER_BVSTR( &val, "top" ); + if( attr_merge_one( e, ad_objectClass, &val, NULL ) ) { return LDAP_OTHER; } - vals[0].bv_val = "OpenLDAProotDSE"; - vals[0].bv_len = sizeof("OpenLDAProotDSE")-1; - if( attr_merge( e, ad_objectClass, vals, NULL ) ) { + BER_BVSTR( &val, "OpenLDAProotDSE" ); + if( attr_merge_one( e, ad_objectClass, &val, NULL ) ) { return LDAP_OTHER; } - if( attr_merge( e, ad_structuralObjectClass, vals, NULL ) ) { + if( attr_merge_one( e, ad_structuralObjectClass, &val, NULL ) ) { return LDAP_OTHER; } @@ -124,17 +119,19 @@ root_dse_info( continue; } if ( SLAP_MONITOR( be )) { - vals[0] = be->be_suffix[0]; - nvals[0] = be->be_nsuffix[0]; - if( attr_merge( e, ad_monitorContext, vals, nvals ) ) { + if( attr_merge_one( e, ad_monitorContext, + &be->be_suffix[0], + &be->be_nsuffix[0] ) ) + { return LDAP_OTHER; } continue; } if ( SLAP_CONFIG( be )) { - vals[0] = be->be_suffix[0]; - nvals[0] = be->be_nsuffix[0]; - if( attr_merge( e, ad_configContext, vals, nvals ) ) { + if( attr_merge_one( e, ad_configContext, + &be->be_suffix[0], + & be->be_nsuffix[0] ) ) + { return LDAP_OTHER; } continue; @@ -143,9 +140,10 @@ root_dse_info( continue; } for ( j = 0; be->be_suffix[j].bv_val != NULL; j++ ) { - vals[0] = be->be_suffix[j]; - nvals[0] = be->be_nsuffix[0]; - if( attr_merge( e, ad_namingContexts, vals, nvals ) ) { + if( attr_merge_one( e, ad_namingContexts, + &be->be_suffix[j], + &be->be_nsuffix[0] ) ) + { return LDAP_OTHER; } } @@ -166,8 +164,7 @@ root_dse_info( #ifdef LDAP_SLAPI /* netscape supportedExtension */ for ( i = 0; (bv = slapi_int_get_supported_extop(i)) != NULL; i++ ) { - vals[0] = *bv; - if( attr_merge( e, ad_supportedExtension, vals, NULL )) { + if( attr_merge_one( e, ad_supportedExtension, bv, NULL ) ) { return LDAP_OTHER; } } @@ -188,9 +185,9 @@ root_dse_info( continue; } snprintf(buf, sizeof buf, "%d", i); - vals[0].bv_val = buf; - vals[0].bv_len = strlen( vals[0].bv_val ); - if( attr_merge( e, ad_supportedLDAPVersion, vals, NULL ) ) { + val.bv_val = buf; + val.bv_len = strlen( val.bv_val ); + if( attr_merge( e, ad_supportedLDAPVersion, &val, NULL ) ) { return LDAP_OTHER; } } @@ -200,9 +197,9 @@ root_dse_info( if( supportedSASLMechanisms != NULL ) { for ( i=0; supportedSASLMechanisms[i] != NULL; i++ ) { - vals[0].bv_val = supportedSASLMechanisms[i]; - vals[0].bv_len = strlen( vals[0].bv_val ); - if( attr_merge( e, ad_supportedSASLMechanisms, vals, NULL ) ) { + val.bv_val = supportedSASLMechanisms[i]; + val.bv_len = strlen( val.bv_val ); + if( attr_merge( e, ad_supportedSASLMechanisms, &val, NULL ) ) { return LDAP_OTHER; } } diff --git a/servers/slapd/slapadd.c b/servers/slapd/slapadd.c index 6dcaae7f5b..7aa4ee2931 100644 --- a/servers/slapd/slapadd.c +++ b/servers/slapd/slapadd.c @@ -162,9 +162,9 @@ slapadd( int argc, char **argv ) } if( sc == NULL ) { - struct berval vals[2]; + struct berval val; - rc = structural_class( oc->a_vals, vals, + rc = structural_class( oc->a_vals, &val, NULL, &text, textbuf, textlen ); if( rc != LDAP_SUCCESS ) { @@ -176,11 +176,7 @@ slapadd( int argc, char **argv ) break; } - vals[1].bv_len = 0; - vals[1].bv_val = NULL; - - attr_merge( e, slap_schema.si_ad_structuralObjectClass, - vals, NULL /* FIXME */ ); + attr_merge_one( e, slap_schema.si_ad_structuralObjectClass, &val, NULL ); } /* check schema */ @@ -236,8 +232,7 @@ slapadd( int argc, char **argv ) { vals[0].bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ) ); vals[0].bv_val = uuidbuf; - attr_merge_normalize_one( e, - slap_schema.si_ad_entryUUID, vals, NULL ); + attr_merge_normalize_one( e, slap_schema.si_ad_entryUUID, vals, NULL ); } if( attr_find( e->e_attrs, slap_schema.si_ad_creatorsName )