]> git.pld-linux.org Git - packages/zabbix.git/blob - sqlite3_dbname.patch
3123a8232c9758b58425213c8c057f1d51be1f5c
[packages/zabbix.git] / sqlite3_dbname.patch
1 diff -urNp -x '*.orig' zabbix-5.2.3.org/conf/zabbix_proxy.conf zabbix-5.2.3/conf/zabbix_proxy.conf
2 --- zabbix-5.2.3.org/conf/zabbix_proxy.conf     2021-08-24 11:18:51.673409490 +0200
3 +++ zabbix-5.2.3/conf/zabbix_proxy.conf 2021-08-24 11:18:52.353444791 +0200
4 @@ -158,6 +158,7 @@ PidFile=/var/run/zabbix/zabbix_proxy.pid
5  ### Option: DBName
6  #      Database name.
7  #      For SQLite3 path to database file must be provided. DBUser and DBPassword are ignored.
8 +#      If provided name does not contain '/' or ':' (no a path or special type) a .db file in /var/lib/zabbix will be used.
9  #      Warning: do not attempt to use the same database Zabbix server is using.
10  #
11  # Mandatory: yes
12 diff -urNp -x '*.orig' zabbix-5.2.3.org/src/libs/zbxdb/db.c zabbix-5.2.3/src/libs/zbxdb/db.c
13 --- zabbix-5.2.3.org/src/libs/zbxdb/db.c        2020-12-14 11:27:17.000000000 +0100
14 +++ zabbix-5.2.3/src/libs/zbxdb/db.c    2021-08-24 11:18:52.356778296 +0200
15 @@ -383,6 +383,7 @@ int zbx_db_connect(char *host, char *use
16         unsigned int    i = 0;
17  #elif defined(HAVE_SQLITE3)
18         char            *p, *path = NULL;
19 +       char            dbname_buf[1024];
20  #endif
21  
22  #ifndef HAVE_MYSQL
23 @@ -830,6 +831,10 @@ out:
24         ZBX_UNUSED(ca);
25         ZBX_UNUSED(cipher);
26         ZBX_UNUSED(cipher_13);
27 +       if (!strchr(dbname, '/') && !strchr(dbname, ':')) {
28 +               zbx_snprintf(dbname_buf, sizeof(dbname_buf), "/var/lib/zabbix/%s.db", dbname);
29 +               dbname = dbname_buf;
30 +       }
31  #ifdef HAVE_FUNCTION_SQLITE3_OPEN_V2
32         if (SQLITE_OK != sqlite3_open_v2(dbname, &conn, SQLITE_OPEN_READWRITE, NULL))
33  #else
This page took 0.019259 seconds and 2 git commands to generate.