From 575f6e2251c0d981ed874b5bbb8584894694b793 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 22 Nov 2005 10:11:06 +0000 Subject: [PATCH] Fix ITS#4194, require config dir to be usable if only -F is specified. --- servers/slapd/bconfig.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 688d6e815b..099c38e40e 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -2882,7 +2882,9 @@ config_setup_ldif( BackendDB *be, const char *dir, int readit ) { ldap_pvt_thread_pool_context_reset( thrctx ); } - cfb->cb_use_ldif = 1; + /* ITS#4194 - only use if it's present, or we're converting. */ + if ( !readit || rc == LDAP_SUCCESS ) + cfb->cb_use_ldif = 1; return rc; } @@ -2950,9 +2952,16 @@ read_config(const char *fname, const char *dir) { /* if fname is defaulted, try reading .d */ rc = config_setup_ldif( be, cfdir, !fname ); - /* It's OK if the base object doesn't exist yet */ - if ( rc && rc != LDAP_NO_SUCH_OBJECT ) - return 1; + if ( rc ) { + /* It may be OK if the base object doesn't exist yet. */ + if ( rc != LDAP_NO_SUCH_OBJECT ) + return 1; + /* ITS#4194: But if dir was specified and no fname, + * then we were supposed to read the dir. + */ + if ( dir && !fname ) + return 1; + } /* If we read the config from back-ldif, nothing to do here */ if ( cfb->cb_got_ldif ) { -- 2.39.5