X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fconfig.c;h=715dd8baee819d9ca587df288b4edce6787e9c92;hb=9b09d42a1db573f6249bccdf4aaaa361394400b9;hp=66050586ab794ac4f4e258306e58de0e293206ac;hpb=42e0d83cb3a1a1c5b25183f1ab74ce7edbe25de7;p=openldap diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 66050586ab..715dd8baee 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -1,19 +1,18 @@ /* config.c - configuration file handling routines */ +#include "portable.h" + #include -#include -#include -#include -#include "slap.h" + +#include +#include +#include + #include "ldapconfig.h" +#include "slap.h" #define MAXARGS 100 -extern Backend *new_backend(); -extern char *default_referral; -extern int ldap_syslog; -extern int global_schemacheck; - /* * defaults for various global variables */ @@ -25,11 +24,11 @@ char *replogfile; int global_lastmod; char *ldap_srvtab = ""; -static char *fp_getline(); -static void fp_getline_init(); -static void fp_parse_line(); +static char *fp_getline(FILE *fp, int *lineno); +static void fp_getline_init(int *lineno); +static void fp_parse_line(char *line, int *argcp, char **argv); -static char *strtok_quote(); +static char *strtok_quote(char *line, char *sep); void read_config( char *fname, Backend **bep, FILE *pfp ) @@ -81,6 +80,9 @@ read_config( char *fname, Backend **bep, FILE *pfp ) *bep = new_backend( cargv[1] ); be = *bep; + /* assign a default depth limit for alias deref */ + be->be_maxDerefDepth = SLAPD_DEFAULT_MAXDEREFDEPTH; + /* set size limit */ } else if ( strcasecmp( cargv[0], "sizelimit" ) == 0 ) { if ( cargc < 2 ) { @@ -131,6 +133,54 @@ read_config( char *fname, Backend **bep, FILE *pfp ) charray_add( &be->be_suffix, dn ); } + /* set database suffixAlias */ + } else if ( strcasecmp( cargv[0], "suffixAlias" ) == 0 ) { + if ( cargc < 2 ) { + Debug( LDAP_DEBUG_ANY, + "%s: line %d: missing alias and aliased_dn in \"suffixAlias \" line\n", + fname, lineno, 0 ); + exit( 1 ); + } else if ( cargc < 3 ) { + Debug( LDAP_DEBUG_ANY, + "%s: line %d: missing aliased_dn in \"suffixAlias \" line\n", + fname, lineno, 0 ); + exit( 1 ); + } else if ( cargc > 3 ) { + Debug( LDAP_DEBUG_ANY, + "%s: line %d: extra cruft in suffixAlias line (ignored)\n", + fname, lineno, 0 ); + } + if ( be == NULL ) { + Debug( LDAP_DEBUG_ANY, +"%s: line %d: suffixAlias line must appear inside a database definition (ignored)\n", + fname, lineno, 0 ); + } else { + dn = strdup( cargv[1] ); + (void) dn_normalize( dn ); + charray_add( &be->be_suffixAlias, dn ); + + dn = strdup( cargv[2] ); + (void) dn_normalize( dn ); + charray_add( &be->be_suffixAlias, dn ); + } + + /* set max deref depth */ + } else if ( strcasecmp( cargv[0], "maxDerefDepth" ) == 0 ) { + if ( cargc < 2 ) { + Debug( LDAP_DEBUG_ANY, + "%s: line %d: missing depth in \"maxDerefDepth \" line\n", + fname, lineno, 0 ); + exit( 1 ); + } + if ( be == NULL ) { + Debug( LDAP_DEBUG_ANY, +"%s: line %d: depth line must appear inside a database definition (ignored)\n", + fname, lineno, 0 ); + } else { + be->be_maxDerefDepth = atoi (cargv[1]); + } + + /* set magic "root" dn for this database */ } else if ( strcasecmp( cargv[0], "rootdn" ) == 0 ) { if ( cargc < 2 ) {