Fixed: [Using YANG union with decimal64 and string leads to regexp match fail #226](https://github.com/clicon/clixon/issues/226)

This commit is contained in:
Olof hagsand 2021-05-24 21:05:06 +02:00
parent d3b614e67d
commit 60c9172d21
3 changed files with 24 additions and 14 deletions

View file

@ -78,6 +78,7 @@ Users may have to change how they access the system
### Corrected Bugs ### Corrected Bugs
* Fixed: [Using YANG union with decimal64 and string leads to regexp match fail #226](https://github.com/clicon/clixon/issues/226)
* Fixed: [xpath function count did not work properly #224](https://github.com/clicon/clixon/issues/224) * Fixed: [xpath function count did not work properly #224](https://github.com/clicon/clixon/issues/224)
* Fixed: RESTCONF Native: Failed binding of socket in network namespace caused process zombie * Fixed: RESTCONF Native: Failed binding of socket in network namespace caused process zombie
* Fixed problems with XPATH composite operations and functions in netconf get/get-config operations. * Fixed problems with XPATH composite operations and functions in netconf get/get-config operations.

View file

@ -743,7 +743,12 @@ static int ys_cv_validate_union(clicon_handle h,yang_stmt *ys, char **reason,
yang_stmt *yrestype, char *type, char *val, yang_stmt **ysubp); yang_stmt *yrestype, char *type, char *val, yang_stmt **ysubp);
/*! /*!
* @param[out] reason If given and return val is 0, contains a malloced string * @param[in] h Clixon handle
* @param[in] ys Yang statement (union)
* @param[out] reason If given, and return value is 0, contains malloced string
* param[in] yt One of the types in the union
* param[in] type Original type
* @param[in] val Value to match
* @retval -1 Error (fatal), with errno set to indicate error * @retval -1 Error (fatal), with errno set to indicate error
* @retval 0 Validation not OK, malloced reason is returned. Free reason with free() * @retval 0 Validation not OK, malloced reason is returned. Free reason with free()
* @retval 1 Validation OK * @retval 1 Validation OK
@ -792,6 +797,8 @@ ys_cv_validate_union_one(clicon_handle h,
clicon_err(OE_UNIX, errno, "cv_new"); clicon_err(OE_UNIX, errno, "cv_new");
goto done; goto done;
} }
if (cvtype == CGV_DEC64)
cv_dec64_n_set(cvt, fraction);
if (val == NULL){ /* Fail validation on NULL */ if (val == NULL){ /* Fail validation on NULL */
retval = 0; retval = 0;
goto done; goto done;
@ -831,6 +838,8 @@ ys_cv_validate_union_one(clicon_handle h,
* @param[in] h Clixon handle * @param[in] h Clixon handle
* @param[in] ys Yang statement (union) * @param[in] ys Yang statement (union)
* @param[out] reason If given, and return value is 0, contains malloced string * @param[out] reason If given, and return value is 0, contains malloced string
* param[in] yrestype Resolved Yang type
* param[in] type Original type
* @param[in] val Value to match * @param[in] val Value to match
* @param[out] ysubp Sub-type of ys that matches val * @param[out] ysubp Sub-type of ys that matches val
* @retval -1 Error (fatal), with errno set to indicate error * @retval -1 Error (fatal), with errno set to indicate error
@ -842,7 +851,7 @@ ys_cv_validate_union(clicon_handle h,
yang_stmt *ys, yang_stmt *ys,
char **reason, char **reason,
yang_stmt *yrestype, yang_stmt *yrestype,
char *type, /* orig type */ char *type,
char *val, char *val,
yang_stmt **ysubp) yang_stmt **ysubp)
{ {