From: Howard Chu Date: Thu, 11 Sep 2003 22:25:14 +0000 (+0000) Subject: Merged config patches from HEAD: X-Git-Tag: OPENLDAP_REL_ENG_2_1_23~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c98e75e34c598c92e364f364cf6db941e77dbc78;p=thirdparty%2Fopenldap.git Merged config patches from HEAD: ITS#2594 replica uri replica-pidfile, replica-argfile --- diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 8c93db6bd2..f11d85244a 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -89,7 +89,8 @@ read_config( const char *fname, int depth ) int lineno, i; int rc; struct berval vals[2]; - + char *replicahost; + LDAPURLDesc *ludp; static int lastmod = 1; static BackendInfo *bi = NULL; static BackendDB *be = NULL; @@ -572,6 +573,12 @@ read_config( const char *fname, int depth ) slapd_args_file = ch_strdup( cargv[1] ); + } else if ( strcasecmp( cargv[0], "replica-pidfile" ) == 0 ) { + /* ignore */ ; + + } else if ( strcasecmp( cargv[0], "replica-argsfile" ) == 0 ) { + /* ignore */ ; + /* default password hash */ } else if ( strcasecmp( cargv[0], "password-hash" ) == 0 ) { if ( cargc < 2 ) { @@ -1723,11 +1730,11 @@ read_config( const char *fname, int depth ) if ( cargc < 2 ) { #ifdef NEW_LOGGING LDAP_LOG( CONFIG, CRIT, - "%s: line %d: missing host in \"replica " + "%s: line %d: missing host or uri in \"replica " " \" line\n", + "%s: line %d: missing host or uri in \"replica \" line\n", fname, lineno, 0 ); #endif @@ -1754,16 +1761,62 @@ read_config( const char *fname, int depth ) nr = add_replica_info( be, cargv[i] + 5 ); break; + } else if (strncasecmp( cargv[i], "uri=", 4 ) + == 0 ) { + if ( ldap_url_parse( cargv[ i ] + 4, &ludp ) + != LDAP_SUCCESS ) { +#ifdef NEW_LOGGING + LDAP_LOG( CONFIG, INFO, + "%s: line %d: replica line contains invalid " + "uri definition.\n", fname, lineno, 0); +#else + Debug( LDAP_DEBUG_ANY, + "%s: line %d: replica line contains invalid " + "uri definition.\n", fname, lineno, 0); +#endif + return 1; + } + if (ludp->lud_host == NULL ) { +#ifdef NEW_LOGGING + LDAP_LOG( CONFIG, INFO, + "%s: line %d: replica line contains invalid " + "uri definition - missing hostname.\n", + fname, lineno, 0); +#else + Debug( LDAP_DEBUG_ANY, + "%s: line %d: replica line contains invalid " + "uri definition - missing hostname.\n", fname, lineno, 0); +#endif + return 1; + } + replicahost = ch_malloc( strlen( cargv[ i ] ) ); + if ( replicahost == NULL ) { +#ifdef NEW_LOGGING + LDAP_LOG( CONFIG, ERR, + "out of memory in read_config\n", 0, 0,0 ); +#else + Debug( LDAP_DEBUG_ANY, + "out of memory in read_config\n", 0, 0, 0 ); +#endif + ldap_free_urldesc( ludp ); + exit( EXIT_FAILURE ); + } + sprintf(replicahost, "%s:%d", + ludp->lud_host, ludp->lud_port); + nr = add_replica_info( be, replicahost ); + ldap_free_urldesc( ludp ); + ch_free(replicahost); + break; } } if ( i == cargc ) { #ifdef NEW_LOGGING LDAP_LOG( CONFIG, INFO, - "%s: line %d: missing host in \"replica\" line\n", + "%s: line %d: missing host or uri in \"replica\" line\n", fname, lineno , 0 ); #else Debug( LDAP_DEBUG_ANY, - "%s: line %d: missing host in \"replica\" line\n", + "%s: line %d: missing host or uri in \"replica\" line\n", fname, lineno, 0 ); #endif return 1;