continue;
}
- ldap_back_map(&li->at_map, &a->a_desc->ad_cname, &mapped, 0);
+ ldap_back_map(&li->at_map, &a->a_desc->ad_cname, &mapped,
+ BACKLDAP_MAP);
if (mapped.bv_val == NULL) {
continue;
}
}
}
- ldap_back_map(&li->at_map, &entry_at->ad_cname, &mapped, 0);
+ ldap_back_map(&li->at_map, &entry_at->ad_cname, &mapped, BACKLDAP_MAP);
if (mapped.bv_val == NULL) {
return 1;
}
else
j++;
} else {
- ldap_back_map(&li->oc_map, &v[j], &mapped, 1);
+ ldap_back_map(&li->oc_map, &v[j], &mapped,
+ BACKLDAP_REMAP);
if (mapped.bv_val) {
ber_dupbv( &v[j], &mapped );
if (v[j].bv_val)
void ldap_back_map_init ( struct ldapmap *lm, struct ldapmapping ** );
void ldap_back_map ( struct ldapmap *map, struct berval *s, struct berval *m,
int remap );
+#define BACKLDAP_MAP 0
+#define BACKLDAP_REMAP 1
char *
ldap_back_map_filter(
struct ldapmap *at_map,
LDAP_END_DECL
-#endif
+#endif /* SLAPD_LDAP_H */
}
#endif /* !ENABLE_REWRITE */
- ldap_back_map(&li->oc_map, &ava->aa_desc->ad_cname, &mapped_oc, 0);
- if (mapped_oc.bv_val == NULL)
- return( -1 );
-
- ldap_back_map(&li->at_map, &ava->aa_value, &mapped_at, 0);
- if (mapped_at.bv_val == NULL)
- return( -1 );
+ if ( ava->aa_desc->ad_type->sat_oid
+ == slap_schema.si_ad_objectClass->ad_type->sat_oid ) {
+ ldap_back_map(&li->oc_map, &ava->aa_desc->ad_cname, &mapped_oc,
+ BACKLDAP_MAP);
+ if (mapped_oc.bv_val == NULL || mapped_oc.bv_val[0] == '\0') {
+ return( -1 );
+ }
+
+ } else {
+ ldap_back_map(&li->at_map, &ava->aa_value, &mapped_at,
+ BACKLDAP_MAP);
+ if (mapped_at.bv_val == NULL || mapped_at.bv_val[0] == '\0') {
+ return( -1 );
+ }
+ }
ldap_compare_s( lc->ld, mdn.bv_val, mapped_oc.bv_val, mapped_at.bv_val );
}
#endif /* !ENABLE_REWRITE */
- ldap_back_map(&li->oc_map, &group_oc_name, &group_oc_name, 0);
+ ldap_back_map(&li->oc_map, &group_oc_name, &group_oc_name,
+ BACKLDAP_MAP);
if (group_oc_name.bv_val == NULL)
goto cleanup;
- ldap_back_map(&li->at_map, &group_at_name, &group_at_name, 0);
+ ldap_back_map(&li->at_map, &group_at_name, &group_at_name,
+ BACKLDAP_MAP);
if (group_at_name.bv_val == NULL)
goto cleanup;
Avlnode *tree;
struct ldapmapping *mapping, fmapping;
- if (remap)
+ if (remap == BACKLDAP_REMAP)
tree = map->remap;
else
tree = map->map;
continue;
}
- ldap_back_map(&li->at_map, &ml->sml_desc->ad_cname, &mapped, 0);
+ ldap_back_map(&li->at_map, &ml->sml_desc->ad_cname, &mapped,
+ BACKLDAP_MAP);
if (mapped.bv_val == NULL) {
continue;
}
#else /* !ENABLE_REWRITE */
filterstr,
#endif /* !ENABLE_REWRITE */
- 0);
+ BACKLDAP_MAP);
if ( mapped_filter == NULL ) {
#ifdef ENABLE_REWRITE
mapped_filter = mfilter.bv_val;
}
#endif /* ENABLE_REWRITE */
- mapped_attrs = ldap_back_map_attrs(&li->at_map, attrs, 0);
+ mapped_attrs = ldap_back_map_attrs(&li->at_map, attrs, BACKLDAP_MAP);
if ( mapped_attrs == NULL && attrs) {
for (count=0; attrs[count].an_name.bv_val; count++);
mapped_attrs = ch_malloc( (count+1) * sizeof(char *));
attrp = &ent.e_attrs;
while ( ber_scanf( &ber, "{m", &a ) != LBER_ERROR ) {
- ldap_back_map(&li->at_map, &a, &mapped, 1);
+ ldap_back_map(&li->at_map, &a, &mapped, BACKLDAP_REMAP);
if (mapped.bv_val == NULL || mapped.bv_val[0] == '\0')
continue;
attr = (Attribute *)ch_malloc( sizeof(Attribute) );
for ( last = 0; attr->a_vals[last].bv_val; last++ ) ;
for ( i = 0, bv = attr->a_vals; bv->bv_val; bv++, i++ ) {
- ldap_back_map(&li->oc_map, bv, &mapped, 1);
+ ldap_back_map(&li->oc_map, bv, &mapped,
+ BACKLDAP_REMAP);
if (mapped.bv_val == NULL || mapped.bv_val[0] == '\0') {
LBER_FREE(bv->bv_val);
bv->bv_val = NULL;
}
ldap_back_map( &li->targets[ candidate ]->at_map,
- &a->a_desc->ad_cname, &mapped, 0);
+ &a->a_desc->ad_cname, &mapped, BACKLDAP_MAP );
if ( mapped.bv_val == NULL ) {
continue;
}
}
ldap_back_map( &li->targets[ candidate ]->at_map,
- &entry_at->ad_cname, &mapped, 0 );
+ &entry_at->ad_cname, &mapped, BACKLDAP_MAP );
if ( mapped.bv_val == NULL )
return 1;
j++;
}
} else {
- ldap_back_map( &li->targets[ candidate ]->oc_map, &v[ j ], &mapped, 1 );
+ ldap_back_map( &li->targets[ candidate ]->oc_map, &v[ j ], &mapped, BACKLDAP_REMAP );
if ( mapped.bv_val ) {
ber_dupbv( &v[ j ], &mapped );
if ( v[ j ].bv_val ) {
if ( ava->aa_desc->ad_type->sat_oid
== slap_schema.si_ad_objectClass->ad_type->sat_oid ) {
ldap_back_map( &li->targets[ i ]->oc_map,
- &ava->aa_value, &mapped_value, 0 );
+ &ava->aa_value, &mapped_value,
+ BACKLDAP_MAP );
- if ( mapped_value.bv_val == NULL ) {
+ if ( mapped_value.bv_val == NULL || mapped_value.bv_val[0] == '\0' ) {
continue;
}
/*
*/
} else {
ldap_back_map( &li->targets[ i ]->at_map,
- &ava->aa_desc->ad_cname, &mapped_attr, 0 );
- if ( mapped_attr.bv_val == NULL ) {
+ &ava->aa_desc->ad_cname, &mapped_attr,
+ BACKLDAP_MAP );
+ if ( mapped_attr.bv_val == NULL || mapped_attr.bv_val[0] == '\0' ) {
continue;
}
}
}
ldap_back_map( &li->targets[ candidate ]->oc_map,
- &group_oc_name, &group_oc_name, 0 );
+ &group_oc_name, &group_oc_name, BACKLDAP_MAP );
if ( group_oc_name.bv_val == NULL ) {
goto cleanup;
}
ldap_back_map( &li->targets[ candidate ]->at_map,
- &group_at_name, &group_at_name, 0 );
+ &group_at_name, &group_at_name, BACKLDAP_MAP );
if ( group_at_name.bv_val == NULL ) {
goto cleanup;
}
}
ldap_back_map( &li->targets[ candidate ]->at_map,
- &ml->sml_desc->ad_cname, &mapped, 0 );
+ &ml->sml_desc->ad_cname, &mapped,
+ BACKLDAP_MAP );
if ( mapped.bv_val == NULL ) {
continue;
}
* Maps attributes in filter
*/
mapped_filter = ldap_back_map_filter( &li->targets[ i ]->at_map,
- &li->targets[ i ]->oc_map, &mfilter, 0 );
+ &li->targets[ i ]->oc_map, &mfilter,
+ BACKLDAP_MAP );
if ( mapped_filter == NULL ) {
mapped_filter = ( char * )mfilter.bv_val;
} else {
* Maps required attributes
*/
mapped_attrs = ldap_back_map_attrs( &li->targets[ i ]->at_map,
- attrs, 0 );
+ attrs, BACKLDAP_MAP );
if ( mapped_attrs == NULL && attrs) {
for ( count=0; attrs[ count ].an_name.bv_val; count++ );
mapped_attrs = ch_malloc( ( count + 1 ) * sizeof(char *));
while ( ber_scanf( &ber, "{m", &a ) != LBER_ERROR ) {
ldap_back_map( &li->targets[ target ]->at_map,
- &a, &mapped, 1 );
+ &a, &mapped, BACKLDAP_REMAP );
if ( mapped.bv_val == NULL || mapped.bv_val[0] == '\0' ) {
continue;
}
for ( last = 0; attr->a_vals[ last ].bv_val; ++last );
for ( i = 0, bv = attr->a_vals; bv->bv_val; bv++, i++ ) {
ldap_back_map( &li->targets[ target]->oc_map,
- bv, &mapped, 1 );
+ bv, &mapped, BACKLDAP_REMAP );
if ( mapped.bv_val == NULL || mapped.bv_val[0] == '\0') {
free( bv->bv_val );
bv->bv_val = NULL;