Source
static int function_validate_parameters(const char *expr, char terminator, size_t *par_r, size_t *lpp_offset,
/*
** 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.
**/
/******************************************************************************
* *
* Return value: SUCCEED - the char is allowed in the 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: validate parameters and give 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 a valid function parameter *
* list and return info about a last processed *
* parameter. *
* *
******************************************************************************/