1 /*
2 ** Zabbix
3 ** Copyright (C) 2001-2021 Zabbix SIA
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 **/
19
20 #include "common.h"
21 #include "db.h"
22 #include "dbupgrade.h"
23 #include "sysinfo.h"
24 #include "log.h"
25
26 /*
27 * 3.0 development database patches
28 */
29
30 #ifndef HAVE_SQLITE3
31
DBpatch_2050000(void)32 static int DBpatch_2050000(void)
33 {
34 const ZBX_FIELD field = {"agent", "Zabbix", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
35
36 return DBset_default("httptest", &field);
37 }
38
DBpatch_2050001(void)39 static int DBpatch_2050001(void)
40 {
41 DB_RESULT result;
42 DB_ROW row;
43 char *oid = NULL;
44 size_t oid_alloc = 0;
45 int ret = FAIL, rc;
46
47 /* flags - ZBX_FLAG_DISCOVERY_RULE */
48 /* type - ITEM_TYPE_SNMPv1, ITEM_TYPE_SNMPv2c, ITEM_TYPE_SNMPv3 */
49 if (NULL == (result = DBselect("select itemid,snmp_oid from items where flags=1 and type in (1,4,6)")))
50 return FAIL;
51
52 while (NULL != (row = DBfetch(result)))
53 {
54 char *param, *oid_esc;
55 size_t oid_offset = 0;
56
57 param = zbx_strdup(NULL, row[1]);
58 zbx_snprintf_alloc(&oid, &oid_alloc, &oid_offset, "discovery[{#SNMPVALUE},%s]", param);
59
60 if (FAIL == quote_key_param(¶m, 0))
61 {
62 zabbix_log(LOG_LEVEL_WARNING, "cannot convert SNMP discovery OID \"%s\":"
63 " OID contains invalid character(s)", row[1]);
64 rc = ZBX_DB_OK;
65 }
66 else if (255 < oid_offset && 255 < zbx_strlen_utf8(oid)) /* 255 - ITEM_SNMP_OID_LEN */
67 {
68 zabbix_log(LOG_LEVEL_WARNING, "cannot convert SNMP discovery OID \"%s\":"
69 " resulting OID is too long", row[1]);
70 rc = ZBX_DB_OK;
71 }
72 else
73 {
74 oid_esc = DBdyn_escape_string(oid);
75
76 rc = DBexecute("update items set snmp_oid='%s' where itemid=%s", oid_esc, row[0]);
77
78 zbx_free(oid_esc);
79 }
80
81 zbx_free(param);
82
83 if (ZBX_DB_OK > rc)
84 goto out;
85 }
86
87 ret = SUCCEED;
88 out:
89 DBfree_result(result);
90 zbx_free(oid);
91
92 return ret;
93 }
94
DBpatch_2050002(void)95 static int DBpatch_2050002(void)
96 {
97 const ZBX_FIELD field = {"lastlogsize", "0", NULL, NULL, 0, ZBX_TYPE_UINT, ZBX_NOTNULL, 0};
98
99 return DBadd_field("proxy_history", &field);
100 }
101
DBpatch_2050003(void)102 static int DBpatch_2050003(void)
103 {
104 const ZBX_FIELD field = {"mtime", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
105
106 return DBadd_field("proxy_history", &field);
107 }
108
DBpatch_2050004(void)109 static int DBpatch_2050004(void)
110 {
111 const ZBX_FIELD field = {"meta", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
112
113 return DBadd_field("proxy_history", &field);
114 }
115
DBpatch_2050005(void)116 static int DBpatch_2050005(void)
117 {
118 return DBdrop_index("triggers", "triggers_2");
119 }
120
DBpatch_2050006(void)121 static int DBpatch_2050006(void)
122 {
123 return DBcreate_index("triggers", "triggers_2", "value,lastchange", 0);
124 }
125
DBpatch_2050007(void)126 static int DBpatch_2050007(void)
127 {
128 const ZBX_FIELD field = {"error", "", NULL, NULL, 2048, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
129
130 return DBmodify_field_type("hosts", &field, NULL);
131 }
132
DBpatch_2050008(void)133 static int DBpatch_2050008(void)
134 {
135 const ZBX_FIELD field = {"ipmi_error", "", NULL, NULL, 2048, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
136
137 return DBmodify_field_type("hosts", &field, NULL);
138 }
139
DBpatch_2050009(void)140 static int DBpatch_2050009(void)
141 {
142 const ZBX_FIELD field = {"snmp_error", "", NULL, NULL, 2048, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
143
144 return DBmodify_field_type("hosts", &field, NULL);
145 }
146
DBpatch_2050010(void)147 static int DBpatch_2050010(void)
148 {
149 const ZBX_FIELD field = {"jmx_error", "", NULL, NULL, 2048, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
150
151 return DBmodify_field_type("hosts", &field, NULL);
152 }
153
DBpatch_2050011(void)154 static int DBpatch_2050011(void)
155 {
156 /* 1 - ITEM_VALUE_TYPE_STR, 2 - ITEM_VALUE_TYPE_LOG, 4 - ITEM_VALUE_TYPE_TEXT */
157 if (ZBX_DB_OK <= DBexecute("update items set trends=0 where value_type in (1,2,4)"))
158 return SUCCEED;
159
160 return FAIL;
161 }
162
DBpatch_2050012(void)163 static int DBpatch_2050012(void)
164 {
165 DB_RESULT result;
166 DB_RESULT result2;
167 DB_ROW row;
168 char *key = NULL, *key_esc, *param;
169 int ret = SUCCEED;
170 AGENT_REQUEST request;
171
172 /* type - ITEM_TYPE_ZABBIX, ITEM_TYPE_SIMPLE, ITEM_TYPE_ZABBIX_ACTIVE */
173 result = DBselect(
174 "select hostid,itemid,key_"
175 " from items"
176 " where type in (0,3,7)"
177 " and key_ like 'net.tcp.service%%[%%ntp%%'");
178
179 while (SUCCEED == ret && NULL != (row = DBfetch(result)))
180 {
181 init_request(&request);
182
183 if (SUCCEED != parse_item_key(row[2], &request))
184 {
185 zabbix_log(LOG_LEVEL_WARNING, "cannot parse item key \"%s\"", row[2]);
186 continue;
187 }
188
189 param = get_rparam(&request, 0);
190
191 /* NULL check to silence static analyzer warning */
192 if (NULL == param || (0 != strcmp("service.ntp", param) && 0 != strcmp("ntp", param)))
193 {
194 free_request(&request);
195 continue;
196 }
197
198 key = zbx_strdup(key, row[2]);
199
200 if (0 == strcmp("service.ntp", param))
201 {
202 /* replace "service.ntp" with "ntp" */
203
204 char *p;
205
206 p = strstr(key, "service.ntp");
207
208 do
209 {
210 *p = *(p + 8);
211 }
212 while ('\0' != *(p++));
213 }
214
215 free_request(&request);
216
217 /* replace "net.tcp.service" with "net.udp.service" */
218
219 key[4] = 'u';
220 key[5] = 'd';
221 key[6] = 'p';
222
223 key_esc = DBdyn_escape_string(key);
224
225 result2 = DBselect("select null from items where hostid=%s and key_='%s'", row[0], key_esc);
226
227 if (NULL == DBfetch(result2))
228 {
229 if (ZBX_DB_OK > DBexecute("update items set key_='%s' where itemid=%s", key_esc, row[1]))
230 ret = FAIL;
231 }
232 else
233 {
234 zabbix_log(LOG_LEVEL_WARNING, "cannot convert item key \"%s\":"
235 " item with converted key \"%s\" already exists on host ID [%s]",
236 row[2], key, row[0]);
237 }
238 DBfree_result(result2);
239
240 zbx_free(key_esc);
241 }
242 DBfree_result(result);
243
244 zbx_free(key);
245
246 return ret;
247 }
248
DBpatch_2050013(void)249 static int DBpatch_2050013(void)
250 {
251 return DBdrop_table("user_history");
252 }
253
DBpatch_2050014(void)254 static int DBpatch_2050014(void)
255 {
256 if (ZBX_DB_OK <= DBexecute(
257 "update config"
258 " set default_theme="
259 "case when default_theme in ('classic', 'originalblue')"
260 " then 'blue-theme'"
261 " else 'dark-theme' end"))
262 {
263 return SUCCEED;
264 }
265
266 return FAIL;
267 }
268
DBpatch_2050015(void)269 static int DBpatch_2050015(void)
270 {
271 if (ZBX_DB_OK <= DBexecute(
272 "update users"
273 " set theme=case when theme in ('classic', 'originalblue') then 'blue-theme' else 'dark-theme' end"
274 " where theme<>'default'"))
275 {
276 return SUCCEED;
277 }
278
279 return FAIL;
280 }
281
DBpatch_2050019(void)282 static int DBpatch_2050019(void)
283 {
284 const ZBX_FIELD field = {"smtp_port", "25", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
285
286 return DBadd_field("media_type", &field);
287 }
288
DBpatch_2050020(void)289 static int DBpatch_2050020(void)
290 {
291 const ZBX_FIELD field = {"smtp_security", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
292
293 return DBadd_field("media_type", &field);
294 }
295
DBpatch_2050021(void)296 static int DBpatch_2050021(void)
297 {
298 const ZBX_FIELD field = {"smtp_verify_peer", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
299
300 return DBadd_field("media_type", &field);
301 }
302
DBpatch_2050022(void)303 static int DBpatch_2050022(void)
304 {
305 const ZBX_FIELD field = {"smtp_verify_host", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
306
307 return DBadd_field("media_type", &field);
308 }
309
DBpatch_2050023(void)310 static int DBpatch_2050023(void)
311 {
312 const ZBX_FIELD field = {"smtp_authentication", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
313
314 return DBadd_field("media_type", &field);
315 }
316
DBpatch_2050029(void)317 static int DBpatch_2050029(void)
318 {
319 const ZBX_FIELD field = {"default_theme", "blue-theme", NULL, NULL, 128, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
320
321 return DBset_default("config", &field);
322 }
323
DBpatch_2050030(void)324 static int DBpatch_2050030(void)
325 {
326 const ZBX_TABLE table =
327 {"application_prototype", "application_prototypeid", 0,
328 {
329 {"application_prototypeid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
330 {"itemid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
331 {"templateid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, 0, 0},
332 {"name", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
333 {0}
334 },
335 NULL
336 };
337
338 return DBcreate_table(&table);
339 }
340
DBpatch_2050031(void)341 static int DBpatch_2050031(void)
342 {
343 return DBcreate_index("application_prototype", "application_prototype_1", "itemid", 0);
344 }
345
DBpatch_2050032(void)346 static int DBpatch_2050032(void)
347 {
348 return DBcreate_index("application_prototype", "application_prototype_2", "templateid", 0);
349 }
350
DBpatch_2050033(void)351 static int DBpatch_2050033(void)
352 {
353 const ZBX_FIELD field = {"itemid", NULL, "items", "itemid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
354
355 return DBadd_foreign_key("application_prototype", 1, &field);
356 }
357
DBpatch_2050034(void)358 static int DBpatch_2050034(void)
359 {
360 const ZBX_FIELD field = {"templateid", NULL, "application_prototype", "application_prototypeid",
361 0, 0, 0, ZBX_FK_CASCADE_DELETE};
362
363 return DBadd_foreign_key("application_prototype", 2, &field);
364 }
365
DBpatch_2050035(void)366 static int DBpatch_2050035(void)
367 {
368 const ZBX_TABLE table =
369 {"item_application_prototype", "item_application_prototypeid", 0,
370 {
371 {"item_application_prototypeid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL,
372 0},
373 {"application_prototypeid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
374 {"itemid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
375 {0}
376 },
377 NULL
378 };
379
380 return DBcreate_table(&table);
381 }
382
DBpatch_2050036(void)383 static int DBpatch_2050036(void)
384 {
385 return DBcreate_index("item_application_prototype", "item_application_prototype_1",
386 "application_prototypeid,itemid", 1);
387 }
388
DBpatch_2050037(void)389 static int DBpatch_2050037(void)
390 {
391 return DBcreate_index("item_application_prototype", "item_application_prototype_2", "itemid", 0);
392 }
393
DBpatch_2050038(void)394 static int DBpatch_2050038(void)
395 {
396 const ZBX_FIELD field = {"application_prototypeid", NULL, "application_prototype", "application_prototypeid",
397 0, 0, 0, ZBX_FK_CASCADE_DELETE};
398
399 return DBadd_foreign_key("item_application_prototype", 1, &field);
400 }
401
DBpatch_2050039(void)402 static int DBpatch_2050039(void)
403 {
404 const ZBX_FIELD field = {"itemid", NULL, "items", "itemid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
405
406 return DBadd_foreign_key("item_application_prototype", 2, &field);
407 }
408
DBpatch_2050040(void)409 static int DBpatch_2050040(void)
410 {
411 const ZBX_TABLE table =
412 {"application_discovery", "application_discoveryid", 0,
413 {
414 {"application_discoveryid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
415 {"applicationid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
416 {"application_prototypeid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
417 {"name", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
418 {"lastcheck", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
419 {"ts_delete", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
420 {0}
421 },
422 NULL
423 };
424
425 return DBcreate_table(&table);
426 }
427
DBpatch_2050041(void)428 static int DBpatch_2050041(void)
429 {
430 return DBcreate_index("application_discovery", "application_discovery_1", "applicationid", 0);
431 }
432
DBpatch_2050042(void)433 static int DBpatch_2050042(void)
434 {
435 return DBcreate_index("application_discovery", "application_discovery_2", "application_prototypeid", 0);
436 }
437
DBpatch_2050043(void)438 static int DBpatch_2050043(void)
439 {
440 const ZBX_FIELD field = {"applicationid", NULL, "applications", "applicationid", 0, 0, 0,
441 ZBX_FK_CASCADE_DELETE};
442
443 return DBadd_foreign_key("application_discovery", 1, &field);
444 }
445
DBpatch_2050044(void)446 static int DBpatch_2050044(void)
447 {
448 const ZBX_FIELD field = {"application_prototypeid", NULL, "application_prototype", "application_prototypeid",
449 0, 0, 0, ZBX_FK_CASCADE_DELETE};
450
451 return DBadd_foreign_key("application_discovery", 2, &field);
452 }
453
DBpatch_2050045(void)454 static int DBpatch_2050045(void)
455 {
456 const ZBX_FIELD field = {"flags", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
457
458 return DBadd_field("applications", &field);
459 }
460
DBpatch_2050051(void)461 static int DBpatch_2050051(void)
462 {
463 const ZBX_FIELD field = {"iprange", "", NULL, NULL, 2048, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
464
465 return DBmodify_field_type("drules", &field, NULL);
466 }
467
DBpatch_2050052(void)468 static int DBpatch_2050052(void)
469 {
470 const ZBX_FIELD field = {"default_inventory_mode", "-1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
471
472 return DBadd_field("config", &field);
473 }
474
DBpatch_2050053(void)475 static int DBpatch_2050053(void)
476 {
477 const ZBX_TABLE table =
478 {"opinventory", "operationid", 0,
479 {
480 {"operationid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
481 {"inventory_mode", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
482 {0}
483 },
484 NULL
485 };
486
487 return DBcreate_table(&table);
488 }
489
DBpatch_2050054(void)490 static int DBpatch_2050054(void)
491 {
492 const ZBX_FIELD field = {"operationid", NULL, "operations", "operationid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
493
494 return DBadd_foreign_key("opinventory", 1, &field);
495 }
496
DBpatch_2050055(void)497 static int DBpatch_2050055(void)
498 {
499 DB_RESULT result;
500 DB_ROW row;
501 int ret = FAIL;
502
503 if (NULL == (result = DBselect(
504 "select severity_color_0,severity_color_1,severity_color_2,severity_color_3,severity_color_4,"
505 "severity_color_5"
506 " from config")))
507 {
508 return FAIL;
509 }
510
511 if (NULL != (row = DBfetch(result)) &&
512 0 == strcmp(row[0], "DBDBDB") && 0 == strcmp(row[1], "D6F6FF") &&
513 0 == strcmp(row[2], "FFF6A5") && 0 == strcmp(row[3], "FFB689") &&
514 0 == strcmp(row[4], "FF9999") && 0 == strcmp(row[5], "FF3838"))
515 {
516 if (ZBX_DB_OK > DBexecute(
517 "update config set severity_color_0='97AAB3',severity_color_1='7499FF',"
518 "severity_color_2='FFC859',severity_color_3='FFA059',"
519 "severity_color_4='E97659',severity_color_5='E45959'"))
520 {
521 goto out;
522 }
523 }
524
525 ret = SUCCEED;
526 out:
527 DBfree_result(result);
528
529 return ret;
530 }
531
DBpatch_2050056(void)532 static int DBpatch_2050056(void)
533 {
534 const ZBX_FIELD field = {"severity_color_0", "97AAB3", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
535
536 return DBset_default("config", &field);
537 }
538
DBpatch_2050057(void)539 static int DBpatch_2050057(void)
540 {
541 const ZBX_FIELD field = {"severity_color_1", "7499FF", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
542
543 return DBset_default("config", &field);
544 }
545
DBpatch_2050058(void)546 static int DBpatch_2050058(void)
547 {
548 const ZBX_FIELD field = {"severity_color_2", "FFC859", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
549
550 return DBset_default("config", &field);
551 }
552
DBpatch_2050059(void)553 static int DBpatch_2050059(void)
554 {
555 const ZBX_FIELD field = {"severity_color_3", "FFA059", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
556
557 return DBset_default("config", &field);
558 }
559
DBpatch_2050060(void)560 static int DBpatch_2050060(void)
561 {
562 const ZBX_FIELD field = {"severity_color_4", "E97659", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
563
564 return DBset_default("config", &field);
565 }
566
DBpatch_2050061(void)567 static int DBpatch_2050061(void)
568 {
569 const ZBX_FIELD field = {"severity_color_5", "E45959", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
570
571 return DBset_default("config", &field);
572 }
573
DBpatch_2050062(void)574 static int DBpatch_2050062(void)
575 {
576 const ZBX_FIELD field = {"exec_params", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
577
578 return DBadd_field("media_type", &field);
579 }
580
DBpatch_2050063(void)581 static int DBpatch_2050063(void)
582 {
583 /* type=1 -> type=MEDIA_TYPE_EXEC */
584 if (ZBX_DB_OK > DBexecute("update media_type"
585 " set exec_params='{ALERT.SENDTO}\n{ALERT.SUBJECT}\n{ALERT.MESSAGE}\n'"
586 " where type=1"))
587 {
588 return FAIL;
589 }
590
591 return SUCCEED;
592 }
593
DBpatch_2050064(void)594 static int DBpatch_2050064(void)
595 {
596 const ZBX_FIELD field = {"tls_connect", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
597
598 return DBadd_field("hosts", &field);
599 }
600
DBpatch_2050065(void)601 static int DBpatch_2050065(void)
602 {
603 const ZBX_FIELD field = {"tls_accept", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
604
605 return DBadd_field("hosts", &field);
606 }
607
DBpatch_2050066(void)608 static int DBpatch_2050066(void)
609 {
610 const ZBX_FIELD field = {"tls_issuer", "", NULL, NULL, 1024, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
611
612 return DBadd_field("hosts", &field);
613 }
614
DBpatch_2050067(void)615 static int DBpatch_2050067(void)
616 {
617 const ZBX_FIELD field = {"tls_subject", "", NULL, NULL, 1024, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
618
619 return DBadd_field("hosts", &field);
620 }
621
DBpatch_2050068(void)622 static int DBpatch_2050068(void)
623 {
624 const ZBX_FIELD field = {"tls_psk_identity", "", NULL, NULL, 128, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
625
626 return DBadd_field("hosts", &field);
627 }
628
DBpatch_2050069(void)629 static int DBpatch_2050069(void)
630 {
631 const ZBX_FIELD field = {"tls_psk", "", NULL, NULL, 512, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
632
633 return DBadd_field("hosts", &field);
634 }
635
DBpatch_2050070(void)636 static int DBpatch_2050070(void)
637 {
638 const ZBX_FIELD field = {"macro", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
639
640 return DBmodify_field_type("globalmacro", &field, NULL);
641 }
642
DBpatch_2050071(void)643 static int DBpatch_2050071(void)
644 {
645 const ZBX_FIELD field = {"macro", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
646
647 return DBmodify_field_type("hostmacro", &field, NULL);
648 }
649
DBpatch_2050077(void)650 static int DBpatch_2050077(void)
651 {
652 const ZBX_FIELD field = {"userid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, 0, 0};
653
654 return DBadd_field("sysmaps", &field);
655 }
656
DBpatch_2050078(void)657 static int DBpatch_2050078(void)
658 {
659 /* type=3 -> type=USER_TYPE_SUPER_ADMIN */
660 if (ZBX_DB_OK > DBexecute("update sysmaps set userid=(select min(userid) from users where type=3)"))
661 return FAIL;
662
663 return SUCCEED;
664 }
665
DBpatch_2050079(void)666 static int DBpatch_2050079(void)
667 {
668 const ZBX_FIELD field = {"userid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0};
669
670 return DBset_not_null("sysmaps", &field);
671 }
672
DBpatch_2050080(void)673 static int DBpatch_2050080(void)
674 {
675 const ZBX_FIELD field = {"userid", NULL, "users", "userid", 0, 0, 0, 0};
676
677 return DBadd_foreign_key("sysmaps", 3, &field);
678 }
679
DBpatch_2050081(void)680 static int DBpatch_2050081(void)
681 {
682 const ZBX_FIELD field = {"private", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
683
684 return DBadd_field("sysmaps", &field);
685 }
686
DBpatch_2050082(void)687 static int DBpatch_2050082(void)
688 {
689 const ZBX_TABLE table =
690 {"sysmap_user", "sysmapuserid", 0,
691 {
692 {"sysmapuserid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
693 {"sysmapid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
694 {"userid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
695 {"permission", "2", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
696 {0}
697 },
698 NULL
699 };
700
701 return DBcreate_table(&table);
702 }
703
DBpatch_2050083(void)704 static int DBpatch_2050083(void)
705 {
706 return DBcreate_index("sysmap_user", "sysmap_user_1", "sysmapid,userid", 1);
707 }
708
DBpatch_2050084(void)709 static int DBpatch_2050084(void)
710 {
711 const ZBX_FIELD field = {"sysmapid", NULL, "sysmaps", "sysmapid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
712
713 return DBadd_foreign_key("sysmap_user", 1, &field);
714 }
715
DBpatch_2050085(void)716 static int DBpatch_2050085(void)
717 {
718 const ZBX_FIELD field = {"userid", NULL, "users", "userid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
719
720 return DBadd_foreign_key("sysmap_user", 2, &field);
721 }
722
DBpatch_2050086(void)723 static int DBpatch_2050086(void)
724 {
725 const ZBX_TABLE table =
726 {"sysmap_usrgrp", "sysmapusrgrpid", 0,
727 {
728 {"sysmapusrgrpid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
729 {"sysmapid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
730 {"usrgrpid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
731 {"permission", "2", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
732 {0}
733 },
734 NULL
735 };
736
737 return DBcreate_table(&table);
738 }
739
DBpatch_2050087(void)740 static int DBpatch_2050087(void)
741 {
742 return DBcreate_index("sysmap_usrgrp", "sysmap_usrgrp_1", "sysmapid,usrgrpid", 1);
743 }
744
DBpatch_2050088(void)745 static int DBpatch_2050088(void)
746 {
747 const ZBX_FIELD field = {"sysmapid", NULL, "sysmaps", "sysmapid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
748
749 return DBadd_foreign_key("sysmap_usrgrp", 1, &field);
750 }
751
DBpatch_2050089(void)752 static int DBpatch_2050089(void)
753 {
754 const ZBX_FIELD field = {"usrgrpid", NULL, "usrgrp", "usrgrpid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
755
756 return DBadd_foreign_key("sysmap_usrgrp", 2, &field);
757 }
758
DBpatch_2050090(void)759 static int DBpatch_2050090(void)
760 {
761 if (ZBX_DB_OK > DBexecute("update profiles"
762 " set idx='web.triggers.filter_status',value_int=case when value_int=0 then 0 else -1 end"
763 " where idx='web.triggers.showdisabled'"))
764 {
765 return FAIL;
766 }
767
768 return SUCCEED;
769 }
770
DBpatch_2050091(void)771 static int DBpatch_2050091(void)
772 {
773 if (ZBX_DB_OK > DBexecute("update profiles"
774 " set idx='web.httpconf.filter_status',value_int=case when value_int=0 then 0 else -1 end"
775 " where idx='web.httpconf.showdisabled'"))
776 {
777 return FAIL;
778 }
779
780 return SUCCEED;
781 }
782
DBpatch_2050092(void)783 static int DBpatch_2050092(void)
784 {
785 DB_RESULT result;
786 DB_ROW row;
787 const char *end, *start;
788 int len, ret = FAIL, rc;
789 char *url = NULL, *url_esc;
790 size_t i, url_alloc = 0, url_offset;
791 const char *url_map[] = {
792 "dashboard.php", "dashboard.view",
793 "discovery.php", "discovery.view",
794 "maps.php", "map.view",
795 "httpmon.php", "web.view",
796 "media_types.php", "mediatype.list",
797 "proxies.php", "proxy.list",
798 "scripts.php", "script.list",
799 "report3.php", "report.services",
800 "report1.php", "report.status"
801 };
802
803 if (NULL == (result = DBselect("select userid,url from users where url<>''")))
804 return FAIL;
805
806 while (NULL != (row = (DBfetch(result))))
807 {
808 if (NULL == (end = strchr(row[1], '?')))
809 end = row[1] + strlen(row[1]);
810
811 for (start = end - 1; start > row[1] && '/' != start[-1]; start--)
812 ;
813
814 len = end - start;
815
816 for (i = 0; ARRSIZE(url_map) > i; i += 2)
817 {
818 if (0 == strncmp(start, url_map[i], len))
819 break;
820 }
821
822 if (ARRSIZE(url_map) == i)
823 continue;
824
825 url_offset = 0;
826 zbx_strncpy_alloc(&url, &url_alloc, &url_offset, row[1], start - row[1]);
827 zbx_strcpy_alloc(&url, &url_alloc, &url_offset, "zabbix.php?action=");
828 zbx_strcpy_alloc(&url, &url_alloc, &url_offset, url_map[i + 1]);
829
830 if ('\0' != *end)
831 {
832 zbx_chrcpy_alloc(&url, &url_alloc, &url_offset, '&');
833 zbx_strcpy_alloc(&url, &url_alloc, &url_offset, end + 1);
834 }
835
836 /* 255 - user url field size */
837 if (url_offset > 255)
838 {
839 *url = '\0';
840 zabbix_log(LOG_LEVEL_WARNING, "Cannot convert URL for user id \"%s\":"
841 " value is too long. The URL field was reset.", row[0]);
842 }
843
844 url_esc = DBdyn_escape_string(url);
845 rc = DBexecute("update users set url='%s' where userid=%s", url_esc, row[0]);
846 zbx_free(url_esc);
847
848 if (ZBX_DB_OK > rc)
849 goto out;
850 }
851
852 ret = SUCCEED;
853 out:
854 zbx_free(url);
855 DBfree_result(result);
856
857 return ret;
858 }
DBpatch_2050093(void)859 static int DBpatch_2050093(void)
860 {
861 const ZBX_FIELD field = {"userid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, 0, 0};
862
863 return DBadd_field("screens", &field);
864 }
865
DBpatch_2050094(void)866 static int DBpatch_2050094(void)
867 {
868 /* type=3 -> type=USER_TYPE_SUPER_ADMIN */
869 if (ZBX_DB_OK > DBexecute("update screens"
870 " set userid=(select min(userid) from users where type=3)"
871 " where templateid is null"))
872 {
873 return FAIL;
874 }
875
876 return SUCCEED;
877 }
878
DBpatch_2050095(void)879 static int DBpatch_2050095(void)
880 {
881 const ZBX_FIELD field = {"userid", NULL, "users", "userid", 0, 0, 0, 0};
882
883 return DBadd_foreign_key("screens", 3, &field);
884 }
885
DBpatch_2050096(void)886 static int DBpatch_2050096(void)
887 {
888 const ZBX_FIELD field = {"private", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
889
890 return DBadd_field("screens", &field);
891 }
892
DBpatch_2050097(void)893 static int DBpatch_2050097(void)
894 {
895 const ZBX_TABLE table =
896 {"screen_user", "screenuserid", 0,
897 {
898 {"screenuserid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
899 {"screenid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
900 {"userid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
901 {"permission", "2", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
902 {0}
903 },
904 NULL
905 };
906
907 return DBcreate_table(&table);
908 }
909
DBpatch_2050098(void)910 static int DBpatch_2050098(void)
911 {
912 return DBcreate_index("screen_user", "screen_user_1", "screenid,userid", 1);
913 }
914
DBpatch_2050099(void)915 static int DBpatch_2050099(void)
916 {
917 const ZBX_FIELD field = {"screenid", NULL, "screens", "screenid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
918
919 return DBadd_foreign_key("screen_user", 1, &field);
920 }
921
DBpatch_2050100(void)922 static int DBpatch_2050100(void)
923 {
924 const ZBX_FIELD field = {"userid", NULL, "users", "userid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
925
926 return DBadd_foreign_key("screen_user", 2, &field);
927 }
928
DBpatch_2050101(void)929 static int DBpatch_2050101(void)
930 {
931 const ZBX_TABLE table =
932 {"screen_usrgrp", "screenusrgrpid", 0,
933 {
934 {"screenusrgrpid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
935 {"screenid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
936 {"usrgrpid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
937 {"permission", "2", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
938 {0}
939 },
940 NULL
941 };
942
943 return DBcreate_table(&table);
944 }
945
DBpatch_2050102(void)946 static int DBpatch_2050102(void)
947 {
948 return DBcreate_index("screen_usrgrp", "screen_usrgrp_1", "screenid,usrgrpid", 1);
949 }
950
DBpatch_2050103(void)951 static int DBpatch_2050103(void)
952 {
953 const ZBX_FIELD field = {"screenid", NULL, "screens", "screenid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
954
955 return DBadd_foreign_key("screen_usrgrp", 1, &field);
956 }
957
DBpatch_2050104(void)958 static int DBpatch_2050104(void)
959 {
960 const ZBX_FIELD field = {"usrgrpid", NULL, "usrgrp", "usrgrpid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
961
962 return DBadd_foreign_key("screen_usrgrp", 2, &field);
963 }
964
DBpatch_2050105(void)965 static int DBpatch_2050105(void)
966 {
967 const ZBX_FIELD field = {"flags", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
968
969 return DBrename_field("proxy_history", "meta", &field);
970 }
971
DBpatch_2050106(void)972 static int DBpatch_2050106(void)
973 {
974 /* convert meta value (1) to PROXY_HISTORY_FLAG_META | PROXY_HISTORY_FLAG_NOVALUE (0x03) flags */
975 if (ZBX_DB_OK > DBexecute("update proxy_history set flags=3 where flags=1"))
976 {
977 return FAIL;
978 }
979
980 return SUCCEED;
981 }
982
DBpatch_2050107(void)983 static int DBpatch_2050107(void)
984 {
985 const ZBX_FIELD field = {"userid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, 0, 0};
986
987 return DBadd_field("slideshows", &field);
988 }
989
DBpatch_2050108(void)990 static int DBpatch_2050108(void)
991 {
992 /* type=3 -> type=USER_TYPE_SUPER_ADMIN */
993 if (ZBX_DB_OK > DBexecute("update slideshows set userid=(select min(userid) from users where type=3)"))
994 return FAIL;
995
996 return SUCCEED;
997 }
998
DBpatch_2050109(void)999 static int DBpatch_2050109(void)
1000 {
1001 const ZBX_FIELD field = {"userid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0};
1002
1003 return DBset_not_null("slideshows", &field);
1004 }
1005
DBpatch_2050110(void)1006 static int DBpatch_2050110(void)
1007 {
1008 const ZBX_FIELD field = {"userid", NULL, "users", "userid", 0, 0, 0, 0};
1009
1010 return DBadd_foreign_key("slideshows", 3, &field);
1011 }
1012
DBpatch_2050111(void)1013 static int DBpatch_2050111(void)
1014 {
1015 const ZBX_FIELD field = {"private", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
1016
1017 return DBadd_field("slideshows", &field);
1018 }
1019
DBpatch_2050112(void)1020 static int DBpatch_2050112(void)
1021 {
1022 const ZBX_TABLE table =
1023 {"slideshow_user", "slideshowuserid", 0,
1024 {
1025 {"slideshowuserid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
1026 {"slideshowid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
1027 {"userid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
1028 {"permission", "2", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
1029 {0}
1030 },
1031 NULL
1032 };
1033
1034 return DBcreate_table(&table);
1035 }
1036
DBpatch_2050113(void)1037 static int DBpatch_2050113(void)
1038 {
1039 return DBcreate_index("slideshow_user", "slideshow_user_1", "slideshowid,userid", 1);
1040 }
1041
DBpatch_2050114(void)1042 static int DBpatch_2050114(void)
1043 {
1044 const ZBX_FIELD field = {"slideshowid", NULL, "slideshows", "slideshowid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
1045
1046 return DBadd_foreign_key("slideshow_user", 1, &field);
1047 }
1048
DBpatch_2050115(void)1049 static int DBpatch_2050115(void)
1050 {
1051 const ZBX_FIELD field = {"userid", NULL, "users", "userid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
1052
1053 return DBadd_foreign_key("slideshow_user", 2, &field);
1054 }
1055
DBpatch_2050116(void)1056 static int DBpatch_2050116(void)
1057 {
1058 const ZBX_TABLE table =
1059 {"slideshow_usrgrp", "slideshowusrgrpid", 0,
1060 {
1061 {"slideshowusrgrpid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
1062 {"slideshowid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
1063 {"usrgrpid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
1064 {"permission", "2", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
1065 {0}
1066 },
1067 NULL
1068 };
1069
1070 return DBcreate_table(&table);
1071 }
1072
DBpatch_2050117(void)1073 static int DBpatch_2050117(void)
1074 {
1075 return DBcreate_index("slideshow_usrgrp", "slideshow_usrgrp_1", "slideshowid,usrgrpid", 1);
1076 }
1077
DBpatch_2050118(void)1078 static int DBpatch_2050118(void)
1079 {
1080 const ZBX_FIELD field = {"slideshowid", NULL, "slideshows", "slideshowid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
1081
1082 return DBadd_foreign_key("slideshow_usrgrp", 1, &field);
1083 }
1084
DBpatch_2050119(void)1085 static int DBpatch_2050119(void)
1086 {
1087 const ZBX_FIELD field = {"usrgrpid", NULL, "usrgrp", "usrgrpid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
1088
1089 return DBadd_foreign_key("slideshow_usrgrp", 2, &field);
1090 }
1091
DBpatch_2050120(void)1092 static int DBpatch_2050120(void)
1093 {
1094 /* private=0 -> PUBLIC_SHARING */
1095 if (ZBX_DB_OK <= DBexecute("update sysmaps set private=0"))
1096 return SUCCEED;
1097
1098 return FAIL;
1099 }
1100
DBpatch_2050121(void)1101 static int DBpatch_2050121(void)
1102 {
1103 /* private=0 -> PUBLIC_SHARING */
1104 if (ZBX_DB_OK <= DBexecute("update screens set private=0"))
1105 return SUCCEED;
1106
1107 return FAIL;
1108 }
1109
DBpatch_2050122(void)1110 static int DBpatch_2050122(void)
1111 {
1112 /* private=0 -> PUBLIC_SHARING */
1113 if (ZBX_DB_OK <= DBexecute("update slideshows set private=0"))
1114 return SUCCEED;
1115
1116 return FAIL;
1117 }
1118
1119 #endif
1120
1121 DBPATCH_START(2050)
1122
1123 /* version, duplicates flag, mandatory flag */
1124
1125 DBPATCH_ADD(2050000, 0, 1)
1126 DBPATCH_ADD(2050001, 0, 1)
1127 DBPATCH_ADD(2050002, 0, 1)
1128 DBPATCH_ADD(2050003, 0, 1)
1129 DBPATCH_ADD(2050004, 0, 1)
1130 DBPATCH_ADD(2050005, 0, 0)
1131 DBPATCH_ADD(2050006, 0, 0)
1132 DBPATCH_ADD(2050007, 0, 1)
1133 DBPATCH_ADD(2050008, 0, 1)
1134 DBPATCH_ADD(2050009, 0, 1)
1135 DBPATCH_ADD(2050010, 0, 1)
1136 DBPATCH_ADD(2050011, 0, 1)
1137 DBPATCH_ADD(2050012, 0, 1)
1138 DBPATCH_ADD(2050013, 0, 0)
1139 DBPATCH_ADD(2050014, 0, 1)
1140 DBPATCH_ADD(2050015, 0, 1)
1141 DBPATCH_ADD(2050019, 0, 1)
1142 DBPATCH_ADD(2050020, 0, 1)
1143 DBPATCH_ADD(2050021, 0, 1)
1144 DBPATCH_ADD(2050022, 0, 1)
1145 DBPATCH_ADD(2050023, 0, 1)
1146 DBPATCH_ADD(2050029, 0, 1)
1147 DBPATCH_ADD(2050030, 0, 1)
1148 DBPATCH_ADD(2050031, 0, 1)
1149 DBPATCH_ADD(2050032, 0, 1)
1150 DBPATCH_ADD(2050033, 0, 1)
1151 DBPATCH_ADD(2050034, 0, 1)
1152 DBPATCH_ADD(2050035, 0, 1)
1153 DBPATCH_ADD(2050036, 0, 1)
1154 DBPATCH_ADD(2050037, 0, 1)
1155 DBPATCH_ADD(2050038, 0, 1)
1156 DBPATCH_ADD(2050039, 0, 1)
1157 DBPATCH_ADD(2050040, 0, 1)
1158 DBPATCH_ADD(2050041, 0, 1)
1159 DBPATCH_ADD(2050042, 0, 1)
1160 DBPATCH_ADD(2050043, 0, 1)
1161 DBPATCH_ADD(2050044, 0, 1)
1162 DBPATCH_ADD(2050045, 0, 1)
1163 DBPATCH_ADD(2050051, 0, 1)
1164 DBPATCH_ADD(2050052, 0, 1)
1165 DBPATCH_ADD(2050053, 0, 1)
1166 DBPATCH_ADD(2050054, 0, 1)
1167 DBPATCH_ADD(2050055, 0, 1)
1168 DBPATCH_ADD(2050056, 0, 1)
1169 DBPATCH_ADD(2050057, 0, 1)
1170 DBPATCH_ADD(2050058, 0, 1)
1171 DBPATCH_ADD(2050059, 0, 1)
1172 DBPATCH_ADD(2050060, 0, 1)
1173 DBPATCH_ADD(2050061, 0, 1)
1174 DBPATCH_ADD(2050062, 0, 1)
1175 DBPATCH_ADD(2050063, 0, 1)
1176 DBPATCH_ADD(2050064, 0, 1)
1177 DBPATCH_ADD(2050065, 0, 1)
1178 DBPATCH_ADD(2050066, 0, 1)
1179 DBPATCH_ADD(2050067, 0, 1)
1180 DBPATCH_ADD(2050068, 0, 1)
1181 DBPATCH_ADD(2050069, 0, 1)
1182 DBPATCH_ADD(2050070, 0, 1)
1183 DBPATCH_ADD(2050071, 0, 1)
1184 DBPATCH_ADD(2050077, 0, 1)
1185 DBPATCH_ADD(2050078, 0, 1)
1186 DBPATCH_ADD(2050079, 0, 1)
1187 DBPATCH_ADD(2050080, 0, 1)
1188 DBPATCH_ADD(2050081, 0, 1)
1189 DBPATCH_ADD(2050082, 0, 1)
1190 DBPATCH_ADD(2050083, 0, 1)
1191 DBPATCH_ADD(2050084, 0, 1)
1192 DBPATCH_ADD(2050085, 0, 1)
1193 DBPATCH_ADD(2050086, 0, 1)
1194 DBPATCH_ADD(2050087, 0, 1)
1195 DBPATCH_ADD(2050088, 0, 1)
1196 DBPATCH_ADD(2050089, 0, 1)
1197 DBPATCH_ADD(2050090, 0, 1)
1198 DBPATCH_ADD(2050091, 0, 1)
1199 DBPATCH_ADD(2050092, 0, 1)
1200 DBPATCH_ADD(2050093, 0, 1)
1201 DBPATCH_ADD(2050094, 0, 1)
1202 DBPATCH_ADD(2050095, 0, 1)
1203 DBPATCH_ADD(2050096, 0, 1)
1204 DBPATCH_ADD(2050097, 0, 1)
1205 DBPATCH_ADD(2050098, 0, 1)
1206 DBPATCH_ADD(2050099, 0, 1)
1207 DBPATCH_ADD(2050100, 0, 1)
1208 DBPATCH_ADD(2050101, 0, 1)
1209 DBPATCH_ADD(2050102, 0, 1)
1210 DBPATCH_ADD(2050103, 0, 1)
1211 DBPATCH_ADD(2050104, 0, 1)
1212 DBPATCH_ADD(2050105, 0, 1)
1213 DBPATCH_ADD(2050106, 0, 1)
1214 DBPATCH_ADD(2050107, 0, 1)
1215 DBPATCH_ADD(2050108, 0, 1)
1216 DBPATCH_ADD(2050109, 0, 1)
1217 DBPATCH_ADD(2050110, 0, 1)
1218 DBPATCH_ADD(2050111, 0, 1)
1219 DBPATCH_ADD(2050112, 0, 1)
1220 DBPATCH_ADD(2050113, 0, 1)
1221 DBPATCH_ADD(2050114, 0, 1)
1222 DBPATCH_ADD(2050115, 0, 1)
1223 DBPATCH_ADD(2050116, 0, 1)
1224 DBPATCH_ADD(2050117, 0, 1)
1225 DBPATCH_ADD(2050118, 0, 1)
1226 DBPATCH_ADD(2050119, 0, 1)
1227 DBPATCH_ADD(2050120, 0, 1)
1228 DBPATCH_ADD(2050121, 0, 1)
1229 DBPATCH_ADD(2050122, 0, 1)
1230
1231 DBPATCH_END()
1232