]> git.pld-linux.org Git - packages/zabbix.git/blob - sqlite3_dbname.patch
up to 6.0.18
[packages/zabbix.git] / sqlite3_dbname.patch
1 --- zabbix-5.4.3/conf/zabbix_proxy.conf~        2021-08-24 12:51:15.000000000 +0300
2 +++ zabbix-5.4.3/conf/zabbix_proxy.conf 2021-08-24 12:52:01.573388850 +0300
3 @@ -160,6 +160,7 @@
4  ### Option: DBName
5  #      Database name.
6  #      For SQLite3 path to database file must be provided. DBUser and DBPassword are ignored.
7 +#      If provided name does not contain '/' or ':' (no a path or special type) a .db file in /var/lib/zabbix will be used.
8  #      If the Net Service Name connection method is used to connect to Oracle database, specify the service name from
9  #      the tnsnames.ora file or set to empty string; also see the TWO_TASK environment variable if DBName is set to
10  #      empty string.
11 diff -urNp -x '*.orig' zabbix-5.2.3.org/src/libs/zbxdb/db.c zabbix-5.2.3/src/libs/zbxdb/db.c
12 --- zabbix-5.2.3.org/src/libs/zbxdb/db.c        2020-12-14 11:27:17.000000000 +0100
13 +++ zabbix-5.2.3/src/libs/zbxdb/db.c    2021-08-24 11:18:52.356778296 +0200
14 @@ -383,6 +383,7 @@ int zbx_db_connect(char *host, char *use
15         unsigned int    i = 0;
16  #elif defined(HAVE_SQLITE3)
17         char            *p, *path = NULL;
18 +       char            dbname_buf[1024];
19  #endif
20  
21  #ifndef HAVE_MYSQL
22 @@ -830,6 +831,10 @@ out:
23         ZBX_UNUSED(ca);
24         ZBX_UNUSED(cipher);
25         ZBX_UNUSED(cipher_13);
26 +       if (!strchr(dbname, '/') && !strchr(dbname, ':')) {
27 +               zbx_snprintf(dbname_buf, sizeof(dbname_buf), "/var/lib/zabbix/%s.db", dbname);
28 +               dbname = dbname_buf;
29 +       }
30  #ifdef HAVE_FUNCTION_SQLITE3_OPEN_V2
31         if (SQLITE_OK != sqlite3_open_v2(dbname, &conn, SQLITE_OPEN_READWRITE, NULL))
32  #else
This page took 0.034176 seconds and 3 git commands to generate.