From b04a864728235dad347bf1de9da0fa1ca80f60aa Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Mon, 26 Sep 2011 22:21:34 +0200 Subject: [PATCH] Fix lurking bug in match when db_driver is not set (everything but DBI). --- bacula/src/cats/cats.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/bacula/src/cats/cats.c b/bacula/src/cats/cats.c index ec8cf8bf84..eed774c71c 100644 --- a/bacula/src/cats/cats.c +++ b/bacula/src/cats/cats.c @@ -43,14 +43,19 @@ bool B_DB::db_match_database(const char *db_driver, const char *db_name, const char *db_address, int db_port) { - if (bstrcmp(m_db_driver, db_driver) && - bstrcmp(m_db_name, db_name) && - bstrcmp(m_db_address, db_address) && - m_db_port == db_port) { - return true; + bool match; + + if (db_driver) { + match = strcasecmp(m_db_driver, db_driver) == 0 && + bstrcmp(m_db_name, db_name) && + bstrcmp(m_db_address, db_address) && + m_db_port == db_port; + } else { + match = bstrcmp(m_db_name, db_name) && + bstrcmp(m_db_address, db_address) && + m_db_port == db_port; } - - return false; + return match; } B_DB *B_DB::db_clone_database_connection(JCR *jcr, bool mult_db_connections) -- 2.39.5