/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1999-2006 The OpenLDAP Foundation.
+ * Copyright 1999-2008 The OpenLDAP Foundation.
* Portions Copyright 1999-2003 Howard Chu.
* Portions Copyright 2000-2003 Pierangelo Masarati.
* All rights reserved.
struct ldapmapping *mapping;
char *src, *dst;
int is_oc = 0;
+ int rc = 0;
if ( argc < 3 || argc > 4 ) {
fprintf( stderr,
return 1;
}
+ if ( !is_oc && map->map == NULL ) {
+ /* only init if required */
+ if ( rwm_map_init( map, &mapping ) != LDAP_SUCCESS ) {
+ return 1;
+ }
+ }
+
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];
fname, lineno, dst );
goto error_return;
}
-
-#if 0
- mapping[0].m_dst_oc = ch_malloc( sizeof( ObjectClass ) );
- memset( mapping[0].m_dst_oc, 0, sizeof( ObjectClass ) );
- mapping[0].m_dst_oc->soc_cname = mapping[0].m_dst;
- mapping[0].m_flags |= RWMMAP_F_FREE_DST;
-#endif
}
mapping[1].m_src_oc = mapping[0].m_dst_oc;
|| avl_find( map->remap, (caddr_t)&mapping[1], rwm_mapping_cmp ) != NULL)
{
fprintf( stderr,
- "%s: line %d: duplicate mapping found" SLAPD_CONF_UNKNOWN_IGNORED ".\n",
+ "%s: line %d: duplicate mapping found.\n",
fname, lineno );
/* FIXME: free stuff */
goto error_return;
avl_insert( &map->remap, (caddr_t)&mapping[1],
rwm_mapping_cmp, rwm_mapping_dup );
- return 0;
+success_return:;
+ return rc;
error_return:;
if ( mapping ) {
return 1;
}
-#ifdef ENABLE_REWRITE
static char *
rwm_suffix_massage_regexize( const char *s )
{
return 0;
}
-#endif /* ENABLE_REWRITE */
#endif /* SLAPD_OVER_RWM */