]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#8577 don't allow setting logDB to current DB
authorHoward Chu <hyc@openldap.org>
Sun, 21 Mar 2021 17:20:05 +0000 (17:20 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 21 Mar 2021 17:20:05 +0000 (17:20 +0000)
servers/slapd/overlays/accesslog.c

index 14cd208fb6ed73649046c9f1c6afda68832271f4..c1daedcd7699a5aeb453a87585a32fc8ccf88c50 100644 (file)
@@ -941,6 +941,14 @@ log_cf_gen(ConfigArgs *c)
                                                c->log, c->cr_msg, c->value_dn.bv_val );
                                        rc = 1;
                                }
+                               if ( !rc && ( li->li_db->bd_self == c->be->bd_self )) {
+                                       snprintf( c->cr_msg, sizeof( c->cr_msg ),
+                                               "<%s> invalid suffix, points to itself",
+                                               c->argv[0] );
+                                       Debug( LDAP_DEBUG_ANY, "%s: %s \"%s\"\n",
+                                               c->log, c->cr_msg, c->value_dn.bv_val );
+                                       rc = 1;
+                               }
                                ch_free( c->value_ndn.bv_val );
                        } else {
                                li->li_db_suffix = c->value_ndn;
@@ -2413,6 +2421,11 @@ accesslog_db_open(
                        "accesslog: \"logdb <suffix>\" missing or invalid.\n" );
                return 1;
        }
+       if ( li->li_db->bd_self == be->bd_self ) {
+               Debug( LDAP_DEBUG_ANY,
+                       "accesslog: \"logdb <suffix>\" is this database, cannot log to itself.\n" );
+               return 1;
+       }
 
        if ( slapMode & SLAP_TOOL_MODE )
                return 0;