]> git.sur5r.net Git - openldap/commitdiff
Fix ITS#4194, require config dir to be usable if only -F is specified.
authorHoward Chu <hyc@openldap.org>
Tue, 22 Nov 2005 10:11:06 +0000 (10:11 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 22 Nov 2005 10:11:06 +0000 (10:11 +0000)
servers/slapd/bconfig.c

index 688d6e815bf3a65455e9c209c897f070fd0626d9..099c38e40e0edc4a699c59b05a361ffea9956fbc 100644 (file)
@@ -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 ) {