/* config.c - relay backend configuration file routine */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2003-2004 The OpenLDAP Foundation.
+ * Copyright 2004-2005 The OpenLDAP Foundation.
* Portions Copyright 2004 Pierangelo Masarati.
* All rights reserved.
*
int
relay_back_db_config(
- BackendDB *be,
- const char *fname,
- int lineno,
- int argc,
- char **argv
+ BackendDB *be,
+ const char *fname,
+ int lineno,
+ int argc,
+ char **argv
)
{
relay_back_info *ri = (struct relay_back_info *)be->be_private;
rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn, NULL );
if ( rc != LDAP_SUCCESS ) {
fprintf( stderr, "%s: line %d: "
- "relay dn \"%s\" is invalid\n",
+ "relay dn \"%s\" is invalid "
+ "in \"relay <dn> [massage]\" line\n",
fname, lineno, argv[ 1 ] );
return 1;
}
if ( bd == NULL ) {
fprintf( stderr, "%s: line %d: "
"cannot find database "
- "of relay dn \"%s\"\n",
+ "of relay dn \"%s\" "
+ "in \"relay <dn> [massage]\" line\n",
fname, lineno, argv[ 1 ] );
return 1;
} else if ( bd == be ) {
fprintf( stderr, "%s: line %d: "
- "relay dn \"%s\" would call self\n",
+ "relay dn \"%s\" would call self "
+ "in \"relay <dn> [massage]\" line\n",
fname, lineno, pdn.bv_val );
return 1;
}
ri->ri_realsuffix = ndn;
- if ( overlay_config( be, "rewrite-remap" ) ) {
+ if ( overlay_config( be, "rwm" ) ) {
fprintf( stderr, "%s: line %d: unable to install "
- "rewrite-remap overlay "
- "in back-relay\n",
+ "rwm overlay "
+ "in \"relay <dn> [massage]\" line\n",
fname, lineno );
return 1;
}
-#if 0
- {
+ if ( argc == 3 ) {
char *cargv[ 4 ];
- cargv[ 0 ] = "overlay";
- cargv[ 1 ] = "rewrite-remap";
- cargv[ 2 ] = NULL;
-
- be->be_config( be, fname, lineno, 2, cargv );
+ if ( strcmp( argv[2], "massage" ) != 0 ) {
+ fprintf( stderr, "%s: line %d: "
+ "unknown directive \"%s\" "
+ "in \"relay <dn> [massage]\" line\n",
+ fname, lineno, argv[2] );
+ return 1;
+ }
- cargv[ 0 ] = "suffixmassage";
+ cargv[ 0 ] = "rwm-suffixmassage";
cargv[ 1 ] = be->be_suffix[0].bv_val;
- cargv[ 2 ] = ri->ri_bd->be_suffix[0].bv_val;
+ cargv[ 2 ] = pdn.bv_val;
cargv[ 3 ] = NULL;
if ( be->be_config( be, fname, lineno, 3, cargv ) ) {
}
}
- if ( argc == 3 ) {
- if ( strcmp( argv[2], "massage" ) ) {
- fprintf( stderr, "%s: line %d: "
- "unknown directive \"%s\" "
- "in \"relay <dn> [massage]\" line\n",
- fname, lineno, argv[2] );
- return 1;
- }
-
- ri->ri_massage = 1;
- }
-#endif
+ ch_free( pdn.bv_val );
/* anything else */
} else {