Fixed JSON unbalanced braces resultin assert
This commit is contained in:
parent
697c021d49
commit
4257999df5
6 changed files with 29 additions and 20 deletions
|
|
@ -1,6 +1,10 @@
|
||||||
# Clixon Changelog
|
# Clixon Changelog
|
||||||
|
|
||||||
## 3.7.0 (Upcoming)
|
## 3.7.0 (Upcoming)
|
||||||
|
### Major changes:
|
||||||
|
### Minor changes:
|
||||||
|
### Corrected Bugs
|
||||||
|
- Fixed JSON unbalanced braces resultin assert.
|
||||||
|
|
||||||
## 3.6.0 (30 April 2018)
|
## 3.6.0 (30 April 2018)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ Background
|
||||||
==========
|
==========
|
||||||
|
|
||||||
Clixon was implemented to provide an open-source generic configuration
|
Clixon was implemented to provide an open-source generic configuration
|
||||||
tool. The existing [CLIgen](http://www.cligen.se) tool was for command-lines only, whilke clixon is a system with config-db, xml and rest interfaces. Most of the projects using clixon are for embedded network and measuring devices. But Clixon is more generic than that.
|
tool. The existing [CLIgen](http://www.cligen.se) tool was for command-lines only, while clixon is a system with configuration database, xml and rest interfaces. Most of the projects using clixon are for embedded network and measuring devices. But Clixon is more generic than that.
|
||||||
|
|
||||||
Users of clixon currently include:
|
Users of clixon currently include:
|
||||||
* [Netgate](https://www.netgate.com)
|
* [Netgate](https://www.netgate.com)
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,8 @@ static struct errvec EV[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
clicon_strerror1(int err, struct errvec vec[])
|
clicon_strerror1(int err,
|
||||||
|
struct errvec vec[])
|
||||||
{
|
{
|
||||||
struct errvec *ev;
|
struct errvec *ev;
|
||||||
|
|
||||||
|
|
@ -142,10 +143,10 @@ clicon_err_reset(void)
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
clicon_err_fn(const char *fn,
|
clicon_err_fn(const char *fn,
|
||||||
const int line,
|
const int line,
|
||||||
int category,
|
int category,
|
||||||
int suberr,
|
int suberr,
|
||||||
char *reason, ...)
|
char *reason, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
int len;
|
int len;
|
||||||
|
|
|
||||||
|
|
@ -792,7 +792,8 @@ usage(char *argv0)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc,
|
||||||
|
char **argv)
|
||||||
{
|
{
|
||||||
cxobj *xt;
|
cxobj *xt;
|
||||||
cxobj *xc;
|
cxobj *xc;
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ object.
|
||||||
/* typecast macro */
|
/* typecast macro */
|
||||||
#define _JY ((struct clicon_json_yacc_arg *)_jy)
|
#define _JY ((struct clicon_json_yacc_arg *)_jy)
|
||||||
|
|
||||||
#define _YYERROR(msg) {clicon_debug(2, "YYERROR %s '%s' %d", (msg), clixon_json_parsetext, _JY->jy_linenum); YYERROR;}
|
#define _YYERROR(msg) {clicon_err(OE_XML, 0, "YYERROR %s '%s' %d", (msg), clixon_json_parsetext, _JY->jy_linenum); YYERROR;}
|
||||||
|
|
||||||
/* add _yy to error paramaters */
|
/* add _yy to error paramaters */
|
||||||
#define YY_(msgid) msgid
|
#define YY_(msgid) msgid
|
||||||
|
|
@ -139,7 +139,8 @@ extern int clixon_json_parseget_lineno (void);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
clixon_json_parseerror(void *_jy, char *s)
|
clixon_json_parseerror(void *_jy,
|
||||||
|
char *s)
|
||||||
{
|
{
|
||||||
clicon_err(OE_XML, 0, "%s on line %d: %s at or before: '%s'",
|
clicon_err(OE_XML, 0, "%s on line %d: %s at or before: '%s'",
|
||||||
_JY->jy_name,
|
_JY->jy_name,
|
||||||
|
|
@ -192,7 +193,10 @@ json_current_clone(struct clicon_json_yacc_arg *jy)
|
||||||
{
|
{
|
||||||
cxobj *xn;
|
cxobj *xn;
|
||||||
|
|
||||||
assert(xn = jy->jy_current);
|
if (jy->jy_current == NULL){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
xn = jy->jy_current;
|
||||||
json_current_pop(jy);
|
json_current_pop(jy);
|
||||||
if (jy->jy_current)
|
if (jy->jy_current)
|
||||||
json_current_new(jy, xml_name(xn));
|
json_current_new(jy, xml_name(xn));
|
||||||
|
|
@ -258,7 +262,7 @@ array : '[' ']'
|
||||||
;
|
;
|
||||||
|
|
||||||
valuelist : value
|
valuelist : value
|
||||||
| valuelist { json_current_clone(_JY);} ',' value
|
| valuelist { if (json_current_clone(_JY)< 0) _YYERROR("stack?");} ',' value
|
||||||
;
|
;
|
||||||
|
|
||||||
/* quoted string */
|
/* quoted string */
|
||||||
|
|
|
||||||
|
|
@ -157,13 +157,12 @@ slogtime(void)
|
||||||
|
|
||||||
|
|
||||||
/*! Make a logging call to syslog (or stderr).
|
/*! Make a logging call to syslog (or stderr).
|
||||||
*
|
|
||||||
* This is the _only_ place the actual syslog (or stderr) logging is made in clicon,..
|
|
||||||
* @note syslog makes itw own filtering, but if log to stderr we do it here
|
|
||||||
* @see clicon_debug()
|
|
||||||
*
|
*
|
||||||
* @param[in] level log level, eg LOG_DEBUG,LOG_INFO,...,LOG_EMERG. Thisis OR:d with facility == LOG_USER
|
* @param[in] level log level, eg LOG_DEBUG,LOG_INFO,...,LOG_EMERG. Thisis OR:d with facility == LOG_USER
|
||||||
* @param[in] msg Message to print as argv.
|
* @param[in] msg Message to print as argv.
|
||||||
|
* This is the _only_ place the actual syslog (or stderr) logging is made in clicon,..
|
||||||
|
* @note syslog makes itw own filtering, but if log to stderr we do it here
|
||||||
|
* @see clicon_debug
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
clicon_log_str(int level,
|
clicon_log_str(int level,
|
||||||
|
|
@ -214,13 +213,13 @@ clicon_log_str(int level,
|
||||||
|
|
||||||
/*! Make a logging call to syslog using variable arg syntax.
|
/*! Make a logging call to syslog using variable arg syntax.
|
||||||
*
|
*
|
||||||
* See also clicon_log_init() and clicon_log_str()
|
* @param[in] level log level, eg LOG_DEBUG,LOG_INFO,...,LOG_EMERG. This
|
||||||
*
|
* is OR:d with facility == LOG_USER
|
||||||
|
* @param[in] format Message to print as argv.
|
||||||
* @code
|
* @code
|
||||||
clicon_log(LOG_NOTICE, "%s: dump to dtd not supported", __PROGRAM__);
|
clicon_log(LOG_NOTICE, "%s: dump to dtd not supported", __PROGRAM__);
|
||||||
* @endcode
|
* @endcode
|
||||||
* @param[in] level log level, eg LOG_DEBUG,LOG_INFO,...,LOG_EMERG. Thisis OR:d with facility == LOG_USER
|
* @see cicon_log_init and clicon_log_str
|
||||||
* @param[in] format Message to print as argv.
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
clicon_log(int level,
|
clicon_log(int level,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue