X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Foverlays%2Frwmconf.c;h=32212d6c6dda5af33f082e3aba9705efd98f4883;hb=a4d2c63a61fca123d7f54aa84c79ba4b496242a9;hp=be1e7f870ed77d521aa2faec0995fd1b2b7dab2e;hpb=52a49e0840d759efbd2d2ce0acedacbfc9351fb7;p=openldap
diff --git a/servers/slapd/overlays/rwmconf.c b/servers/slapd/overlays/rwmconf.c
index be1e7f870e..32212d6c6d 100644
--- a/servers/slapd/overlays/rwmconf.c
+++ b/servers/slapd/overlays/rwmconf.c
@@ -2,7 +2,7 @@
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software .
*
- * Copyright 1999-2004 The OpenLDAP Foundation.
+ * Copyright 1999-2005 The OpenLDAP Foundation.
* Portions Copyright 1999-2003 Howard Chu.
* Portions Copyright 2000-2003 Pierangelo Masarati.
* All rights reserved.
@@ -142,10 +142,19 @@ rwm_map_config(
"is not defined in schema\n",
fname, lineno, dst );
+ mapping[0].m_dst_oc = oc_bvfind_undef( &mapping[0].m_dst );
+ if ( mapping[0].m_dst_oc == NULL ) {
+ fprintf( stderr, "%s: line %d: unable to mimic destination objectClass '%s'\n",
+ fname, lineno, dst );
+ return 1;
+ }
+
+#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;
@@ -208,7 +217,7 @@ rwm_map_config(
|| avl_find( map->remap, (caddr_t)&mapping[1], rwm_mapping_cmp ) != NULL)
{
fprintf( stderr,
- "%s: line %d: duplicate mapping found (ignored)\n",
+ "%s: line %d: duplicate mapping found" SLAPD_CONF_UNKNOWN_IGNORED ".\n",
fname, lineno );
/* FIXME: free stuff */
goto error_return;
@@ -244,9 +253,12 @@ rwm_suffix_massage_regexize( const char *s )
p = r + 1, i++ )
;
- res = ch_calloc( sizeof( char ), strlen( s ) + 4 + 4*i + 1 );
+ res = ch_calloc( sizeof( char ), strlen( s )
+ + STRLENOF( "((.+),)?" )
+ + STRLENOF( "[ ]?" ) * i
+ + STRLENOF( "$" ) + 1 );
- ptr = lutil_strcopy( res, "(.*)" );
+ ptr = lutil_strcopy( res, "((.+),)?" );
for ( i = 0, p = s;
( r = strchr( p, ',' ) ) != NULL;
p = r + 1 , i++ ) {
@@ -257,7 +269,9 @@ rwm_suffix_massage_regexize( const char *s )
r++;
}
}
- lutil_strcopy( ptr, p );
+ ptr = lutil_strcopy( ptr, p );
+ ptr[0] = '$';
+ ptr[1] = '\0';
return res;
}
@@ -333,6 +347,26 @@ rwm_suffix_massage_config(
rargv[ 4 ] = NULL;
rewrite_parse( info, "", ++line, 4, rargv );
+#ifdef RWM_REFERRAL_REWRITE
+ /* FIXME: we don't want this on by default, do we? */
+ rargv[ 0 ] = "rewriteContext";
+ rargv[ 1 ] = "referralDN";
+ rargv[ 2 ] = "alias";
+ rargv[ 3 ] = "searchEntryDN";
+ rargv[ 4 ] = NULL;
+ rewrite_parse( info, "", ++line, 4, rargv );
+#else /* ! RWM_REFERRAL_REWRITE */
+ rargv[ 0 ] = "rewriteContext";
+ rargv[ 1 ] = "referralAttrDN";
+ rargv[ 2 ] = NULL;
+ rewrite_parse( info, "", ++line, 2, rargv );
+
+ rargv[ 0 ] = "rewriteContext";
+ rargv[ 1 ] = "referralDN";
+ rargv[ 2 ] = NULL;
+ rewrite_parse( info, "", ++line, 2, rargv );
+#endif /* ! RWM_REFERRAL_REWRITE */
+
rargv[ 0 ] = "rewriteContext";
rargv[ 1 ] = "searchAttrDN";
rargv[ 2 ] = "alias";