#ifdef ENABLE_REWRITE
struct rewrite_info *rwinfo;
#else /* !ENABLE_REWRITE */
- struct berval **suffix_massage;
+ BerVarray suffix_massage;
#endif /* !ENABLE_REWRITE */
struct ldapmap oc_map;
BackendDB *tmp_be;
struct berval bvnc, *nvnc = NULL, *pvnc = NULL,
brnc, *nrnc = NULL, *prnc = NULL;
+#ifdef ENABLE_REWRITE
int rc;
+#endif /* ENABLE_REWRITE */
/*
* syntax:
return( rc );
#else /* !ENABLE_REWRITE */
- ber_bvecadd( &li->suffix_massage, pvnc );
- ber_bvecadd( &li->suffix_massage, nvnc );
+ ber_bvarray_add( &li->suffix_massage, pvnc );
+ ber_bvarray_add( &li->suffix_massage, nvnc );
- ber_bvecadd( &li->suffix_massage, prnc );
- ber_bvecadd( &li->suffix_massage, nrnc );
+ ber_bvarray_add( &li->suffix_massage, prnc );
+ ber_bvarray_add( &li->suffix_massage, nrnc );
#endif /* !ENABLE_REWRITE */
/* rewrite stuff ... */
}
#else /* !ENABLE_REWRITE */
if (li->suffix_massage) {
- ber_bvecfree( li->suffix_massage );
+ ber_bvarray_free( li->suffix_massage );
}
#endif /* !ENABLE_REWRITE */
* It is necessary to try to rewrite attributes with
* dn syntax because they might be used in ACLs as
* members of groups; since ACLs are applied to the
- * rewritten stuff, no dn-based subecj clause could
+ * rewritten stuff, no dn-based subject clause could
* be used at the ldap backend side (see
* http://www.OpenLDAP.org/faq/data/cache/452.html)
* The problem can be overcome by moving the dn-based
* ACLs to the target directory server, and letting
* everything pass thru the ldap backend.
*/
+ /* FIXME: #ifndef ENABLE_REWRITE should we massage these? */
} else if ( strcmp( attr->a_desc->ad_type->sat_syntax->ssyn_oid,
SLAPD_DN_SYNTAX ) == 0 ) {
int i;
for ( i = 0, bv = attr->a_vals; bv->bv_val; bv++, i++ ) {
- char *newval;
+ char *newval = NULL;
switch ( rewrite_session( li->rwinfo,
"searchResult",
bv->bv_val, newval );
#endif /* !NEW_LOGGING */
free( bv->bv_val );
- bv->bv_val = newval;
- bv->bv_len = strlen( newval );
-
+ ber_str2bv( newval, 0, 0, bv );
break;
case REWRITE_REGEXEC_UNWILLING:
ch_free(attr);
}
- if ( ent.e_dn && ent.e_dn != bdn.bv_val )
+ if ( ent.e_dn && ( ent.e_dn != bdn.bv_val ) )
free( ent.e_dn );
if ( ent.e_ndn )
free( ent.e_ndn );
}
for ( i = 0;
- li->suffix_massage[i] != NULL;
+ li->suffix_massage[i].bv_val != NULL;
i += 4 ) {
- int aliasLength = li->suffix_massage[i+src]->bv_len;
+ int aliasLength = li->suffix_massage[i+src].bv_len;
int diff = dn->bv_len - aliasLength;
if ( diff < 0 ) {
/* XXX or an escaped separator... oh well */
}
- if ( !strcmp( li->suffix_massage[i+src]->bv_val, &dn->bv_val[diff] ) ) {
- res->bv_len = diff + li->suffix_massage[i+dst]->bv_len;
+ if ( !strcmp( li->suffix_massage[i+src].bv_val, &dn->bv_val[diff] ) ) {
+ res->bv_len = diff + li->suffix_massage[i+dst].bv_len;
res->bv_val = ch_malloc( res->bv_len + 1 );
strncpy( res->bv_val, dn->bv_val, diff );
- strcpy( &res->bv_val[diff], li->suffix_massage[i+dst]->bv_val );
+ strcpy( &res->bv_val[diff], li->suffix_massage[i+dst].bv_val );
#ifdef NEW_LOGGING
LDAP_LOG (( "suffixmassage", LDAP_LEVEL_ARGS,
"ldap_back_dn_massage: converted \"%s\" to \"%s\"\n",