]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10219 Modify of olcDisabled by removing and adding a value invokes db_open twice
authorNadezhda Ivanova <nivanova@symas.com>
Thu, 23 May 2024 13:09:26 +0000 (16:09 +0300)
committerQuanah Gibson-Mount <quanah@openldap.org>
Thu, 13 Jun 2024 18:41:25 +0000 (18:41 +0000)
Do not invoke db_open if the database is not actually disabled

servers/slapd/bconfig.c

index aae13e8668b74fd223323afa43dc1f01ba9f61bf..ee8aea87253ff66f2be9fb522179531a158ea888 100644 (file)
@@ -1636,14 +1636,16 @@ config_generic(ConfigArgs *c) {
 
                case CFG_DISABLED:
                        if ( c->bi ) {
-                               c->bi->bi_flags &= ~SLAP_DBFLAG_DISABLED;
-                               if ( c->bi->bi_db_open ) {
-                                       BackendInfo *bi_orig = c->be->bd_info;
-                                       c->be->bd_info = c->bi;
-                                       rc = c->bi->bi_db_open( c->be, &c->reply );
-                                       c->be->bd_info = bi_orig;
+                               if ( c->bi->bi_flags & SLAP_DBFLAG_DISABLED ) {
+                                       c->bi->bi_flags &= ~SLAP_DBFLAG_DISABLED;
+                                       if ( c->bi->bi_db_open ) {
+                                               BackendInfo *bi_orig = c->be->bd_info;
+                                               c->be->bd_info = c->bi;
+                                               rc = c->bi->bi_db_open( c->be, &c->reply );
+                                               c->be->bd_info = bi_orig;
+                                       }
                                }
-                       } else {
+                       } else if ( c->be->be_flags & SLAP_DBFLAG_DISABLED ){
                                c->be->be_flags &= ~SLAP_DBFLAG_DISABLED;
                                rc = backend_startup_one( c->be, &c->reply );
                        }