#include "slap.h"
#include "../back-ldap/back-ldap.h"
+#undef ldap_debug /* silence a warning in ldap-int.h */
#include "../../../libraries/libldap/ldap-int.h"
#include "back-meta.h"
/*
* uri MUST be legal!
*/
- if ( ldap_url_parselist( &ludp, argv[ 1 ] ) != LDAP_SUCCESS ) {
+ if ( ldap_url_parselist_ext( &ludp, argv[ 1 ], "\t" ) != LDAP_SUCCESS ) {
fprintf( stderr,
"%s: line %d: unable to parse URI"
" in \"uri <protocol>://<server>[:port]/<naming context>\" line\n",
}
ber_str2bv( argv[ 1 ], 0L, 1, &li->targets[ i ]->bindpw );
+ /* save bind creds for referral rebinds? */
+ } else if ( strcasecmp( argv[0], "rebind-as-user" ) == 0 ) {
+ if (argc != 1) {
+ fprintf( stderr,
+ "%s: line %d: rebind-as-user takes no arguments\n",
+ fname, lineno );
+ return( 1 );
+ }
+ li->savecred = 1;
+
/* name to use as pseudo-root dn */
} else if ( strcasecmp( argv[ 0 ], "pseudorootdn" ) == 0 ) {
int i = li->ntargets-1;
int i = li->ntargets-1;
if ( i < 0 ) {
+#ifndef LDAP_CACHING
fprintf( stderr,
"%s: line %d: need \"uri\" directive first\n",
fname, lineno );
+#else /* LDAP_CACHING */
+ if ( strcasecmp( argv[0], "rewriteEngine" ) == 0 ) {
+ li->rwinfo = rewrite_info_init( REWRITE_MODE_USE_DEFAULT );
+ }
+ return rewrite_parse(li->rwinfo, fname, lineno,
+ argc, argv);
+#endif /* LDAP_CACHING */
}
return rewrite_parse( li->targets[ i ]->rwinfo, fname, lineno,
/* objectclass/attribute mapping */
} else if ( strcasecmp( argv[ 0 ], "map" ) == 0 ) {
- struct ldapmap *map;
- struct ldapmapping *mapping;
- char *src, *dst;
int i = li->ntargets-1;
- if ( i < 0 ) {
- fprintf( stderr,
- "%s: line %d: need \"uri\" directive first\n",
- fname, lineno );
- }
-
-
- if ( argc < 3 || argc > 4 ) {
- fprintf( stderr,
- "%s: line %d: syntax is \"map {objectclass | attribute} [<local> | *] {<foreign> | *}\"\n",
- fname, lineno );
- return 1;
- }
-
- if ( strcasecmp( argv[ 1 ], "objectClass" ) == 0 ) {
- map = &li->targets[ i ]->oc_map;
- } else if ( strcasecmp( argv[ 1 ], "attribute" ) == 0 ) {
- map = &li->targets[ i ]->at_map;
- } else {
- fprintf( stderr,
- "%s: line %d: syntax is \"map {objectclass | attribute} [<local> | *] {<foreign> | *}\"\n",
- fname, lineno );
- return 1;
- }
-
- if ( strcmp( argv[ 2 ], "*" ) == 0 ) {
- if ( argc < 4 || strcmp( argv[ 3 ], "*" ) == 0 ) {
- map->drop_missing = ( argc < 4 );
- return 0;
- }
- src = dst = argv[ 3 ];
- } else if ( argc < 4 ) {
- src = "";
- dst = argv[ 2 ];
- } else {
- src = argv[ 2 ];
- dst = ( strcmp( argv[ 3 ], "*" ) == 0 ? src : argv[ 3 ] );
- }
-
- if ( ( map == &li->targets[ i ]->at_map )
- && ( strcasecmp( src, "objectclass" ) == 0
- || strcasecmp( dst, "objectclass" ) == 0 ) ) {
- fprintf( stderr,
- "%s: line %d: objectclass attribute cannot be mapped\n",
- fname, lineno );
- }
-
- mapping = ch_calloc( 2, sizeof( struct ldapmapping ) );
- if ( mapping == NULL ) {
- fprintf( stderr,
- "%s: line %d: out of memory\n",
- fname, lineno );
- return 1;
- }
- ber_str2bv( src, 0, 1, &mapping->src );
- ber_str2bv( dst, 0, 1, &mapping->dst );
- mapping[ 1 ].src = mapping->dst;
- mapping[ 1 ].dst = mapping->src;
-
- if ( (*src != '\0' &&
- avl_find( map->map, ( caddr_t )mapping,
- mapping_cmp ) != NULL)
- || avl_find( map->remap, ( caddr_t )&mapping[ 1 ],
- mapping_cmp ) != NULL) {
- fprintf( stderr,
- "%s: line %d: duplicate mapping found (ignored)\n",
- fname, lineno );
+ return ldap_back_map_config( &li->targets[ i ]->oc_map,
+ &li->targets[ i ]->at_map,
+ fname, lineno, argc, argv );
+ /* anything else */
+ } else {
+#ifdef LDAP_CACHING
+ if ( meta_back_cache_config( be, fname, lineno, argc, argv ) == 0 ) {
return 0;
}
+#endif /* LDAP_CACHING */
- if ( *src != '\0' )
- avl_insert( &map->map, ( caddr_t )mapping,
- mapping_cmp, mapping_dup );
- avl_insert( &map->remap, ( caddr_t )&mapping[ 1 ],
- mapping_cmp, mapping_dup );
-
- /* anything else */
- } else {
fprintf( stderr,
"%s: line %d: unknown directive \"%s\" in meta database definition"
" (ignored)\n",