ber_bvarray_add( &be->be_suffix, &pdn );
ber_bvarray_add( &be->be_nsuffix, &ndn );
- /* set database suffixAlias */
- } else if ( strcasecmp( cargv[0], "suffixAlias" ) == 0 ) {
- Backend *tmp_be;
- struct berval alias, palias, nalias;
- struct berval aliased, paliased, naliased;
-
- if ( cargc < 2 ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( CONFIG, CRIT,
- "%s: line %d: missing alias and aliased_dn in "
- "\"suffixAlias <alias> <aliased_dn>\" line.\n",
- fname, lineno, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: missing alias and aliased_dn in "
- "\"suffixAlias <alias> <aliased_dn>\" line.\n",
- fname, lineno, 0 );
-#endif
-
- return( 1 );
- } else if ( cargc < 3 ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( CONFIG, CRIT,
- "%s: line %d: missing aliased_dn in "
- "\"suffixAlias <alias> <aliased_dn>\" line\n",
- fname, lineno, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: missing aliased_dn in "
- "\"suffixAlias <alias> <aliased_dn>\" line\n",
- fname, lineno, 0 );
-#endif
- return( 1 );
-
- } else if ( cargc > 3 ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( CONFIG, CRIT,
- "%s: line %d: extra cruft in suffixAlias line (ignored)\n",
- fname, lineno, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: extra cruft in suffixAlias line (ignored)\n",
- fname, lineno, 0 );
-#endif
- }
-
- if ( be == NULL ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( CONFIG, INFO,
- "%s: line %d: suffix line must appear inside a database "
- "definition.\n", fname, lineno, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: suffixAlias line"
- " must appear inside a database definition.\n",
- fname, lineno, 0 );
-#endif
- return 1;
- }
-
- if ( load_ucdata( NULL ) < 0 ) return 1;
-
- alias.bv_val = cargv[1];
- alias.bv_len = strlen( cargv[1] );
-
- rc = dnPrettyNormal( NULL, &alias, &palias, &nalias );
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( CONFIG, CRIT,
- "%s: line %d: alias DN is invalid.\n", fname, lineno, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: alias DN is invalid\n",
- fname, lineno, 0 );
-#endif
- return( 1 );
- }
-
- tmp_be = select_backend( &nalias, 0, 0 );
- free( nalias.bv_val );
- if ( tmp_be && tmp_be != be ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( CONFIG, INFO,
- "%s: line %d: suffixAlias served by a preceeding "
- "backend \"%s\"\n", fname, lineno,
- tmp_be->be_suffix[0].bv_val );
-#else
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: suffixAlias served by"
- " a preceeding backend \"%s\"\n",
- fname, lineno, tmp_be->be_suffix[0].bv_val );
-#endif
- free( palias.bv_val );
- return -1;
- }
-
- aliased.bv_val = cargv[2];
- aliased.bv_len = strlen( cargv[2] );
-
- rc = dnPrettyNormal( NULL, &aliased, &paliased, &naliased );
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( CONFIG, CRIT,
- "%s: line %d: aliased DN is invalid.\n", fname, lineno,0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: aliased DN is invalid\n",
- fname, lineno, 0 );
-#endif
- free( palias.bv_val );
- return( 1 );
- }
-
- tmp_be = select_backend( &naliased, 0, 0 );
- free( naliased.bv_val );
- if ( tmp_be && tmp_be != be ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( CONFIG, INFO,
- "%s: line %d: suffixAlias derefs to a different backend "
- "a preceeding backend \"%s\"\n",
- fname, lineno, tmp_be->be_suffix[0].bv_val );
-#else
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: suffixAlias derefs to differnet backend"
- " a preceeding backend \"%s\"\n",
- fname, lineno, tmp_be->be_suffix[0].bv_val );
-#endif
- free( palias.bv_val );
- free( paliased.bv_val );
- return -1;
- }
-
- ber_bvarray_add( &be->be_suffixAlias, &palias );
- ber_bvarray_add( &be->be_suffixAlias, &paliased );
-
/* set max deref depth */
} else if ( strcasecmp( cargv[0], "maxDerefDepth" ) == 0 ) {
int i;