int mapping_cmp (const void *, const void *);
int mapping_dup (void *, void *);
+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 );
char *
return( ( strcasecmp(map1->src.bv_val, map2->src.bv_val) == 0 ) ? -1 : 0 );
}
+void
+ldap_back_map_init ( struct ldapmap *lm, struct ldapmapping **m )
+{
+ struct ldapmapping *mapping;
+
+ assert( m );
+
+ *m = NULL;
+
+ mapping = (struct ldapmapping *)ch_calloc( 2,
+ sizeof( struct ldapmapping ) );
+ if ( mapping == NULL ) {
+ return;
+ }
+
+ ber_str2bv( "objectclass", sizeof("objectclass")-1, 1, &mapping->src);
+ ber_dupbv( &mapping->dst, &mapping->src );
+ mapping[1].src = mapping->src;
+ mapping[1].dst = mapping->dst;
+
+ avl_insert( &lm->map, (caddr_t)mapping,
+ mapping_cmp, mapping_dup );
+ avl_insert( &lm->remap, (caddr_t)&mapping[1],
+ mapping_cmp, mapping_dup );
+ *m = mapping;
+}
+
void
ldap_back_map ( struct ldapmap *map, struct berval *s, struct berval *bv,
int remap )
ldap_pvt_thread_mutex_init( &li->conn_mutex );
- mapping = (struct ldapmapping *)ch_calloc( 2, sizeof(struct ldapmapping) );
- if ( mapping != NULL ) {
- ber_str2bv( "objectclass", sizeof("objectclass")-1, 1, &mapping->src);
- ber_dupbv( &mapping->dst, &mapping->src );
- mapping[1].src = mapping->src;
- mapping[1].dst = mapping->dst;
-
- avl_insert( &li->at_map.map, (caddr_t)mapping,
- mapping_cmp, mapping_dup );
- avl_insert( &li->at_map.remap, (caddr_t)&mapping[1],
- mapping_cmp, mapping_dup );
- }
+ ldap_back_map_init( &li->at_map, &mapping );
be->be_private = li;
return NULL;
}
- mapping = ch_calloc( 2, sizeof( struct ldapmapping ) );
- if ( mapping == NULL ) {
- free( lt );
- return NULL;
- }
- ber_str2bv( "objectClass", 0, 1, &mapping->src );
- ber_str2bv( "objectClass", 0, 1, &mapping->dst );
- mapping[ 1 ].src = mapping->src;
- mapping[ 1 ].dst = mapping->dst;
-
- avl_insert( <->at_map.map, ( caddr_t )mapping,
- mapping_cmp, mapping_dup );
- avl_insert( <->at_map.remap, ( caddr_t )&mapping[ 1 ],
- mapping_cmp, mapping_dup );
+ ldap_back_map_init( <->at_map, &mapping );
return lt;
}
ldap_free_urldesc( ludp );
+#if 0
fprintf(stderr, "%s: line %d: URI \"%s\", suffix \"%s\"\n",
fname, lineno, li->targets[ i ]->uri,
li->targets[ i ]->psuffix.bv_val );
+#endif
/* default target directive */
} else if ( strcasecmp( argv[ 0 ], "default-target" ) == 0 ) {