diff options
author | Andrejs Kozlovs <andrejs.kozlovs@zabbix.com> | 2022-04-01 10:44:56 +0300 |
---|---|---|
committer | Andrejs Kozlovs <andrejs.kozlovs@zabbix.com> | 2022-04-01 10:44:56 +0300 |
commit | 8dd95b2e91a7ce214102276e88bc8becc6a10db1 (patch) | |
tree | d6c19ea4980d784bea04ea48e379c953176077e3 /src/libs/zbxaudit | |
parent | d77b86a3d9112d8381719b9ed56f9c3b5a7dff8f (diff) |
........S. [ZBX-20750] reverted zbx_audit_flush_once
Diffstat (limited to 'src/libs/zbxaudit')
-rw-r--r-- | src/libs/zbxaudit/audit.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libs/zbxaudit/audit.c b/src/libs/zbxaudit/audit.c index 4d0ab49397b..b20f0fd9320 100644 --- a/src/libs/zbxaudit/audit.c +++ b/src/libs/zbxaudit/audit.c @@ -340,7 +340,7 @@ int zbx_audit_flush_once(void) while (NULL != (audit_entry = (zbx_audit_entry_t **)zbx_hashset_iter_next(&iter))) { - char id[ZBX_MAX_UINT64_LEN + 1], *pvalue, *name_esc; + char id[ZBX_MAX_UINT64_LEN + 1], *pvalue, *name_esc, *details_esc; const char *pfield; if (AUDIT_ACTION_DELETE != (*audit_entry)->audit_action && @@ -362,15 +362,16 @@ int zbx_audit_flush_once(void) } name_esc = DBdyn_escape_string((*audit_entry)->name); + details_esc = DBdyn_escape_string((*audit_entry)->details_json.buffer); ret = DBexecute_once("insert into auditlog (auditid,userid,username," "clock,action,ip,%s,resourcename,resourcetype,recordsetid,details) values" " ('%s'," AUDIT_USERID_SQL ",'%s','%d','%d','%s','%s','%s',%d,'%s','%s')", pfield, (*audit_entry)->audit_cuid, AUDIT_USERNAME, (int)time(NULL), (*audit_entry)->audit_action, AUDIT_IP, pvalue, name_esc, (*audit_entry)->resource_type, - recsetid_cuid, 0 == strcmp((*audit_entry)->details_json.buffer, "{}") ? "" : - (*audit_entry)->details_json.buffer); + recsetid_cuid, 0 == strcmp(details_esc, "{}") ? "" : details_esc); + zbx_free(details_esc); zbx_free(name_esc); if (ZBX_DB_OK > ret) |