Source
size = zbx_alerter_serialize_alert_send(&data, mediatypeid, type, row[1], row[2], row[3], row[4], row[5], row[6],
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
extern int CONFIG_FORKS[ZBX_PROCESS_TYPE_COUNT];
static void trapper_process_report_test(zbx_socket_t *sock, const struct zbx_json_parse *jp, int config_timeout)
{
zbx_user_t user;
struct zbx_json_parse jp_data;
struct zbx_json j;
if (0 == CONFIG_FORKS[ZBX_PROCESS_TYPE_REPORTMANAGER])
{
zbx_send_response(sock, FAIL, "Report manager is disabled.", config_timeout);
return;
}
zbx_user_init(&user);
if (FAIL == zbx_get_user_from_json(jp, &user, NULL))
{
zbx_send_response(sock, FAIL, "Permission denied.", config_timeout);
goto out;
}
if (SUCCEED != zbx_json_brackets_by_name(jp, ZBX_PROTO_TAG_DATA, &jp_data))
{
char *error;
error = zbx_dsprintf(NULL, "cannot find tag: %s", ZBX_PROTO_TAG_DATA);
zbx_send_response(sock, FAIL, error, config_timeout);
zbx_free(error);
goto out;
}
zbx_report_test(&jp_data, user.userid, &j);
zbx_tcp_send_bytes_to(sock, j.buffer, j.buffer_size, config_timeout);
zbx_json_clean(&j);
out:
zbx_user_free(&user);
}
/******************************************************************************
* *
* Purpose: process alert send request that is used to test media types *
* *
* Parameters: sock - [IN] the request socket *
* jp - [IN] the request data *
* *
******************************************************************************/
static void trapper_process_alert_send(zbx_socket_t *sock, const struct zbx_json_parse *jp)
{
DB_RESULT result;
DB_ROW row;
int ret = FAIL, errcode;
char tmp[ZBX_MAX_UINT64_LEN + 1], *sendto = NULL, *subject = NULL,
*message = NULL, *error = NULL, *params = NULL, *value = NULL, *debug = NULL;
zbx_uint64_t mediatypeid;
size_t string_alloc;
struct zbx_json json;
struct zbx_json_parse jp_data, jp_params;
unsigned char *data = NULL, smtp_security, smtp_verify_peer, smtp_verify_host,