Source
xxxxxxxxxx
static int replace_param(const char *cmd, const AGENT_REQUEST *request, char **out, char *error, int max_error_len)
/*
** 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.
**/
typedef struct
{
char *pattern;
zbx_vector_str_t elements;
zbx_key_access_rule_type_t type;
int empty_arguments;
}
zbx_key_access_rule_t;
extern ZBX_METRIC parameter_hostname;
static ZBX_METRIC *commands = NULL;
static ZBX_METRIC *commands_local = NULL;
zbx_vector_ptr_t key_access_rules;
static zbx_get_config_int_f get_config_timeout_cb = NULL;
static int compare_key_access_rules(const void *rule_a, const void *rule_b);
static int zbx_parse_key_access_rule(char *pattern, zbx_key_access_rule_t *rule);
/******************************************************************************
* *
* Purpose: parses item key and splits it into command and parameters *
* *
* Return value: ZBX_COMMAND_ERROR - error *
* ZBX_COMMAND_WITHOUT_PARAMS - command without parameters *
* ZBX_COMMAND_WITH_PARAMS - command with parameters *
* *
******************************************************************************/
static int parse_command_dyn(const char *command, char **cmd, char **param)
{