Source
void zbx_function_param_parse_ext(const char *expr, zbx_uint32_t allowed_macros, int esc_bs, size_t *param_pos,
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/******************************************************************************
* *
* Return value: SUCCEED - char is allowed in trigger function *
* FAIL - otherwise *
* *
* Comments: in trigger function allowed characters: 'a-z' *
* !!! Don't forget to sync the code with PHP !!! *
* *
******************************************************************************/
int zbx_is_function_char(unsigned char c)
{
if (0 != islower(c))
return SUCCEED;
return FAIL;
}
/******************************************************************************
* *
* Purpose: validates parameters and gives position of terminator if found *
* and not quoted *
* *
* Parameters: expr - [IN] string to parse that contains parameters *
* terminator - [IN] use ')' if parameters end with *
* parenthesis or '\0' if ends with NULL *
* terminator *
* par_r - [OUT] position of the terminator if found *
* lpp_offset - [OUT] offset of the last parsed parameter *
* lpp_len - [OUT] length of the last parsed parameter *
* *
* Return value: SUCCEED - Closing parenthesis was found or other custom *
* terminator and not quoted and return info about a *
* last processed parameter. *
* FAIL - Does not look like valid function parameter list *
* and return info about a last processed parameter. *
* *
******************************************************************************/
static int function_validate_parameters(const char *expr, char terminator, size_t *par_r, size_t *lpp_offset,
size_t *lpp_len)
{