]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix lurking bug in match when db_driver is not set (everything but DBI).
authorMarco van Wieringen <mvw@planets.elm.net>
Mon, 26 Sep 2011 20:21:34 +0000 (22:21 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:50:02 +0000 (14:50 +0200)
bacula/src/cats/cats.c

index ec8cf8bf841a7b79737be5cf7f72761ddd6ef6e3..eed774c71c96451efd88a5ec287c229649dfcf38 100644 (file)
 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)