mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-31 12:09:35 -05:00
shortcut schema mapping if not configured
This commit is contained in:
parent
3284f54ec0
commit
bce4063a17
3 changed files with 16 additions and 10 deletions
|
|
@ -1643,7 +1643,6 @@ rwm_db_init(
|
|||
BackendDB *be )
|
||||
{
|
||||
slap_overinst *on = (slap_overinst *) be->bd_info;
|
||||
struct ldapmapping *mapping = NULL;
|
||||
struct ldaprwmap *rwmap;
|
||||
#ifdef ENABLE_REWRITE
|
||||
char *rargv[ 3 ];
|
||||
|
|
@ -1672,13 +1671,6 @@ rwm_db_init(
|
|||
rewrite_parse( rwmap->rwm_rw, "<suffix massage>", 2, 2, rargv );
|
||||
#endif /* ENABLE_REWRITE */
|
||||
|
||||
if ( rwm_map_init( &rwmap->rwm_oc, &mapping ) != LDAP_SUCCESS ||
|
||||
rwm_map_init( &rwmap->rwm_at, &mapping ) != LDAP_SUCCESS )
|
||||
{
|
||||
rc = 1;
|
||||
goto error_return;
|
||||
}
|
||||
|
||||
error_return:;
|
||||
on->on_bi.bi_private = (void *)rwmap;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ rwm_map_config(
|
|||
struct ldapmapping *mapping;
|
||||
char *src, *dst;
|
||||
int is_oc = 0;
|
||||
int rc = 0;
|
||||
|
||||
if ( argc < 3 || argc > 4 ) {
|
||||
fprintf( stderr,
|
||||
|
|
@ -73,7 +74,7 @@ rwm_map_config(
|
|||
if ( strcmp( argv[2], "*" ) == 0 ) {
|
||||
if ( argc < 4 || strcmp( argv[3], "*" ) == 0 ) {
|
||||
map->drop_missing = ( argc < 4 );
|
||||
return 0;
|
||||
goto success_return;
|
||||
}
|
||||
src = dst = argv[3];
|
||||
|
||||
|
|
@ -230,7 +231,13 @@ rwm_map_config(
|
|||
avl_insert( &map->remap, (caddr_t)&mapping[1],
|
||||
rwm_mapping_cmp, rwm_mapping_dup );
|
||||
|
||||
return 0;
|
||||
success_return:;
|
||||
if ( !is_oc && map->map == NULL ) {
|
||||
/* only init if required */
|
||||
rc = rwm_map_init( map, &mapping ) != LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
||||
error_return:;
|
||||
if ( mapping ) {
|
||||
|
|
|
|||
|
|
@ -142,6 +142,13 @@ rwm_map( struct ldapmap *map, struct berval *s, struct berval *bv, int remap )
|
|||
{
|
||||
struct ldapmapping *mapping;
|
||||
|
||||
/* map->map may be NULL when mapping is configured,
|
||||
* but map->remap can't */
|
||||
if ( map->remap == NULL ) {
|
||||
*bv = *s;
|
||||
return;
|
||||
}
|
||||
|
||||
BER_BVZERO( bv );
|
||||
( void )rwm_mapping( map, s, &mapping, remap );
|
||||
if ( mapping != NULL ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue