From 5473e60ab6c11be670e9e4812dcb042c893cbf6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kubern=C3=A1t?= Date: Fri, 31 Jan 2020 17:50:40 +0100 Subject: [PATCH 001/134] Change Value::dec64 to also return fraction digits --- swig/cpp/src/Tree_Data.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/swig/cpp/src/Tree_Data.hpp b/swig/cpp/src/Tree_Data.hpp index f33fd0d28..0dd60d762 100644 --- a/swig/cpp/src/Tree_Data.hpp +++ b/swig/cpp/src/Tree_Data.hpp @@ -37,6 +37,12 @@ namespace libyang { * Class wrappers for data structures and functions to manipulate and access instance data tree. */ +struct Decimal64 +{ + int64_t value; + uint8_t digits; +}; + /** * @brief class for wrapping [lyd_val](@ref lyd_val). * @class Value @@ -54,7 +60,7 @@ class Value /** get bln variable from [lyd_val](@ref lyd_val)*/ int8_t bln() {return LY_TYPE_BOOL == value_type ? value.bln : throw "wrong type";}; /** get dec64 variable from [lyd_val](@ref lyd_val)*/ - int64_t dec64() {return LY_TYPE_DEC64 == value_type ? value.dec64 : throw "wrong type";}; + Decimal64 dec64() {return LY_TYPE_DEC64 == value_type ? Decimal64{ value.dec64, type->info.dec64.dig } : throw "wrong type";}; /** get enm variable from [lyd_val](@ref lyd_val)*/ S_Type_Enum enm() {return LY_TYPE_ENUM == value_type ? std::make_shared(value.enm, deleter) : throw "wrong type";}; /** get ident variable from [lyd_val](@ref lyd_val)*/ From 0dc1b7ba33b55edecd786d667c2a32d9808e053f Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 3 Feb 2020 10:47:40 +0100 Subject: [PATCH 002/134] yanglint CHANGE add better examples for info printer Refs #1003 --- tools/lint/examples/README.md | 96 ++++++++++++++++++++++++++++++----- 1 file changed, 84 insertions(+), 12 deletions(-) diff --git a/tools/lint/examples/README.md b/tools/lint/examples/README.md index fd094417c..735acb4e2 100644 --- a/tools/lint/examples/README.md +++ b/tools/lint/examples/README.md @@ -468,27 +468,99 @@ Data: container "nacm" **Print information about specific model part** -Command and its output: +Print information about a node: ``` -> print -f info -P /ietf-netconf-acm:nacm/ietf-netconf-acm:enable-nacm ietf-netconf-ac -Leaf: enable-nacm +> print -f info -P /ietf-netconf-acm:nacm/denied-operations ietf-netconf-acm +Leaf: denied-operations Module: ietf-netconf-acm -Desc: Enables or disables all NETCONF access control - enforcement. If 'true', then enforcement - is enabled. If 'false', then enforcement - is disabled. +Desc: Number of times since the server last restarted that a + protocol operation request was denied. Reference: -Config: read-write +Config: read-only Status: current -Mandatory: no -Type: boolean +Mandatory: yes +Type: zero-based-counter32 Units: -Default: true +Default: If-feats: When: Must: -NACM: default-deny-all +``` +Print detailed information about its type `zero-based-counter32`: +``` +> print -f info -P type/ietf-netconf-acm:nacm/denied-operations ietf-netconf-acm +Base type: uint32 +Range: +Superior: ietf-yang-types:zero-based-counter32 +``` +Print information about the typedef `zero-based-counter32` it was derived from: +``` +> print -f info -P typedef/zero-based-counter32 ietf-yang-types +Typedef: zero-based-counter32 +Module: ietf-yang-types +Desc: The zero-based-counter32 type represents a counter32 + that has the defined 'initial' value zero. + + A schema node of this type will be set to zero (0) on creation + and will thereafter increase monotonically until it reaches + a maximum value of 2^32-1 (4294967295 decimal), when it + wraps around and starts increasing again from zero. + + Provided that an application discovers a new schema node + of this type within the minimum time to wrap, it can use the + 'initial' value as a delta. It is important for a management + station to be aware of this minimum time and the actual time + between polls, and to discard data if the actual time is too + long or there is no defined minimum time. + + In the value set and its semantics, this type is equivalent + to the ZeroBasedCounter32 textual convention of the SMIv2. +Reference: RFC 4502: Remote Network Monitoring Management Information + Base Version 2 +Status: current +Base type: uint32 +Range: +Superior: counter32 +Units: +Default: 0 +``` +Finally, print information about the typedef `counter32` the other typedef `zero-based-counter32` was derived from: +``` +> print -f info -P typedef/counter32 ietf-yang-types +Typedef: counter32 +Module: ietf-yang-types +Desc: The counter32 type represents a non-negative integer + that monotonically increases until it reaches a + maximum value of 2^32-1 (4294967295 decimal), when it + wraps around and starts increasing again from zero. + + Counters have no defined 'initial' value, and thus, a + single value of a counter has (in general) no information + content. Discontinuities in the monotonically increasing + value normally occur at re-initialization of the + management system, and at other times as specified in the + description of a schema node using this type. If such + other times can occur, for example, the creation of + a schema node of type counter32 at times other than + re-initialization, then a corresponding schema node + should be defined, with an appropriate type, to indicate + the last discontinuity. + + The counter32 type should not be used for configuration + schema nodes. A default statement SHOULD NOT be used in + combination with the type counter32. + + In the value set and its semantics, this type is equivalent + to the Counter32 type of the SMIv2. +Reference: RFC 2578: Structure of Management Information Version 2 + (SMIv2) +Status: current +Base type: uint32 +Range: +Superior: uint32 +Units: +Default: ``` ## Query using NETCONF data From 8d735b983517a67565d4aea06c3a93b693cb71d4 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 4 Feb 2020 15:57:34 +0100 Subject: [PATCH 003/134] data tree CHANGE merging default nodes Now a use-case when the target tree does not have all the defaults created and LYD_OPT_EXPLICIT is used is supported. --- src/tree_data.c | 22 ++++----- tests/api/test_tree_data_merge.c | 81 +++++++++++++++++++++++++++++++- 2 files changed, 88 insertions(+), 15 deletions(-) diff --git a/src/tree_data.c b/src/tree_data.c index 044bb1f93..20ad5c1b5 100644 --- a/src/tree_data.c +++ b/src/tree_data.c @@ -2437,7 +2437,7 @@ lyd_get_schema_inctx(const struct lyd_node *node, struct ly_ctx *ctx) /* both target and source were validated */ static void -lyd_merge_node_update(struct lyd_node *target, struct lyd_node *source) +lyd_merge_node_update(struct lyd_node *target, struct lyd_node *source, int options) { struct ly_ctx *ctx; struct lyd_node_leaf_list *trg_leaf, *src_leaf; @@ -2447,6 +2447,11 @@ lyd_merge_node_update(struct lyd_node *target, struct lyd_node *source) assert(target->schema->nodetype & (LYS_LEAF | LYS_ANYDATA)); ctx = target->schema->module->ctx; + if (source->dflt && (options & LYD_OPT_EXPLICIT)) { + /* keep the target node whatever it is */ + return; + } + if (ctx == source->schema->module->ctx) { /* source and targets are in the same context */ if (target->schema->nodetype == LYS_LEAF) { @@ -2702,16 +2707,6 @@ lyd_merge_parent_children(struct lyd_node *target, struct lyd_node *source, int src_elem; src_elem = src_next) { - /* it won't get inserted in this case */ - if (src_elem->dflt && (options & LYD_OPT_EXPLICIT)) { - if (src_elem == src) { - /* we are done with this subtree in this case */ - break; - } - trg_child = (struct lyd_node *)1; - goto src_skip; - } - ret = 0; #ifdef LY_ENABLED_CACHE @@ -2769,7 +2764,7 @@ lyd_merge_parent_children(struct lyd_node *target, struct lyd_node *source, int if (ret > 0) { if (trg_child->schema->nodetype & (LYS_LEAF | LYS_ANYDATA)) { - lyd_merge_node_update(trg_child, src_elem); + lyd_merge_node_update(trg_child, src_elem, options); } else if (ret == 2) { clear_flag = 1; } @@ -2788,7 +2783,6 @@ lyd_merge_parent_children(struct lyd_node *target, struct lyd_node *source, int src_next = src_elem->child; trg_parent = trg_child; } else { -src_skip: /* no children (or the whole subtree will be inserted), try siblings */ if (src_elem == src) { /* we are done with this subtree */ @@ -2883,7 +2877,7 @@ lyd_merge_siblings(struct lyd_node *target, struct lyd_node *source, int options case LYS_LEAF: case LYS_ANYXML: case LYS_ANYDATA: - lyd_merge_node_update(trg, src); + lyd_merge_node_update(trg, src, options); break; case LYS_LEAFLIST: /* it's already there, nothing to do */ diff --git a/tests/api/test_tree_data_merge.c b/tests/api/test_tree_data_merge.c index 7eaf56a93..8893d5e22 100644 --- a/tests/api/test_tree_data_merge.c +++ b/tests/api/test_tree_data_merge.c @@ -379,6 +379,85 @@ test_merge5(void **state) free(printed); } +static void +test_merge6(void **state) +{ + struct state *st = (*state); + const char *sch = + "module merge {" + "namespace \"http://test/merge\";" + "prefix merge;" + + "container inner1 {" + "list b-list1 {" + "key p1;" + "leaf p1 {" + "type uint8;" + "}" + "leaf p2 {" + "type string;" + "}" + "container inner2 {" + "leaf p3 {" + "type boolean;" + "default false;" + "}" + "leaf p4 {" + "type string;" + "}" + "}" + "}" + "}" + "}"; + + + const char *trg = + "" + "" + "1" + "a" + "" + "val" + "" + "" + ""; + const char *src = + "" + "" + "1" + "b" + "" + ""; + const char *result = + "" + "" + "1" + "b" + "" + "val" + "" + "" + ""; + char *printed = NULL; + + assert_ptr_not_equal(lys_parse_mem(st->ctx1, sch, LYS_IN_YANG), NULL); + + st->source = lyd_parse_mem(st->ctx1, src, LYD_XML, LYD_OPT_CONFIG); + assert_ptr_not_equal(st->source, NULL); + + st->target = lyd_parse_mem(st->ctx1, trg, LYD_XML, LYD_OPT_CONFIG); + assert_ptr_not_equal(st->target, NULL); + + /* merge them */ + assert_int_equal(lyd_merge(st->target, st->source, LYD_OPT_EXPLICIT), 0); + assert_int_equal(lyd_validate(&st->target, LYD_OPT_CONFIG, NULL), 0); + + /* check the result */ + lyd_print_mem(&printed, st->target, LYD_XML, LYP_WITHSIBLINGS); + assert_string_equal(printed, result); + free(printed); +} + static void test_merge_dflt1(void **state) { @@ -653,7 +732,6 @@ test_merge_leafrefs(void **state) free(prt); } - int main(void) { @@ -663,6 +741,7 @@ main(void) cmocka_unit_test_setup_teardown(test_merge3, setup_dflt, teardown_dflt), cmocka_unit_test_setup_teardown(test_merge4, setup_dflt, teardown_dflt), cmocka_unit_test_setup_teardown(test_merge5, setup_dflt, teardown_dflt), + cmocka_unit_test_setup_teardown(test_merge6, setup_dflt, teardown_dflt), cmocka_unit_test_setup_teardown(test_merge_dflt1, setup_dflt, teardown_dflt), cmocka_unit_test_setup_teardown(test_merge_dflt2, setup_dflt, teardown_dflt), cmocka_unit_test_setup_teardown(test_merge_to_trgctx1, setup_mctx, teardown_mctx), From 688c5519cbef17e6cd53502682f4e8662af8c535 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 4 Feb 2020 15:58:52 +0100 Subject: [PATCH 004/134] SOVERSION bump to version 1.6.8 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 58100c1e7..fa1309a92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 7) +set(LIBYANG_MICRO_SOVERSION 8) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From cecb048feb5a021e6ca267e3efa3da56efee6bc3 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 4 Feb 2020 15:59:01 +0100 Subject: [PATCH 005/134] VERSION bump to version 1.0.131 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa1309a92..77e832823 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 130) +set(LIBYANG_MICRO_VERSION 131) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 015ee6cf7f7b860496f60e74309649d2d64954d0 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 14 Feb 2020 14:37:25 +0100 Subject: [PATCH 006/134] xml parser CHANGE skip unknown default attribute It is not needed to be parsed anyway. --- src/parser_xml.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/parser_xml.c b/src/parser_xml.c index ccf9a778a..46b7c1e4f 100644 --- a/src/parser_xml.c +++ b/src/parser_xml.c @@ -339,6 +339,11 @@ xml_parse_data(struct ly_ctx *ctx, struct lyxml_elem *xml, struct lyd_node *pare goto unlink_node_error; } else if (r == 1) { attr_error: + if (!strcmp(attr->name, "default") && !strcmp(attr->ns->value, "urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults")) { + /* we do not need to parse this attribute, just skip it */ + continue; + } + if (options & LYD_OPT_STRICT) { LOGVAL(ctx, LYE_INATTR, LY_VLOG_LYD, *result, attr->name); goto unlink_node_error; From 69af46e69a24e0b4aa4454a3da9115d267ec207a Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 14 Feb 2020 14:37:58 +0100 Subject: [PATCH 007/134] SOVERSION bump to version 1.6.9 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 77e832823..e4decd799 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 8) +set(LIBYANG_MICRO_SOVERSION 9) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 559625d8f6e7e5090b6de6c16307833ffabd32c9 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 14 Feb 2020 14:38:07 +0100 Subject: [PATCH 008/134] VERSION bump to version 1.0.132 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4decd799..d7297d075 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 131) +set(LIBYANG_MICRO_VERSION 132) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 36b72997cf45d2c7e73af79c6eb6bcbe99066265 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 25 Feb 2020 12:12:47 +0100 Subject: [PATCH 009/134] xml BUGFIX support for forward ns declarations Fixes cesnet/netopeer2#565 --- src/xml.c | 22 ++++++++++++++++++++++ src/xml.h | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/xml.c b/src/xml.c index 72ea976a9..8b05bc345 100644 --- a/src/xml.c +++ b/src/xml.c @@ -357,6 +357,9 @@ lyxml_free_attr(struct ly_ctx *ctx, struct lyxml_elem *parent, struct lyxml_attr } lydict_remove(ctx, attr->name); lydict_remove(ctx, attr->value); + if (attr->type == LYXML_ATTR_STD_UNRES) { + free((char *)attr->ns); + } free(attr); } @@ -374,6 +377,9 @@ lyxml_free_attrs(struct ly_ctx *ctx, struct lyxml_elem *elem) lydict_remove(ctx, a->name); lydict_remove(ctx, a->value); + if (a->type == LYXML_ATTR_STD_UNRES) { + free((char *)a->ns); + } free(a); a = next; @@ -809,6 +815,12 @@ parse_attr(struct ly_ctx *ctx, const char *data, unsigned int *len, struct lyxml memcpy(prefix, data, c - data); prefix[c - data] = '\0'; attr->ns = lyxml_get_ns(parent, prefix); + if (!attr->ns) { + /* remember the prefix for later resolution */ + attr->type = LYXML_ATTR_STD_UNRES; + attr->ns = (struct lyxml_ns *)prefix; + prefix = NULL; + } } else if (((*c == 'm') && (xml_flag == 1)) || ((*c == 'l') && (xml_flag == 2))) { ++xml_flag; @@ -1141,6 +1153,16 @@ lyxml_parse_elem(struct ly_ctx *ctx, const char *data, unsigned int *len, struct goto error; } + /* resolve all attribute prefixes */ + LY_TREE_FOR(elem->attr, attr) { + if (attr->type == LYXML_ATTR_STD_UNRES) { + str = (char *)attr->ns; + attr->ns = lyxml_get_ns(elem, str); + free(str); + attr->type = LYXML_ATTR_STD; + } + } + if (!elem->ns && !nons_flag && parent) { elem->ns = lyxml_get_ns(parent, prefix_len ? prefix : NULL); } diff --git a/src/xml.h b/src/xml.h index e6c7bab05..ffb9e093c 100644 --- a/src/xml.h +++ b/src/xml.h @@ -44,7 +44,8 @@ struct ly_ctx; */ typedef enum lyxml_attr_type { LYXML_ATTR_STD = 1, /**< standard XML attribute */ - LYXML_ATTR_NS = 2 /**< XML namespace definition */ + LYXML_ATTR_NS = 2, /**< XML namespace definition */ + LYXML_ATTR_STD_UNRES = 3 /**< standard XML attribute with unresolved namespace, its ns attribute is actually prefix */ } LYXML_ATTR_TYPE; /** From df8b923b217091ec4965417f8199846a13cda43e Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 25 Feb 2020 12:13:37 +0100 Subject: [PATCH 010/134] SOVERSION bump to version 1.6.10 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7297d075..4df1a4b38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 9) +set(LIBYANG_MICRO_SOVERSION 10) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 1afa08deb787984b5c799c1630b7d3c64339670f Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 25 Feb 2020 12:13:47 +0100 Subject: [PATCH 011/134] VERSION bump to version 1.0.133 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4df1a4b38..8bac83b52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 132) +set(LIBYANG_MICRO_VERSION 133) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 436d13fab0206a929d055ccf54a2f1fffae90602 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 25 Feb 2020 14:31:00 +0100 Subject: [PATCH 012/134] xpath BUGFIX deref() on leaf with ext depedenency These leaves cannot store their target directly in the value so xpath must find them on its own. Fixes #1020 --- src/resolve.c | 13 ++----------- src/resolve.h | 13 +++++++++++++ src/xpath.c | 18 ++++++++++++------ 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/resolve.c b/src/resolve.c index b327f50b7..586a3b481 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -7866,16 +7866,7 @@ check_instid_ext_dep(const struct lys_node *sleaf, const char *json_instid) return 0; } -/** - * @brief Resolve instance-identifier in JSON data format. Logs directly. - * - * @param[in] data Data node where the path is used - * @param[in] path Instance-identifier node value. - * @param[in,out] ret Resolved instance or NULL. - * - * @return 0 on success (even if unresolved and \p ret is NULL), -1 on error. - */ -static int +int resolve_instid(struct lyd_node *data, const char *path, int req_inst, struct lyd_node **ret) { int i = 0, j, parsed, cur_idx; @@ -8002,7 +7993,7 @@ resolve_instid(struct lyd_node *data, const char *path, int req_inst, struct lyd return -1; } -static int +int resolve_leafref(struct lyd_node_leaf_list *leaf, const char *path, int req_inst, struct lyd_node **ret) { struct lyxp_set xp_set; diff --git a/src/resolve.h b/src/resolve.h index 01ba7a505..cbd4f07c3 100644 --- a/src/resolve.h +++ b/src/resolve.h @@ -233,6 +233,19 @@ int unres_schema_find(struct unres_schema *unres, int start_on_backwards, void * void unres_schema_free(struct lys_module *module, struct unres_schema **unres, int all); +/** + * @brief Resolve instance-identifier in JSON data format. Logs directly. + * + * @param[in] data Data node where the path is used + * @param[in] path Instance-identifier node value. + * @param[in,out] ret Resolved instance or NULL. + * + * @return 0 on success (even if unresolved and \p ret is NULL), -1 on error. + */ +int resolve_instid(struct lyd_node *data, const char *path, int req_inst, struct lyd_node **ret); + +int resolve_leafref(struct lyd_node_leaf_list *leaf, const char *path, int req_inst, struct lyd_node **ret); + int resolve_union(struct lyd_node_leaf_list *leaf, struct lys_type *type, int store, int ignore_fail, struct lys_type **resolved_type); diff --git a/src/xpath.c b/src/xpath.c index 6dfa896bd..c3893227d 100644 --- a/src/xpath.c +++ b/src/xpath.c @@ -3615,6 +3615,7 @@ xpath_deref(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyd_node { struct lyd_node_leaf_list *leaf; struct lys_node_leaf *sleaf; + struct lyd_node *target; int ret = EXIT_SUCCESS; if (options & LYXP_SNODE_ALL) { @@ -3649,13 +3650,18 @@ xpath_deref(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyd_node if ((sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST)) && ((sleaf->type.base == LY_TYPE_LEAFREF) || (sleaf->type.base == LY_TYPE_INST))) { if (leaf->value_flags & LY_VALUE_UNRES) { - /* this is bad */ - LOGVAL(local_mod->ctx, LYE_SPEC, LY_VLOG_LYD, args[0]->val.nodes[0].node, - "Trying to dereference an unresolved leafref or instance-identifier."); - return -1; + /* this means that the target may exist except it cannot be stored in the value */ + if (sleaf->type.base == LY_TYPE_LEAFREF) { + resolve_leafref(leaf, sleaf->type.info.lref.path, -1, &target); + } else { + resolve_instid((struct lyd_node *)leaf, leaf->value_str, -1, &target); + } + } else { + /* works for both leafref and instid */ + target = leaf->value.leafref; } - /* works for both leafref and instid */ - set_insert_node(set, leaf->value.leafref, 0, LYXP_NODE_ELEM, 0); + + set_insert_node(set, target, 0, LYXP_NODE_ELEM, 0); } } From af7644a480dd8006a26d3efa565e28dfa32b18b0 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 25 Feb 2020 14:32:32 +0100 Subject: [PATCH 013/134] SOVERSION bump to version 1.6.11 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8bac83b52..5bd182d3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 10) +set(LIBYANG_MICRO_SOVERSION 11) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 3644c52b14911a699b0e500a250c5a16e8e0e087 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 25 Feb 2020 14:32:40 +0100 Subject: [PATCH 014/134] VERSION bump to version 1.0.134 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bd182d3b..14a8836cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 133) +set(LIBYANG_MICRO_VERSION 134) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 0abb1bc3f95876f82625e8a0aadd973ee4a58db5 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 25 Feb 2020 15:47:10 +0100 Subject: [PATCH 015/134] parse CHANGE always check value validity Meaning restrictions of the value that do not depend on other nodes, check this even with the trusted flag. Refs sysrepo/sysrepo#1833 --- src/parser.c | 39 +++++++++++++++++++-------------------- src/parser.h | 4 ++-- src/parser_json.c | 5 ++--- src/parser_lyb.c | 2 +- src/parser_xml.c | 8 ++++---- src/resolve.c | 10 +++++----- src/tree_data.c | 24 ++++++++++++------------ 7 files changed, 45 insertions(+), 47 deletions(-) diff --git a/src/parser.c b/src/parser.c index 7298b801b..5d2e01a94 100755 --- a/src/parser.c +++ b/src/parser.c @@ -1204,12 +1204,11 @@ ident_val_add_module_prefix(const char *value, const struct lyxml_elem *xml, str * local_mod - optional if the local module dos not match the module of leaf/attr * store - flag for union resolution - we do not want to store the result, we are just learning the type * dflt - whether the value is a default value from the schema - * trusted - whether the value is trusted to be valid (but may not be canonical, so it is canonized) */ struct lys_type * lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *xml, struct lyd_node_leaf_list *leaf, struct lyd_attr *attr, struct lys_module *local_mod, - int store, int dflt, int trusted) + int store, int dflt) { struct lys_type *ret = NULL, *t; struct lys_tpdf *tpdf; @@ -1310,7 +1309,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x /* length of the encoded string */ len = ((unum / 4) * 3) - found; - if (!trusted && validate_length_range(0, len, 0, 0, 0, type, value, contextnode)) { + if (validate_length_range(0, len, 0, 0, 0, type, value, contextnode)) { goto error; } @@ -1372,7 +1371,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x for (found = i = 0; i < type->info.bits.count; i++) { if (!strncmp(type->info.bits.bit[i].name, &value[c], len) && !type->info.bits.bit[i].name[len]) { /* we have match, check if the value is enabled ... */ - for (j = 0; !trusted && (j < type->info.bits.bit[i].iffeature_size); j++) { + for (j = 0; j < type->info.bits.bit[i].iffeature_size; j++) { if (!resolve_iffeature(&type->info.bits.bit[i].iffeature[j])) { if (leaf) { LOGVAL(ctx, LYE_INVAL, LY_VLOG_LYD, contextnode, value, itemname); @@ -1477,7 +1476,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x goto error; } - if (!trusted && validate_length_range(2, 0, 0, num, type->info.dec64.dig, type, value, contextnode)) { + if (validate_length_range(2, 0, 0, num, type->info.dec64.dig, type, value, contextnode)) { goto error; } @@ -1517,7 +1516,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x for (i = found = 0; i < type->info.enums.count; i++) { if (value && !strcmp(value, type->info.enums.enm[i].name)) { /* we have match, check if the value is enabled ... */ - for (j = 0; !trusted && (j < type->info.enums.enm[i].iffeature_size); j++) { + for (j = 0; j < type->info.enums.enm[i].iffeature_size; j++) { if (!resolve_iffeature(&type->info.enums.enm[i].iffeature[j])) { if (leaf) { LOGVAL(ctx, LYE_INVAL, LY_VLOG_LYD, contextnode, value, itemname); @@ -1708,7 +1707,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x /* it is called not only to get the final type, but mainly to update value to canonical or JSON form * if needed */ - t = lyp_parse_value(&type->info.lref.target->type, value_, xml, leaf, attr, NULL, store, dflt, trusted); + t = lyp_parse_value(&type->info.lref.target->type, value_, xml, leaf, attr, NULL, store, dflt); value = *value_; /* refresh possibly changed value */ if (!t) { /* already logged */ @@ -1724,11 +1723,11 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x break; case LY_TYPE_STRING: - if (!trusted && validate_length_range(0, (value ? ly_strlen_utf8(value) : 0), 0, 0, 0, type, value, contextnode)) { + if (validate_length_range(0, (value ? ly_strlen_utf8(value) : 0), 0, 0, 0, type, value, contextnode)) { goto error; } - if (!trusted && validate_pattern(ctx, value, type, contextnode)) { + if (validate_pattern(ctx, value, type, contextnode)) { goto error; } @@ -1765,7 +1764,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x case LY_TYPE_INT8: if (parse_int(value, __INT64_C(-128), __INT64_C(127), dflt ? 0 : 10, &num, contextnode) - || (!trusted && validate_length_range(1, 0, num, 0, 0, type, value, contextnode))) { + || validate_length_range(1, 0, num, 0, 0, type, value, contextnode)) { goto error; } @@ -1782,7 +1781,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x case LY_TYPE_INT16: if (parse_int(value, __INT64_C(-32768), __INT64_C(32767), dflt ? 0 : 10, &num, contextnode) - || (!trusted && validate_length_range(1, 0, num, 0, 0, type, value, contextnode))) { + || validate_length_range(1, 0, num, 0, 0, type, value, contextnode)) { goto error; } @@ -1799,7 +1798,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x case LY_TYPE_INT32: if (parse_int(value, __INT64_C(-2147483648), __INT64_C(2147483647), dflt ? 0 : 10, &num, contextnode) - || (!trusted && validate_length_range(1, 0, num, 0, 0, type, value, contextnode))) { + || validate_length_range(1, 0, num, 0, 0, type, value, contextnode)) { goto error; } @@ -1817,7 +1816,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x case LY_TYPE_INT64: if (parse_int(value, __INT64_C(-9223372036854775807) - __INT64_C(1), __INT64_C(9223372036854775807), dflt ? 0 : 10, &num, contextnode) - || (!trusted && validate_length_range(1, 0, num, 0, 0, type, value, contextnode))) { + || validate_length_range(1, 0, num, 0, 0, type, value, contextnode)) { goto error; } @@ -1834,7 +1833,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x case LY_TYPE_UINT8: if (parse_uint(value, __UINT64_C(255), dflt ? 0 : 10, &unum, contextnode) - || (!trusted && validate_length_range(0, unum, 0, 0, 0, type, value, contextnode))) { + || validate_length_range(0, unum, 0, 0, 0, type, value, contextnode)) { goto error; } @@ -1851,7 +1850,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x case LY_TYPE_UINT16: if (parse_uint(value, __UINT64_C(65535), dflt ? 0 : 10, &unum, contextnode) - || (!trusted && validate_length_range(0, unum, 0, 0, 0, type, value, contextnode))) { + || validate_length_range(0, unum, 0, 0, 0, type, value, contextnode)) { goto error; } @@ -1868,7 +1867,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x case LY_TYPE_UINT32: if (parse_uint(value, __UINT64_C(4294967295), dflt ? 0 : 10, &unum, contextnode) - || (!trusted && validate_length_range(0, unum, 0, 0, 0, type, value, contextnode))) { + || validate_length_range(0, unum, 0, 0, 0, type, value, contextnode)) { goto error; } @@ -1885,7 +1884,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x case LY_TYPE_UINT64: if (parse_uint(value, __UINT64_C(18446744073709551615), dflt ? 0 : 10, &unum, contextnode) - || (!trusted && validate_length_range(0, unum, 0, 0, 0, type, value, contextnode))) { + || validate_length_range(0, unum, 0, 0, 0, type, value, contextnode)) { goto error; } @@ -1940,7 +1939,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x while ((t = lyp_get_next_union_type(type, t, &found))) { found = 0; - ret = lyp_parse_value(t, value_, xml, leaf, attr, NULL, store, dflt, 0); + ret = lyp_parse_value(t, value_, xml, leaf, attr, NULL, store, dflt); if (ret) { /* we have the result */ type = ret; @@ -2041,7 +2040,7 @@ lyp_get_next_union_type(struct lys_type *type, struct lys_type *prev_type, int * /* ret 0 - ret set, ret 1 - ret not set, no log, ret -1 - ret not set, fatal error */ int lyp_fill_attr(struct ly_ctx *ctx, struct lyd_node *parent, const char *module_ns, const char *module_name, - const char *attr_name, const char *attr_value, struct lyxml_elem *xml, int options, struct lyd_attr **ret) + const char *attr_name, const char *attr_value, struct lyxml_elem *xml, struct lyd_attr **ret) { const struct lys_module *mod = NULL; const struct lys_submodule *submod = NULL; @@ -2110,7 +2109,7 @@ lyp_fill_attr(struct ly_ctx *ctx, struct lyd_node *parent, const char *module_ns /* the value is here converted to a JSON format if needed in case of LY_TYPE_IDENT and LY_TYPE_INST or to a * canonical form of the value */ type = lys_ext_complex_get_substmt(LY_STMT_TYPE, dattr->annotation, NULL); - if (!type || !lyp_parse_value(*type, &dattr->value_str, xml, NULL, dattr, NULL, 1, 0, options & LYD_OPT_TRUSTED)) { + if (!type || !lyp_parse_value(*type, &dattr->value_str, xml, NULL, dattr, NULL, 1, 0)) { lydict_remove(ctx, dattr->name); lydict_remove(ctx, dattr->value_str); free(dattr); diff --git a/src/parser.h b/src/parser.h index 47340dba2..b22f6b596 100644 --- a/src/parser.h +++ b/src/parser.h @@ -97,13 +97,13 @@ struct lys_type *lyp_get_next_union_type(struct lys_type *type, struct lys_type /* return: 0 - ret set, ok; 1 - ret not set, no log, unknown meta; -1 - ret not set, log, fatal error */ int lyp_fill_attr(struct ly_ctx *ctx, struct lyd_node *parent, const char *module_ns, const char *module_name, - const char *attr_name, const char *attr_value, struct lyxml_elem *xml, int options, struct lyd_attr **ret); + const char *attr_name, const char *attr_value, struct lyxml_elem *xml, struct lyd_attr **ret); int lyp_check_edit_attr(struct ly_ctx *ctx, struct lyd_attr *attr, struct lyd_node *parent, int *editbits); struct lys_type *lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *xml, struct lyd_node_leaf_list *leaf, struct lyd_attr *attr, struct lys_module *local_mod, - int store, int dflt, int trusted); + int store, int dflt); int lyp_check_length_range(struct ly_ctx *ctx, const char *expr, struct lys_type *type); diff --git a/src/parser_json.c b/src/parser_json.c index d29768818..cecd40e98 100644 --- a/src/parser_json.c +++ b/src/parser_json.c @@ -511,8 +511,7 @@ json_get_value(struct lyd_node_leaf_list *leaf, struct lyd_node **first_sibling, /* the value is here converted to a JSON format if needed in case of LY_TYPE_IDENT and LY_TYPE_INST or to a * canonical form of the value */ - if (!lyp_parse_value(&((struct lys_node_leaf *)leaf->schema)->type, &leaf->value_str, NULL, leaf, NULL, NULL, - 1, 0, options & LYD_OPT_TRUSTED)) { + if (!lyp_parse_value(&((struct lys_node_leaf *)leaf->schema)->type, &leaf->value_str, NULL, leaf, NULL, NULL, 1, 0)) { return 0; } @@ -646,7 +645,7 @@ json_parse_attr(struct lys_module *parent_module, struct lyd_attr **attr, const len += r + 1; len += skip_ws(&data[len]); - ret = lyp_fill_attr(parent_module->ctx, NULL, NULL, prefix, name, value, NULL, options, &attr_new); + ret = lyp_fill_attr(parent_module->ctx, NULL, NULL, prefix, name, value, NULL, &attr_new); if (ret == -1) { free(value); goto error; diff --git a/src/parser_lyb.c b/src/parser_lyb.c index 1900597b7..5e17bedf1 100644 --- a/src/parser_lyb.c +++ b/src/parser_lyb.c @@ -520,7 +520,7 @@ lyb_parse_val_2(struct lys_type *type, struct lyd_node_leaf_list *leaf, struct l if (*value_flags & LY_VALUE_USER) { /* unfortunately, we need to also fill the value properly, so just parse it again */ *value_flags &= ~LY_VALUE_USER; - if (!lyp_parse_value(type, value_str, NULL, leaf, attr, NULL, 1, (leaf ? leaf->dflt : 0), 1)) { + if (!lyp_parse_value(type, value_str, NULL, leaf, attr, NULL, 1, (leaf ? leaf->dflt : 0))) { return -1; } diff --git a/src/parser_xml.c b/src/parser_xml.c index 46b7c1e4f..95ec15836 100644 --- a/src/parser_xml.c +++ b/src/parser_xml.c @@ -75,7 +75,7 @@ xml_data_search_schemanode(struct lyxml_elem *xml, struct lys_node *start, int o /* logs directly */ static int -xml_get_value(struct lyd_node *node, struct lyxml_elem *xml, int editbits, int trusted) +xml_get_value(struct lyd_node *node, struct lyxml_elem *xml, int editbits) { struct lyd_node_leaf_list *leaf = (struct lyd_node_leaf_list *)node; @@ -92,7 +92,7 @@ xml_get_value(struct lyd_node *node, struct lyxml_elem *xml, int editbits, int t /* the value is here converted to a JSON format if needed in case of LY_TYPE_IDENT and LY_TYPE_INST or to a * canonical form of the value */ - if (!lyp_parse_value(&((struct lys_node_leaf *)leaf->schema)->type, &leaf->value_str, xml, leaf, NULL, NULL, 1, 0, trusted)) { + if (!lyp_parse_value(&((struct lys_node_leaf *)leaf->schema)->type, &leaf->value_str, xml, leaf, NULL, NULL, 1, 0)) { return EXIT_FAILURE; } @@ -334,7 +334,7 @@ xml_parse_data(struct ly_ctx *ctx, struct lyxml_elem *xml, struct lyd_node *pare str = attr->ns->value; } - r = lyp_fill_attr(ctx, *result, str, NULL, attr->name, attr->value, xml, options, &dattr); + r = lyp_fill_attr(ctx, *result, str, NULL, attr->name, attr->value, xml, &dattr); if (r == -1) { goto unlink_node_error; } else if (r == 1) { @@ -458,7 +458,7 @@ xml_parse_data(struct ly_ctx *ctx, struct lyxml_elem *xml, struct lyd_node *pare /* type specific processing */ if (schema->nodetype & (LYS_LEAF | LYS_LEAFLIST)) { /* type detection and assigning the value */ - if (xml_get_value(*result, xml, editbits, options & LYD_OPT_TRUSTED)) { + if (xml_get_value(*result, xml, editbits)) { goto unlink_node_error; } } else if (schema->nodetype & LYS_ANYDATA) { diff --git a/src/resolve.c b/src/resolve.c index 586a3b481..5a325f2f2 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -3638,7 +3638,7 @@ check_default(struct lys_type *type, const char **value, struct lys_module *modu } } } else { - if (!lyp_parse_value(type, &node.value_str, NULL, &node, NULL, module, 1, 1, 0)) { + if (!lyp_parse_value(type, &node.value_str, NULL, &node, NULL, module, 1, 1)) { /* possible forward reference */ ret = EXIT_FAILURE; if (base_tpdf) { @@ -4430,7 +4430,7 @@ valequal(struct lys_node *node, const char *noncan_val, int noncan_val_len, cons sleaf = sleaf->type.info.lref.target; goto repeat; } else { - if (!lyp_parse_value(&sleaf->type, &leaf.value_str, NULL, &leaf, NULL, NULL, 0, 0, 0)) { + if (!lyp_parse_value(&sleaf->type, &leaf.value_str, NULL, &leaf, NULL, NULL, 0, 0)) { ret = -1; goto finish; } @@ -8088,7 +8088,7 @@ resolve_union(struct lyd_node_leaf_list *leaf, struct lys_type *type, int store, } else { /* valid unresolved */ ly_ilo_restore(NULL, prev_ilo, NULL, 0); - if (!lyp_parse_value(t, &leaf->value_str, NULL, leaf, NULL, NULL, 1, 0, 0)) { + if (!lyp_parse_value(t, &leaf->value_str, NULL, leaf, NULL, NULL, 1, 0)) { return -1; } ly_ilo_change(NULL, ILO_IGNORE, &prev_ilo, NULL); @@ -8136,7 +8136,7 @@ resolve_union(struct lyd_node_leaf_list *leaf, struct lys_type *type, int store, } break; default: - if (lyp_parse_value(t, &leaf->value_str, NULL, leaf, NULL, NULL, store, 0, 0)) { + if (lyp_parse_value(t, &leaf->value_str, NULL, leaf, NULL, NULL, store, 0)) { success = 1; } break; @@ -8228,7 +8228,7 @@ resolve_unres_data_item(struct lyd_node *node, enum UNRES_ITEM type, int ignore_ } else { /* valid unresolved */ if (!(leaf->value_flags & LY_VALUE_UNRES)) { - if (!lyp_parse_value(&sleaf->type, &leaf->value_str, NULL, leaf, NULL, NULL, 1, 0, 0)) { + if (!lyp_parse_value(&sleaf->type, &leaf->value_str, NULL, leaf, NULL, NULL, 1, 0)) { return -1; } } diff --git a/src/tree_data.c b/src/tree_data.c index 20ad5c1b5..bc9ed6f6c 100644 --- a/src/tree_data.c +++ b/src/tree_data.c @@ -1255,7 +1255,7 @@ _lyd_new_leaf(struct lyd_node *parent, const struct lys_node *schema, const char /* resolve the type correctly (after it was connected to parent cause of log) */ if (!lyp_parse_value(&((struct lys_node_leaf *)ret->schema)->type, &((struct lyd_node_leaf_list *)ret)->value_str, - NULL, (struct lyd_node_leaf_list *)ret, NULL, NULL, 1, dflt, 0)) { + NULL, (struct lyd_node_leaf_list *)ret, NULL, NULL, 1, dflt)) { lyd_free(ret); return NULL; } @@ -1353,7 +1353,7 @@ lyd_change_leaf(struct lyd_node_leaf_list *leaf, const char *val_str) /* leaf->value is erased by lyp_parse_value() */ /* parse the type correctly, makes the value canonical if needed */ - if (!lyp_parse_value(&((struct lys_node_leaf *)leaf->schema)->type, &leaf->value_str, NULL, leaf, NULL, NULL, 1, 0, 0)) { + if (!lyp_parse_value(&((struct lys_node_leaf *)leaf->schema)->type, &leaf->value_str, NULL, leaf, NULL, NULL, 1, 0)) { lydict_remove(leaf->schema->module->ctx, backup); return -1; } @@ -1627,7 +1627,7 @@ lyd_make_canonical(const struct lys_node *schema, const char *val_str, int val_s /* parse the value into a fake leaf */ if (!lyp_parse_value(&((struct lys_node_leaf *)node->schema)->type, &((struct lyd_node_leaf_list *)node)->value_str, - NULL, (struct lyd_node_leaf_list *)node, NULL, NULL, 1, 0, 0)) { + NULL, (struct lyd_node_leaf_list *)node, NULL, NULL, 1, 0)) { lyd_free(node); return NULL; } @@ -2463,7 +2463,7 @@ lyd_merge_node_update(struct lyd_node *target, struct lyd_node *source, int opti trg_leaf->value_type = src_leaf->value_type; if (trg_leaf->value_type == LY_TYPE_LEAFREF) { lyp_parse_value(&((struct lys_node_leaf *)trg_leaf->schema)->type, &trg_leaf->value_str, - NULL, trg_leaf, NULL, NULL, 1, src_leaf->dflt, 0); + NULL, trg_leaf, NULL, NULL, 1, src_leaf->dflt); } else { lyd_free_value(trg_leaf->value, trg_leaf->value_type, trg_leaf->value_flags, &((struct lys_node_leaf *)trg_leaf->schema)->type, trg_leaf->value_str, NULL, NULL, NULL); @@ -2527,7 +2527,7 @@ lyd_merge_node_update(struct lyd_node *target, struct lyd_node *source, int opti break; case LY_TYPE_LEAFREF: lyp_parse_value(&((struct lys_node_leaf *)trg_leaf->schema)->type, &trg_leaf->value_str, - NULL, trg_leaf, NULL, NULL, 1, trg_leaf->dflt, 0); + NULL, trg_leaf, NULL, NULL, 1, trg_leaf->dflt); break; case LY_TYPE_INST: trg_leaf->value.instance = NULL; @@ -2544,7 +2544,7 @@ lyd_merge_node_update(struct lyd_node *target, struct lyd_node *source, int opti * a different context, searching for the type and duplicating the data is almost as same as resolving * the string value, so due to a simplicity, parse the value for the duplicated leaf */ lyp_parse_value(&((struct lys_node_leaf *)trg_leaf->schema)->type, &trg_leaf->value_str, NULL, - trg_leaf, NULL, NULL, 1, trg_leaf->dflt, 1); + trg_leaf, NULL, NULL, 1, trg_leaf->dflt); break; default: trg_leaf->value = src_leaf->value; @@ -5273,7 +5273,7 @@ lyd_validate_value(struct lys_node *node, const char *value) sleaf = sleaf->type.info.lref.target; goto repeat; } else { - if (!lyp_parse_value(&sleaf->type, &leaf.value_str, NULL, &leaf, NULL, NULL, 0, 0, 0)) { + if (!lyp_parse_value(&sleaf->type, &leaf.value_str, NULL, &leaf, NULL, NULL, 0, 0)) { ret = EXIT_FAILURE; goto cleanup; } @@ -5317,7 +5317,7 @@ lyd_dup_attr(struct ly_ctx *ctx, struct lyd_node *parent, struct lyd_attr *attr) break; case LY_TYPE_LEAFREF: lyp_parse_value(*((struct lys_type **)lys_ext_complex_get_substmt(LY_STMT_TYPE, ret->annotation, NULL)), - &ret->value_str, NULL, NULL, ret, NULL, 1, 0, 0); + &ret->value_str, NULL, NULL, ret, NULL, 1, 0); break; case LY_TYPE_INST: ret->value.instance = NULL; @@ -5334,7 +5334,7 @@ lyd_dup_attr(struct ly_ctx *ctx, struct lyd_node *parent, struct lyd_attr *attr) * a different context, searching for the type and duplicating the data is almost as same as resolving * the string value, so due to a simplicity, parse the value for the duplicated leaf */ lyp_parse_value(*((struct lys_type **)lys_ext_complex_get_substmt(LY_STMT_TYPE, ret->annotation, NULL)), - &ret->value_str, NULL, NULL, ret, NULL, 1, 0, 0); + &ret->value_str, NULL, NULL, ret, NULL, 1, 0); break; default: ret->value = attr->value; @@ -5481,7 +5481,7 @@ _lyd_dup_node(const struct lyd_node *node, const struct lys_node *schema, struct new_leaf->value.string = new_leaf->value_str; break; case LY_TYPE_LEAFREF: - lyp_parse_value(&sleaf->type, &new_leaf->value_str, NULL, new_leaf, NULL, NULL, 1, node->dflt, 0); + lyp_parse_value(&sleaf->type, &new_leaf->value_str, NULL, new_leaf, NULL, NULL, 1, node->dflt); break; case LY_TYPE_INST: new_leaf->value.instance = NULL; @@ -5497,7 +5497,7 @@ _lyd_dup_node(const struct lyd_node *node, const struct lys_node *schema, struct /* in case of duplicating bits (no matter if in the same context or not) or enum and identityref into * a different context, searching for the type and duplicating the data is almost as same as resolving * the string value, so due to a simplicity, parse the value for the duplicated leaf */ - if (!lyp_parse_value(&sleaf->type, &new_leaf->value_str, NULL, new_leaf, NULL, NULL, 1, node->dflt, 0)) { + if (!lyp_parse_value(&sleaf->type, &new_leaf->value_str, NULL, new_leaf, NULL, NULL, 1, node->dflt)) { goto error; } break; @@ -6069,7 +6069,7 @@ lyd_insert_attr(struct lyd_node *parent, const struct lys_module *mod, const cha a->name = lydict_insert(ctx, name, 0); a->value_str = lydict_insert(ctx, value, 0); if (!lyp_parse_value(*((struct lys_type **)lys_ext_complex_get_substmt(LY_STMT_TYPE, a->annotation, NULL)), - &a->value_str, NULL, NULL, a, NULL, 1, 0, 0)) { + &a->value_str, NULL, NULL, a, NULL, 1, 0)) { lyd_free_attr(ctx, NULL, a, 0); return NULL; } From 003b4e18c6c17ec02bdfb2d469566bf2ed75aac9 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 25 Feb 2020 15:49:11 +0100 Subject: [PATCH 016/134] SOVERSION bump to version 1.6.12 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 14a8836cb..aad658ee3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 11) +set(LIBYANG_MICRO_SOVERSION 12) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From af921a766ef1ec05c21080b22cdb0c28d5df3146 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 25 Feb 2020 15:49:21 +0100 Subject: [PATCH 017/134] VERSION bump to version 1.0.135 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aad658ee3..a25df51a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 134) +set(LIBYANG_MICRO_VERSION 135) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 39194e33a0e6a389fdc99b05301912c90a07e4bf Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 28 Feb 2020 11:44:47 +0100 Subject: [PATCH 018/134] user types BUGFIX accept date 1 second before epoch mktime() works correctly except it returns -1 without setting errno. Fixes #1021 --- src/user_types/user_yang_types.c | 8 ++++++-- tests/data/test_user_types.c | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/user_types/user_yang_types.c b/src/user_types/user_yang_types.c index 1bea2ec0e..1424cf368 100644 --- a/src/user_types/user_yang_types.c +++ b/src/user_types/user_yang_types.c @@ -136,7 +136,9 @@ date_and_time_store_clb(struct ly_ctx *UNUSED(ctx), const char *UNUSED(type_name /* validate using mktime() */ tm2 = tm; - if (mktime(&tm) == -1) { + errno = 0; + mktime(&tm); + if (errno) { ret = asprintf(err_msg, "Checking date-and-time value \"%s\" failed (%s).", val_str, strerror(errno)); goto error; } @@ -145,7 +147,9 @@ date_and_time_store_clb(struct ly_ctx *UNUSED(ctx), const char *UNUSED(type_name /* back it up again */ tm = tm2; /* let mktime() correct date & time with having the other values correct now */ - if (mktime(&tm) == -1) { + errno = 0; + mktime(&tm); + if (errno) { ret = asprintf(err_msg, "Checking date-and-time value \"%s\" failed (%s).", val_str, strerror(errno)); goto error; } diff --git a/tests/data/test_user_types.c b/tests/data/test_user_types.c index ac983ad8c..75fd074fb 100644 --- a/tests/data/test_user_types.c +++ b/tests/data/test_user_types.c @@ -92,6 +92,14 @@ test_yang_types(void **state) assert_non_null(st->dt); lyd_free_withsiblings(st->dt); + /* test 1 second before epoch (mktime returns -1, but it is a correct value), with and without DST */ + st->dt = lyd_new_leaf(NULL, st->mod, "yang1", "1970-01-01T00:59:59Z"); + assert_non_null(st->dt); + lyd_free_withsiblings(st->dt); + st->dt = lyd_new_leaf(NULL, st->mod, "yang1", "1969-12-31T23:59:59Z"); + assert_non_null(st->dt); + lyd_free_withsiblings(st->dt); + st->dt = lyd_new_leaf(NULL, st->mod, "yang1", "2005-05-31T23:15:15.-08:00"); assert_null(st->dt); From 8dc6971cad2fb1d58fb993838938f1abb3ded5d3 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 28 Feb 2020 11:46:05 +0100 Subject: [PATCH 019/134] VERSION bump to version 1.0.136 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a25df51a1..8c779c91a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 135) +set(LIBYANG_MICRO_VERSION 136) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From bac5714217cc279ef366ba2f7bc2e3d52ba0dc99 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 28 Feb 2020 13:41:01 +0100 Subject: [PATCH 020/134] yang parser BUGFIX deviating default values with prefixes Fixes #1022 --- src/parser_yang.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/parser_yang.c b/src/parser_yang.c index d796107d5..ce02a890c 100644 --- a/src/parser_yang.c +++ b/src/parser_yang.c @@ -1535,8 +1535,10 @@ yang_fill_deviate_default(struct ly_ctx *ctx, struct lys_deviate *deviate, struc struct lys_node_choice *choice; struct lys_node_leaf *leaf; struct lys_node_leaflist *llist; + enum int_log_opts prev_ilo; int rc, i, j; unsigned int u; + const char *orig_dflt; u = strlen(value); if (dev_target->nodetype == LYS_CHOICE) { @@ -1570,11 +1572,24 @@ yang_fill_deviate_default(struct ly_ctx *ctx, struct lys_deviate *deviate, struc } else if (dev_target->nodetype == LYS_LEAF) { leaf = (struct lys_node_leaf *)dev_target; if (deviate->mod == LY_DEVIATE_DEL) { - if (!leaf->dflt || !ly_strequal(leaf->dflt, value, 1)) { + orig_dflt = NULL; + if (leaf->dflt) { + /* transform back into the original value */ + ly_ilo_change(NULL, ILO_IGNORE, &prev_ilo, NULL); + orig_dflt = transform_json2schema(leaf->module, leaf->dflt); + ly_ilo_restore(NULL, prev_ilo, NULL, 0); + if (!orig_dflt) { + orig_dflt = lydict_insert(ctx, leaf->dflt, 0); + } + } + if (!orig_dflt || !ly_strequal(orig_dflt, value, 1)) { LOGVAL(ctx, LYE_INARG, LY_VLOG_NONE, NULL, value, "default"); LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Value differs from the target being deleted."); + lydict_remove(ctx, orig_dflt); goto error; } + lydict_remove(ctx, orig_dflt); + /* remove value */ lydict_remove(ctx, leaf->dflt); leaf->dflt = NULL; @@ -1601,7 +1616,20 @@ yang_fill_deviate_default(struct ly_ctx *ctx, struct lys_deviate *deviate, struc if (deviate->mod == LY_DEVIATE_DEL) { /* find and remove the value in target list */ for (i = 0; i < llist->dflt_size; i++) { - if (llist->dflt[i] && ly_strequal(llist->dflt[i], value, 1)) { + orig_dflt = NULL; + if (llist->dflt[i]) { + /* transform back into the original value */ + ly_ilo_change(NULL, ILO_IGNORE, &prev_ilo, NULL); + orig_dflt = transform_json2schema(llist->module, llist->dflt[i]); + ly_ilo_restore(NULL, prev_ilo, NULL, 0); + if (!orig_dflt) { + orig_dflt = lydict_insert(ctx, llist->dflt[i], 0); + } + } + + if (orig_dflt && ly_strequal(orig_dflt, value, 1)) { + lydict_remove(ctx, orig_dflt); + /* match, remove the value */ lydict_remove(llist->module->ctx, llist->dflt[i]); llist->dflt[i] = NULL; @@ -1618,6 +1646,7 @@ yang_fill_deviate_default(struct ly_ctx *ctx, struct lys_deviate *deviate, struc } break; } + lydict_remove(ctx, orig_dflt); } if (i == llist->dflt_size) { LOGVAL(ctx, LYE_INARG, LY_VLOG_NONE, NULL, value, "default"); From a2aa2379c7d1ff40c2b88ebb24054ae51a2bf9d9 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 28 Feb 2020 13:41:34 +0100 Subject: [PATCH 021/134] SOVERSION bump to version 1.6.13 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c779c91a..2977de26e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 12) +set(LIBYANG_MICRO_SOVERSION 13) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 44f2a982d4e2cb94232b5b4e53ef3168164fbbb5 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 28 Feb 2020 13:41:44 +0100 Subject: [PATCH 022/134] VERSION bump to version 1.0.137 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2977de26e..a3f42b9ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 136) +set(LIBYANG_MICRO_VERSION 137) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From b0edc54f11b817130138d805a6aa6cc42741967d Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 2 Mar 2020 08:32:08 +0100 Subject: [PATCH 023/134] parser BUGFIX changing value from a user type to non-user type Fixes #1024 --- src/parser.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parser.c b/src/parser.c index 5d2e01a94..4e80f97b8 100755 --- a/src/parser.c +++ b/src/parser.c @@ -1255,6 +1255,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x old_val_str = lydict_insert(ctx, *value_, 0); lyd_free_value(*val, *val_type, *val_flags, type, old_val_str, &old_val, &old_val_type, &old_val_flags); *val_flags &= ~LY_VALUE_UNRES; + *val_flags &= ~LY_VALUE_USER; } switch (type->base) { From 0c77a4049702e0ce191ae238c2f69a1ecd0d145a Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 2 Mar 2020 08:32:41 +0100 Subject: [PATCH 024/134] SOVERSION bump to version 1.6.14 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3f42b9ea..cb6a1c293 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 13) +set(LIBYANG_MICRO_SOVERSION 14) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 31b3f509bb170b80514edb984985a6d700e5c674 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 2 Mar 2020 08:32:53 +0100 Subject: [PATCH 025/134] VERSION bump to version 1.0.138 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb6a1c293..10f1148a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 137) +set(LIBYANG_MICRO_VERSION 138) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 2be97e3c10117fc922ca0d5329d4bde336e19fd4 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 2 Mar 2020 11:13:49 +0100 Subject: [PATCH 026/134] data tree BUGFIX leaf value changing Also, some lyp_parse_value() fixes. Fixes #1024 --- src/parser.c | 18 +++++++++++------- src/tree_data.c | 14 +++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/parser.c b/src/parser.c index 4e80f97b8..f4d6df8da 100755 --- a/src/parser.c +++ b/src/parser.c @@ -1252,12 +1252,17 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x /* fully clear the value */ if (store) { - old_val_str = lydict_insert(ctx, *value_, 0); + if (leaf) { + old_val_str = lydict_insert(ctx, leaf->value_str, 0); + } else { + old_val_str = lydict_insert(ctx, attr->value_str, 0); + } lyd_free_value(*val, *val_type, *val_flags, type, old_val_str, &old_val, &old_val_type, &old_val_flags); *val_flags &= ~LY_VALUE_UNRES; *val_flags &= ~LY_VALUE_USER; } + ret = type; switch (type->base) { case LY_TYPE_BINARY: /* get number of octets for length validation */ @@ -1720,7 +1725,7 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x *val_flags |= LY_VALUE_UNRES; } - type = t; + ret = t; break; case LY_TYPE_STRING: @@ -1943,7 +1948,6 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x ret = lyp_parse_value(t, value_, xml, leaf, attr, NULL, store, dflt); if (ret) { /* we have the result */ - type = ret; break; } @@ -1977,8 +1981,8 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x } /* search user types in case this value is supposed to be stored in a custom way */ - if (store && type->der && type->der->module) { - c = lytype_store(type->der->module, type->der->name, value_, val); + if (store && ret->der && ret->der->module) { + c = lytype_store(ret->der->module, ret->der->name, value_, val); if (c == -1) { goto error; } else if (!c) { @@ -1986,12 +1990,12 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x } } - /* free backup */ + /* free backup (using the original type) */ if (store) { lyd_free_value(old_val, old_val_type, old_val_flags, type, old_val_str, NULL, NULL, NULL); lydict_remove(ctx, old_val_str); } - return type; + return ret; error: /* restore the backup */ diff --git a/src/tree_data.c b/src/tree_data.c index bc9ed6f6c..259c7045b 100644 --- a/src/tree_data.c +++ b/src/tree_data.c @@ -1339,7 +1339,7 @@ lyd_change_leaf(struct lyd_node_leaf_list *leaf, const char *val_str) { FUN_IN; - const char *backup; + const char *backup, *new_val; int val_change, dflt_change; struct lyd_node *parent; @@ -1349,24 +1349,24 @@ lyd_change_leaf(struct lyd_node_leaf_list *leaf, const char *val_str) } backup = leaf->value_str; - leaf->value_str = lydict_insert(leaf->schema->module->ctx, val_str ? val_str : "", 0); - /* leaf->value is erased by lyp_parse_value() */ + new_val = lydict_insert(leaf->schema->module->ctx, val_str ? val_str : "", 0); /* parse the type correctly, makes the value canonical if needed */ - if (!lyp_parse_value(&((struct lys_node_leaf *)leaf->schema)->type, &leaf->value_str, NULL, leaf, NULL, NULL, 1, 0)) { + if (!lyp_parse_value(&((struct lys_node_leaf *)leaf->schema)->type, &new_val, NULL, leaf, NULL, NULL, 1, 0)) { lydict_remove(leaf->schema->module->ctx, backup); return -1; } - if (!strcmp(backup, leaf->value_str)) { + if (!strcmp(backup, new_val)) { /* the value remains the same */ val_change = 0; } else { val_change = 1; } - /* value is correct, remove backup */ - lydict_remove(leaf->schema->module->ctx, backup); + /* value is correct, replace it */ + lydict_remove(leaf->schema->module->ctx, leaf->value_str); + leaf->value_str = new_val; /* clear the default flag, the value is different */ if (leaf->dflt) { From 7630ee679e33c8551fdf5963c040148296415f9d Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 2 Mar 2020 11:14:57 +0100 Subject: [PATCH 027/134] SOVERSION bump to version 1.6.15 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 10f1148a3..1c46e883f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 14) +set(LIBYANG_MICRO_SOVERSION 15) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 1937b1736cfe972ceaaca2c10d8c42adb2aecec2 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 2 Mar 2020 11:15:08 +0100 Subject: [PATCH 028/134] VERSION bump to version 1.0.139 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c46e883f..ee693712c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 138) +set(LIBYANG_MICRO_VERSION 139) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 1640f925eb6170ab0ce9a93b5733a0d2b0ff824e Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 4 Mar 2020 08:18:05 +0100 Subject: [PATCH 029/134] validation BUGFIX op validation Even conditions on the RPC/action itself should not be validated, only on input/output and descendants. Refs sysrepo/sysrepo#1838 --- src/validation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/validation.c b/src/validation.c index dcda727cc..332bb0b3b 100644 --- a/src/validation.c +++ b/src/validation.c @@ -66,7 +66,7 @@ lyv_data_context(struct lyd_node *node, int options, struct unres_data *unres) } /* find (nested) operation node */ - for (op = node->schema; op && !(op->nodetype & (LYS_NOTIF | LYS_RPC | LYS_ACTION)); op = lys_parent(op)); + for (op = node->schema; op && !(op->nodetype & (LYS_NOTIF | LYS_INPUT | LYS_OUTPUT)); op = lys_parent(op)); if (!(options & (LYD_OPT_NOTIF_FILTER | LYD_OPT_EDIT | LYD_OPT_GET | LYD_OPT_GETCONFIG)) && (!(options & (LYD_OPT_RPC | LYD_OPT_RPCREPLY | LYD_OPT_NOTIF)) || op)) { From 907fc80386870ba4334b28b8aca3a227a8e92520 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 4 Mar 2020 08:19:34 +0100 Subject: [PATCH 030/134] SOVERSION bump to version 1.6.16 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee693712c..3c3478451 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 15) +set(LIBYANG_MICRO_SOVERSION 16) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From b0f1540faf52b4e76c34c0f849b5a604847c8e8b Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 4 Mar 2020 08:19:46 +0100 Subject: [PATCH 031/134] VERSION bump to version 1.0.140 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c3478451..9c81abe11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 139) +set(LIBYANG_MICRO_VERSION 140) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 8fa6ec220c40d6b57957250a4231e9ed6aebfa47 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 5 Mar 2020 15:29:26 +0100 Subject: [PATCH 032/134] schema tree BUGFIX check action parents ... when connecting from a grouping or augment. Fixes #1026 --- src/parser_yang.c | 11 --------- src/parser_yin.c | 15 +++--------- src/resolve.c | 16 +++++++++++++ src/tree_schema.c | 60 ++++++++++++++++++++++++++++++----------------- 4 files changed, 58 insertions(+), 44 deletions(-) diff --git a/src/parser_yang.c b/src/parser_yang.c index ce02a890c..07bba0bc0 100644 --- a/src/parser_yang.c +++ b/src/parser_yang.c @@ -4056,17 +4056,6 @@ static int yang_check_rpc_action(struct lys_module *module, struct lys_node_rpc_action *rpc, struct lys_node **child, int options, struct unres_schema *unres) { - struct lys_node *node; - - if (rpc->nodetype == LYS_ACTION) { - for (node = rpc->parent; node; node = lys_parent(node)) { - if ((node->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)) - || ((node->nodetype == LYS_LIST) && !((struct lys_node_list *)node)->keys)) { - LOGVAL(module->ctx, LYE_INPAR, LY_VLOG_LYS, rpc->parent, strnodetype(node->nodetype), "action"); - goto error; - } - } - } if (yang_check_typedef(module, (struct lys_node *)rpc, unres)) { goto error; } diff --git a/src/parser_yin.c b/src/parser_yin.c index cd01ca219..69822684b 100644 --- a/src/parser_yin.c +++ b/src/parser_yin.c @@ -6293,18 +6293,9 @@ read_yin_rpc_action(struct lys_module *module, struct lys_node *parent, struct l int c_tpdf = 0, c_ftrs = 0, c_input = 0, c_output = 0, c_ext = 0; void *reallocated; - if (!strcmp(yin->name, "action")) { - if (module->version < 2) { - LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, parent, "action"); - return NULL; - } - for (node = parent; node; node = lys_parent(node)) { - if ((node->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)) - || ((node->nodetype == LYS_LIST) && !((struct lys_node_list *)node)->keys_size)) { - LOGVAL(ctx, LYE_INPAR, LY_VLOG_LYS, parent, strnodetype(node->nodetype), "action"); - return NULL; - } - } + if (!strcmp(yin->name, "action") && (module->version < 2)) { + LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, parent, "action"); + return NULL; } /* init */ diff --git a/src/resolve.c b/src/resolve.c index 5a325f2f2..e941aad20 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -4881,6 +4881,22 @@ resolve_augment(struct lys_node_augment *aug, struct lys_node *uses, struct unre } } + LY_TREE_DFS_BEGIN(aug->child, next, sub) { + if (sub->nodetype == LYS_ACTION) { + /* we need to check parents */ + for (sub = aug->target; sub; sub = lys_parent(sub)) { + if ((sub->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)) + || ((sub->nodetype == LYS_LIST) && !((struct lys_node_list *)sub)->keys)) { + LOGVAL(ctx, LYE_INPAR, LY_VLOG_LYS, aug->target, strnodetype(sub->nodetype), "action"); + LOGVAL(ctx, LYE_INRESOLV, LY_VLOG_LYS, aug, "augment", aug->target_name); + return -1; + } + } + break; + } + LY_TREE_DFS_END(aug->child, next, sub); + } + if (!aug->child) { /* empty augment, nothing to connect, but it is techincally applied */ LOGWRN(ctx, "Augment \"%s\" without children.", aug->target_name); diff --git a/src/tree_schema.c b/src/tree_schema.c index 559d4ca97..3a61854bc 100755 --- a/src/tree_schema.c +++ b/src/tree_schema.c @@ -1017,26 +1017,38 @@ lys_node_addchild(struct lys_node *parent, struct lys_module *module, struct lys } /* create implicit input/output nodes to have available them as possible target for augment */ - if ((child->nodetype & (LYS_RPC | LYS_ACTION)) && !child->child) { - in = calloc(1, sizeof *in); - out = calloc(1, sizeof *out); - if (!in || !out) { - LOGMEM(ctx); - free(in); - free(out); - return EXIT_FAILURE; + if (child->nodetype & (LYS_RPC | LYS_ACTION)) { + if (child->nodetype == LYS_ACTION) { + for (iter = child->parent; iter; iter = lys_parent(iter)) { + if ((iter->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)) + || ((iter->nodetype == LYS_LIST) && !((struct lys_node_list *)iter)->keys)) { + LOGVAL(module->ctx, LYE_INPAR, LY_VLOG_LYS, iter, strnodetype(iter->nodetype), "action"); + return EXIT_FAILURE; + } + } + } + + if (!child->child) { + in = calloc(1, sizeof *in); + out = calloc(1, sizeof *out); + if (!in || !out) { + LOGMEM(ctx); + free(in); + free(out); + return EXIT_FAILURE; + } + in->nodetype = LYS_INPUT; + in->name = lydict_insert(child->module->ctx, "input", 5); + out->nodetype = LYS_OUTPUT; + out->name = lydict_insert(child->module->ctx, "output", 6); + in->module = out->module = child->module; + in->parent = out->parent = child; + in->flags = out->flags = LYS_IMPLICIT; + in->next = (struct lys_node *)out; + in->prev = (struct lys_node *)out; + out->prev = (struct lys_node *)in; + child->child = (struct lys_node *)in; } - in->nodetype = LYS_INPUT; - in->name = lydict_insert(child->module->ctx, "input", 5); - out->nodetype = LYS_OUTPUT; - out->name = lydict_insert(child->module->ctx, "output", 6); - in->module = out->module = child->module; - in->parent = out->parent = child; - in->flags = out->flags = LYS_IMPLICIT; - in->next = (struct lys_node *)out; - in->prev = (struct lys_node *)out; - out->prev = (struct lys_node *)in; - child->child = (struct lys_node *)in; } return EXIT_SUCCESS; } @@ -3097,6 +3109,11 @@ lys_node_dup_recursion(struct lys_module *module, struct lys_node *parent, const case LYS_LIST: list = calloc(1, sizeof *list); + /* copy keys now so that when adding children, it can be properly checked in this parent */ + list->keys = calloc(list_orig->keys_size, sizeof *list->keys); + LY_CHECK_ERR_GOTO(!list->keys, LOGMEM(ctx), error); + list->keys_size = list_orig->keys_size; + retval = (struct lys_node *)list; break; @@ -3403,10 +3420,11 @@ lys_node_dup_recursion(struct lys_module *module, struct lys_node *parent, const /* typedefs are not needed in instantiated grouping, nor the deviation's shallow copy */ if (list_orig->keys_size) { - list->keys = calloc(list_orig->keys_size, sizeof *list->keys); + /* already done */ + /*list->keys = calloc(list_orig->keys_size, sizeof *list->keys); LY_CHECK_ERR_GOTO(!list->keys, LOGMEM(ctx), error); + list->keys_size = list_orig->keys_size;*/ list->keys_str = lydict_insert(ctx, list_orig->keys_str, 0); - list->keys_size = list_orig->keys_size; if (!shallow) { if (unres_schema_add_node(module, unres, list, UNRES_LIST_KEYS, NULL) == -1) { From 5ec7ba08a95c2566d5e603bc45da6b40b82892cb Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 5 Mar 2020 15:30:13 +0100 Subject: [PATCH 033/134] SOVERSION bump to version 1.6.17 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c81abe11..a0ee4b555 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 16) +set(LIBYANG_MICRO_SOVERSION 17) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 258339a7c788b0cd1a50e6f66fe0af3ab7e7d293 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 5 Mar 2020 15:30:26 +0100 Subject: [PATCH 034/134] VERSION bump to version 1.0.141 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0ee4b555..3d67d007c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 140) +set(LIBYANG_MICRO_VERSION 141) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 1b44389a53a3b5eb80c2256f7f04cae9c0a80e9e Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 6 Mar 2020 10:10:48 +0100 Subject: [PATCH 035/134] doc CHANGE new FAQ question about pcre unicode expr support Refs #1028 --- FAQ.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/FAQ.md b/FAQ.md index 61c722925..240d1e511 100644 --- a/FAQ.md +++ b/FAQ.md @@ -46,3 +46,14 @@ $ LIBYANG_EXTENSIONS_PLUGINS_DIR=`pwd`/src/extensions ./yanglint $ LIBYANG_USER_TYPES_PLUGINS_DIR=`pwd`/src/user_types ``` However, user types are not required for yanglint(1) to run properly. + +__Q: error (or similar) is printed:__ +``` +Regular expression "" is not valid ("": support for \P, \p, and \X has not been compiled). +``` + +__A:__ libyang uses *PCRE* library (not *PCRE2*) for regular expression parsing + and evaluation. This error is printed because the locally installed *PCRE* + library on your system is missing support for these regex atoms. It must + be explicitly allowed by compiling *PCRE* with `--enable-unicode-properties` + (more in its [README](https://www.pcre.org/original/readme.txt)). From 9301fdf979bf0db46ef9787040d1f8bfe15da0af Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 9 Mar 2020 08:58:43 +0100 Subject: [PATCH 036/134] Do not resolve identityrefs in unimplemented modules Fixes #1030 --- src/resolve.c | 3 +++ tests/conformance/test_sec9_10.c | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/resolve.c b/src/resolve.c index e941aad20..b7db66a2e 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -3530,6 +3530,9 @@ check_default(struct lys_type *type, const char **value, struct lys_module *modu case LY_TYPE_IDENT: if (lys_main_module(base_tpdf->type.parent->module)->implemented) { goto cleanup; + } else if ((type->base == LY_TYPE_IDENT) || (type->base == LY_TYPE_INST)) { + /* impossible to check with a non-implemented module */ + goto cleanup; } else { /* check the default value from typedef, but use also the typedef's module * due to possible searching in imported modules which is expected in diff --git a/tests/conformance/test_sec9_10.c b/tests/conformance/test_sec9_10.c index f390fa402..8623c8800 100644 --- a/tests/conformance/test_sec9_10.c +++ b/tests/conformance/test_sec9_10.c @@ -141,8 +141,8 @@ TEST_IDENTITYREF(void **state) } /* in data6.xml we have value defined in mod.yang which is just imported in previous test and - * the data are not valid. Here, mod.yang is loaded as import by mod-dflt.yang, but since it - * uses identity value from mod.yang as its default, the mod.yang is change to be implemented. + * the data are not valid. Here, mod.yang is loaded as import by mod-dflt.yang and then explicitly + * changed to implemented. */ static void TEST_IDENTITYREF2(void **state) @@ -162,10 +162,13 @@ TEST_IDENTITYREF2(void **state) mod = lys_parse_path(st->ctx, TESTS_DIR "/conformance/" TEST_DIR "/mod-dflt-invalid.yang", LYS_IN_YANG); assert_ptr_equal(mod, NULL); - /* mod is set to be implemented */ mod = lys_parse_path(st->ctx, TESTS_DIR "/conformance/" TEST_DIR "/mod-dflt.yang", LYS_IN_YANG); assert_ptr_not_equal(mod, NULL); + /* set mod to be implemented */ + mod = ly_ctx_get_module(st->ctx, "mod", NULL, 0); + assert_int_equal(lys_set_implemented(mod), 0); + /* mod is implemented so the identityref value is valid here */ st->node = lyd_parse_path(st->ctx, TESTS_DIR "/conformance/" TEST_DIR "/data6.xml", LYD_XML, LYD_OPT_CONFIG); assert_ptr_not_equal(st->node, NULL); From bbc8261c6ed5d4e57327704ddd8f60f47ef0fa91 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 9 Mar 2020 08:59:55 +0100 Subject: [PATCH 037/134] SOVERSION bump to version 1.6.18 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d67d007c..793b071b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 17) +set(LIBYANG_MICRO_SOVERSION 18) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 235abb837ae19fdc899263259e2bb458898948f1 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 9 Mar 2020 09:00:07 +0100 Subject: [PATCH 038/134] VERSION bump to version 1.0.142 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 793b071b9..87d4e5f31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 141) +set(LIBYANG_MICRO_VERSION 142) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From bd2e2d3f360139147e82e066853a1df57350d2b0 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 9 Mar 2020 11:57:39 +0100 Subject: [PATCH 039/134] resolve CHANGE improve identref messages Also warn about having a base identity with no derived identities. Refs sysrepo/sysrepo#1851 --- src/resolve.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/resolve.c b/src/resolve.c index b7db66a2e..fca63c6c5 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -6065,13 +6065,16 @@ resolve_identref(struct lys_type *type, const char *ident_name, struct lyd_node break; } } + } else { + LOGWRN(ctx, "Identity \"%s\" has no derived identities, identityref with this base can never be instatiated.", + cur->name); } } if (found == type->info.ident.count) { /* match found for all bases */ cur = der; goto match; - } else if (found) { + } else { LOGVAL(ctx, LYE_SPEC, node ? LY_VLOG_LYD : LY_VLOG_NONE, node, "Identityref value is not derived from all its bases."); goto fail; } From 8f146cefd2375f049f2b83ea2650fb497a1ecd65 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 9 Mar 2020 11:58:49 +0100 Subject: [PATCH 040/134] SOVERSION bump to version 1.6.19 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 87d4e5f31..bdac147bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 18) +set(LIBYANG_MICRO_SOVERSION 19) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 410d4f3e0056e5fd4c8778b1a618aed378b0024f Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 9 Mar 2020 11:59:00 +0100 Subject: [PATCH 041/134] VERSION bump to version 1.0.143 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bdac147bc..a42bb261c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 142) +set(LIBYANG_MICRO_VERSION 143) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 9f66547a920e8041daf4321a405372e8718ba399 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 11 Mar 2020 08:45:42 +0100 Subject: [PATCH 042/134] schema tree BUGFIX leafref from operations can refer state Refs #1033 --- src/tree_schema.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tree_schema.c b/src/tree_schema.c index 3a61854bc..b3e47829f 100755 --- a/src/tree_schema.c +++ b/src/tree_schema.c @@ -4195,6 +4195,7 @@ int lys_leaf_check_leafref(struct lys_node_leaf *leafref_target, struct lys_node *leafref) { struct lys_node_leaf *iter; + struct lys_node *op; struct ly_ctx *ctx = leafref_target->module->ctx; if (!(leafref_target->nodetype & (LYS_LEAF | LYS_LEAFLIST))) { @@ -4202,8 +4203,11 @@ lys_leaf_check_leafref(struct lys_node_leaf *leafref_target, struct lys_node *le return -1; } + /* find the operation node if we are in one */ + for (op = leafref; op && !(op->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)); op = lys_parent(op)); + /* check for config flag */ - if (((struct lys_node_leaf*)leafref)->type.info.lref.req != -1 && + if (!op && ((struct lys_node_leaf*)leafref)->type.info.lref.req != -1 && (leafref->flags & LYS_CONFIG_W) && (leafref_target->flags & LYS_CONFIG_R)) { LOGVAL(ctx, LYE_SPEC, LY_VLOG_LYS, leafref, "The leafref %s is config but refers to a non-config %s.", From 3223a01230c11e4066b9bfaca34762d54c130c9e Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 11 Mar 2020 08:46:10 +0100 Subject: [PATCH 043/134] resolve BUGFIX refine input/output in the path Refs #1033 --- src/resolve.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/resolve.c b/src/resolve.c index fca63c6c5..492ae88be 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -2156,7 +2156,8 @@ resolve_descendant_schema_nodeid(const char *nodeid, const struct lys_node *star while (1) { sibling = NULL; while ((sibling = lys_getnext(sibling, start_parent, module, - LYS_GETNEXT_WITHCHOICE | LYS_GETNEXT_WITHCASE | LYS_GETNEXT_PARENTUSES | LYS_GETNEXT_NOSTATECHECK))) { + LYS_GETNEXT_WITHCHOICE | LYS_GETNEXT_WITHCASE | LYS_GETNEXT_WITHINOUT | LYS_GETNEXT_PARENTUSES + | LYS_GETNEXT_NOSTATECHECK))) { r = schema_nodeid_siblingcheck(sibling, module, mod_name, mod_name_len, name, nam_len); if (r == 0) { if (!id[0]) { From e79fa19d69c073af933780057b5977ec5ad68f82 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 11 Mar 2020 08:46:46 +0100 Subject: [PATCH 044/134] SOVERSION bump to version 1.6.20 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a42bb261c..b979e5783 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 19) +set(LIBYANG_MICRO_SOVERSION 20) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 0c1a211da6c78b219bbe7a6b1379fb197c9bd2eb Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 11 Mar 2020 08:46:56 +0100 Subject: [PATCH 045/134] VERSION bump to version 1.0.144 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b979e5783..fbcded886 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 143) +set(LIBYANG_MICRO_VERSION 144) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 0fef2ff1098c02213986f8e089e2fc403588ef3e Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 12 Mar 2020 08:29:36 +0100 Subject: [PATCH 046/134] xpath BUGFIX node in op accessible tree Refs #1033 --- src/xpath.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/xpath.c b/src/xpath.c index c3893227d..dc7c2aa5c 100644 --- a/src/xpath.c +++ b/src/xpath.c @@ -5381,6 +5381,7 @@ static const struct lyd_node * moveto_get_root(const struct lyd_node *cur_node, int options, enum lyxp_node_type *root_type) { const struct lyd_node *root; + const struct lys_node *op; if (!cur_node) { return NULL; @@ -5394,7 +5395,9 @@ moveto_get_root(const struct lyd_node *cur_node, int options, enum lyxp_node_typ return root; } - if (cur_node->schema->flags & LYS_CONFIG_W) { + for (op = cur_node->schema; op && !(op->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)); op = lys_parent(op)); + + if (!op && (cur_node->schema->flags & LYS_CONFIG_W)) { *root_type = LYXP_NODE_ROOT_CONFIG; } else { *root_type = LYXP_NODE_ROOT; @@ -5409,14 +5412,16 @@ moveto_get_root(const struct lyd_node *cur_node, int options, enum lyxp_node_typ static const struct lys_node * moveto_snode_get_root(const struct lys_node *cur_node, int options, enum lyxp_node_type *root_type) { - const struct lys_node *root; + const struct lys_node *root, *op; assert(cur_node && root_type); + for (op = cur_node; op && !(op->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)); op = lys_parent(op)); + if (options & LYXP_SNODE) { /* general root that can access everything */ *root_type = LYXP_NODE_ROOT; - } else if (cur_node->flags & LYS_CONFIG_W) { + } else if (!op && (cur_node->flags & LYS_CONFIG_W)) { *root_type = LYXP_NODE_ROOT_CONFIG; } else { *root_type = LYXP_NODE_ROOT; From f220fd3b1d91178b7b93ca925933de9d60d0e8a1 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 12 Mar 2020 08:30:14 +0100 Subject: [PATCH 047/134] SOVERSION bump to version 1.6.21 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fbcded886..2e488a367 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 20) +set(LIBYANG_MICRO_SOVERSION 21) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 689f75512473a5d176ac2650f5717345d4de8d4b Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 12 Mar 2020 08:30:26 +0100 Subject: [PATCH 048/134] VERSION bump to version 1.0.145 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e488a367..05e0a2162 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 144) +set(LIBYANG_MICRO_VERSION 145) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 6f5fe558f70cfb0eaa27dd1e3ecbe87deed1feba Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 12 Mar 2020 14:46:32 +0100 Subject: [PATCH 049/134] parse CHANGE log path when storing user type fails Fixes #1034 --- src/parser.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/parser.c b/src/parser.c index f4d6df8da..ddb420421 100755 --- a/src/parser.c +++ b/src/parser.c @@ -1984,6 +1984,9 @@ lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *x if (store && ret->der && ret->der->module) { c = lytype_store(ret->der->module, ret->der->name, value_, val); if (c == -1) { + if (leaf) { + LOGPATH(ctx, LY_VLOG_LYD, leaf); + } goto error; } else if (!c) { *val_flags |= LY_VALUE_USER; From 4dbaf5dfaa4bdb8826d255232eb3d3aa4943d49e Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 12 Mar 2020 14:47:05 +0100 Subject: [PATCH 050/134] SOVERSION bump to version 1.6.22 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05e0a2162..e926b3668 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 21) +set(LIBYANG_MICRO_SOVERSION 22) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 6f919a91245da7adf79d0d00f5dad0fd2cd3f6bc Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 12 Mar 2020 14:47:27 +0100 Subject: [PATCH 051/134] VERSION bump to version 1.0.146 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e926b3668..05a108094 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 145) +set(LIBYANG_MICRO_VERSION 146) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From a57741cfcda17111f2d444707b11f0dc647150ed Mon Sep 17 00:00:00 2001 From: Luka Koznjak Date: Fri, 20 Mar 2020 22:36:37 +0100 Subject: [PATCH 052/134] json parser BUGFIX wrong argument to LOGVAL Fix an invalid LY_ECODE error code argument in a call to ly_vlog from json_skip_unknown which results in a segmenation fault, as the variable argument list's length doesn't match the constructed format string in a later call to vasprintf. --- src/parser_json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser_json.c b/src/parser_json.c index cecd40e98..1da324fa0 100644 --- a/src/parser_json.c +++ b/src/parser_json.c @@ -798,7 +798,7 @@ json_skip_unknown(struct ly_ctx *ctx, struct lyd_node *parent, const char *data, } else if (data[(*len) - 1] != '\\') { qstr = 1; } else { - LOGVAL(ctx, LYE_INVAL, LY_VLOG_LYD, parent, "JSON data (missing quotation mark for a string data) "); + LOGVAL(ctx, LYE_XML_INVAL, LY_VLOG_LYD, parent, "JSON data (missing quotation mark for a string data) "); return -1; } break; From 369a4a8c75b8d6893cc5373ce78799b8f7bc3d63 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 23 Mar 2020 08:42:42 +0100 Subject: [PATCH 053/134] json parser BUGFIX space for all UTF8 characters with '\0' Fixes #1039 --- src/parser_json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser_json.c b/src/parser_json.c index 1da324fa0..f0c9ab5ba 100644 --- a/src/parser_json.c +++ b/src/parser_json.c @@ -68,7 +68,7 @@ lyjson_parse_text(struct ly_ctx *ctx, const char *data, unsigned int *len) int32_t value; for (*len = o = 0; data[*len] && data[*len] != '"'; o++) { - if (o > BUFSIZE - 3) { + if (o > BUFSIZE - 4) { /* add buffer into the result */ if (result) { size = size + o; From 19b911a155379b7f6b160e3ed61331f839e0d94e Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 23 Mar 2020 08:43:40 +0100 Subject: [PATCH 054/134] SOVERSION bump to version 1.6.23 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05a108094..d16145cc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 22) +set(LIBYANG_MICRO_SOVERSION 23) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 06dc54cad226b15fefb38c1cf5e50ae3287c000b Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 23 Mar 2020 08:43:52 +0100 Subject: [PATCH 055/134] VERSION bump to version 1.0.147 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d16145cc6..8b5dff328 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 146) +set(LIBYANG_MICRO_VERSION 147) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 1e0319f2e5a62cfe80bd8d4d153f4c58eea6e7d5 Mon Sep 17 00:00:00 2001 From: Luka Koznjak Date: Fri, 20 Mar 2020 22:30:47 +0100 Subject: [PATCH 056/134] json parser BUGFIX null dereference in json_parse_data Check whether str pointer is null after calling lyjson_parse_text, before using it in json_parse_data --- src/parser_json.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/parser_json.c b/src/parser_json.c index cecd40e98..6f304fae5 100644 --- a/src/parser_json.c +++ b/src/parser_json.c @@ -876,6 +876,10 @@ json_parse_data(struct ly_ctx *ctx, const char *data, const struct lys_node *sch len++; str = lyjson_parse_text(ctx, &data[len], &r); + if (!str) { + goto error; + } + if (!r) { goto error; } else if (data[len + r] != '"') { From 6d351571171a478927e9a210264d76eb880fc563 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 24 Mar 2020 08:26:37 +0100 Subject: [PATCH 057/134] user types BUGFIX handle invalid errno mktime() can set errno even on success. Fixes cesnet/netopeer2#577 --- src/user_types/user_yang_types.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/user_types/user_yang_types.c b/src/user_types/user_yang_types.c index 1424cf368..d0d29be18 100644 --- a/src/user_types/user_yang_types.c +++ b/src/user_types/user_yang_types.c @@ -138,7 +138,8 @@ date_and_time_store_clb(struct ly_ctx *UNUSED(ctx), const char *UNUSED(type_name tm2 = tm; errno = 0; mktime(&tm); - if (errno) { + /* ENOENT is set when "/etc/localtime" is missing but the function suceeeds */ + if (errno && (errno != ENOENT)) { ret = asprintf(err_msg, "Checking date-and-time value \"%s\" failed (%s).", val_str, strerror(errno)); goto error; } @@ -149,7 +150,7 @@ date_and_time_store_clb(struct ly_ctx *UNUSED(ctx), const char *UNUSED(type_name /* let mktime() correct date & time with having the other values correct now */ errno = 0; mktime(&tm); - if (errno) { + if (errno && (errno != ENOENT)) { ret = asprintf(err_msg, "Checking date-and-time value \"%s\" failed (%s).", val_str, strerror(errno)); goto error; } From 48838b90da0ec855cde18aa25006294ba9a1b5eb Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 24 Mar 2020 08:28:13 +0100 Subject: [PATCH 058/134] SOVERSION bump to version 1.6.24 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b5dff328..6fe7f8012 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 23) +set(LIBYANG_MICRO_SOVERSION 24) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 46b1edd718e74ef718b7ea6cd5077a892a7befc1 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 24 Mar 2020 08:28:29 +0100 Subject: [PATCH 059/134] VERSION bump to version 1.0.148 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fe7f8012..f38d8c661 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 147) +set(LIBYANG_MICRO_VERSION 148) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 2edd550650a922190bb50e544e21a484f854bf48 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 31 Mar 2020 15:50:40 +0200 Subject: [PATCH 060/134] dict BUGFIX use special function for resizing Fixes #1045 --- src/hash_table.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/hash_table.c b/src/hash_table.c index 92c10225a..59c1c4c4b 100644 --- a/src/hash_table.c +++ b/src/hash_table.c @@ -191,6 +191,29 @@ lydict_remove(struct ly_ctx *ctx, const char *value) pthread_mutex_unlock(&ctx->dict.lock); } +static int +lydict_resize_val_eq(void *val1_p, void *val2_p, int UNUSED(mod), void *UNUSED(cb_data)) +{ + if (!val1_p || !val2_p) { + LOGARG; + return 0; + } + + const char *str1 = ((struct dict_rec *)val1_p)->value; + const char *str2 = ((struct dict_rec *)val2_p)->value; + + if (!str1 || !str2) { + LOGARG; + return 0; + } + + if (strcmp(str1, str2) == 0) { + return 1; + } + + return 0; +} + static char * dict_insert(struct ly_ctx *ctx, char *value, size_t len, int zerocopy) { @@ -206,7 +229,7 @@ dict_insert(struct ly_ctx *ctx, char *value, size_t len, int zerocopy) rec.refcount = 1; LOGDBG(LY_LDGDICT, "inserting \"%s\"", rec.value); - ret = lyht_insert(ctx->dict.hash_tab, (void *)&rec, hash, (void **)&match); + ret = lyht_insert_with_resize_cb(ctx->dict.hash_tab, (void *)&rec, hash, lydict_resize_val_eq, (void **)&match); if (ret == 1) { match->refcount++; if (zerocopy) { From f2fe5c6865301f9afb794e81622058b7ef2e0e09 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 31 Mar 2020 15:51:21 +0200 Subject: [PATCH 061/134] SOVERSION bump to version 1.6.25 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f38d8c661..597a0de05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 24) +set(LIBYANG_MICRO_SOVERSION 25) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 1acfabc623ec419c8f39a35a72596611a6c5751b Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 31 Mar 2020 15:51:31 +0200 Subject: [PATCH 062/134] VERSION bump to version 1.0.149 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 597a0de05..93e8b1d05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 148) +set(LIBYANG_MICRO_VERSION 149) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From c5fb06eaece1e050d73f65f30c7ea5ce12458a51 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 1 Apr 2020 09:20:50 +0200 Subject: [PATCH 063/134] data tree BUGFIX use standard DFS search Fixes #1046 --- src/tree_data.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/src/tree_data.c b/src/tree_data.c index 259c7045b..351c2cca3 100644 --- a/src/tree_data.c +++ b/src/tree_data.c @@ -4138,7 +4138,7 @@ lyd_insert_setinvalid(struct lyd_node *node) parent_list = parent_list->parent); if (parent_list && !(parent_list->validity & LYD_VAL_UNIQUE)) { /* there is a list, so check if we inserted a leaf supposed to be unique */ - for (elem = node; elem; elem = next) { + LY_TREE_DFS_BEGIN(node, next, elem) { if (elem->schema->nodetype == LYS_LIST) { /* stop searching to the depth, children would be unique to a list in subtree */ goto nextsibling; @@ -4150,38 +4150,33 @@ lyd_insert_setinvalid(struct lyd_node *node) break; } + /* LY_TREE_DFS_END */ if (elem->schema->nodetype & (LYS_LEAF | LYS_LEAFLIST | LYS_ANYDATA)) { - if (elem == node) { - /* stop the loop */ - break; - } - goto nextsibling; + next = NULL; + } else { + next = elem->child; } - /* select next elem to process */ - /* go into children */ - next = elem->child; - /* go through siblings */ if (!next) { nextsibling: - next = elem->next; - if (!next) { - /* no sibling */ - if (elem == node) { - /* we are done, back in start node */ - break; - } + /* no children */ + if (elem == node) { + /* we are done, (START) has no children */ + break; } + /* try siblings */ + next = elem->next; } - /* go back to parents */ while (!next) { + /* parent is already processed, go to its sibling */ elem = elem->parent; + + /* no siblings, go back through parents */ if (elem->parent == node->parent) { - /* we are done, back in start node */ + /* we are done, no next element to process */ break; } - /* parent was actually already processed, so go to the parent's sibling */ - next = elem->parent->next; + next = elem->next; } } } From b9617eba697e161d3c93a3d52cdfea44ea59b3d8 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 1 Apr 2020 10:05:08 +0200 Subject: [PATCH 064/134] data tree BUGFIX update hashes if changing list key Fixes #1048 --- src/tree_data.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/tree_data.c b/src/tree_data.c index 351c2cca3..c40c2607b 100644 --- a/src/tree_data.c +++ b/src/tree_data.c @@ -1381,13 +1381,25 @@ lyd_change_leaf(struct lyd_node_leaf_list *leaf, const char *val_str) if (val_change) { /* make the node non-validated */ leaf->validity = ly_new_node_validity(leaf->schema); - } - if (val_change && (leaf->schema->flags & LYS_UNIQUE)) { - for (parent = leaf->parent; parent && (parent->schema->nodetype != LYS_LIST); parent = parent->parent); - if (parent) { - parent->validity |= LYD_VAL_UNIQUE; + /* set unique validation flag for parent list */ + if (leaf->schema->flags & LYS_UNIQUE) { + for (parent = leaf->parent; parent && (parent->schema->nodetype != LYS_LIST); parent = parent->parent); + if (parent) { + parent->validity |= LYD_VAL_UNIQUE; + } } + +#ifdef LY_ENABLED_CACHE + /* rehash list if it's key was changed */ + if (lys_is_key((struct lys_node_leaf *)leaf->schema, NULL)) { + _lyd_unlink_hash((struct lyd_node *)leaf, leaf->parent, 0); + if (leaf->parent) { + lyd_hash(leaf->parent); + } + lyd_insert_hash((struct lyd_node *)leaf); + } +#endif } return (val_change || dflt_change ? 0 : 1); From ad7a2774b50e575a4f835e554556830020b567df Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 1 Apr 2020 10:06:57 +0200 Subject: [PATCH 065/134] SOVERSION bump to version 1.6.26 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 93e8b1d05..c260cea76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 25) +set(LIBYANG_MICRO_SOVERSION 26) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 34a511e1c11cac7f66a1e0ea6482825c9e1e145f Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 1 Apr 2020 10:07:08 +0200 Subject: [PATCH 066/134] VERSION bump to version 1.0.150 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c260cea76..348483eaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 149) +set(LIBYANG_MICRO_VERSION 150) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From f7b605e04ca43f4603c6ef32b7232e06162034d7 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 1 Apr 2020 12:02:08 +0200 Subject: [PATCH 067/134] common MAINTENANCE removed unused headers --- src/common.c | 1 - src/xml.c | 1 - 2 files changed, 2 deletions(-) diff --git a/src/common.c b/src/common.c index 7f941196a..dcb78bafc 100755 --- a/src/common.c +++ b/src/common.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include diff --git a/src/xml.c b/src/xml.c index 8b05bc345..dc856f215 100644 --- a/src/xml.c +++ b/src/xml.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include "common.h" From c49cb133f0e26742083ce61dd3007e5cddf5728c Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 2 Apr 2020 13:24:41 +0200 Subject: [PATCH 068/134] context CHANGE generate schema for yang-library data Refs #1052 --- src/context.c | 21 +++++++++++++++++++-- tests/schema/test_conformance.c | 8 ++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/context.c b/src/context.c index de0a805e3..b20ba5836 100644 --- a/src/context.c +++ b/src/context.c @@ -1915,12 +1915,29 @@ ly_ctx_info(struct ly_ctx *ctx) } } + /* IDs */ sprintf(id, "%u", ctx->models.module_set_id); if (!lyd_new_leaf(root, NULL, "module-set-id", id)) { goto error; } - if (bis && !lyd_new_leaf(root_bis, NULL, "content-id", id)) { - goto error; + if (bis) { + /* create one complete schema */ + if (!(cont = lyd_new(root_bis, NULL, "schema"))) { + goto error; + } + + if (!lyd_new_leaf(cont, NULL, "name", "complete")) { + goto error; + } + + if (!lyd_new_leaf(cont, NULL, "module-set", "complete")) { + goto error; + } + + /* content-id */ + if (!lyd_new_leaf(root_bis, NULL, "content-id", id)) { + goto error; + } } if (root_bis) { diff --git a/tests/schema/test_conformance.c b/tests/schema/test_conformance.c index 72f626625..9528bbc40 100644 --- a/tests/schema/test_conformance.c +++ b/tests/schema/test_conformance.c @@ -213,6 +213,10 @@ test_implemented_info_yin(void **state) " foo\n" " \n" " \n" +" \n" +" complete\n" +" complete\n" +" \n" " 10\n" "\n" "\n" @@ -353,6 +357,10 @@ test_implemented_info_yang(void **state) " foo\n" " \n" " \n" +" \n" +" complete\n" +" complete\n" +" \n" " 10\n" "\n" "\n" From 4f73d36b5fda16ba9dd31edf2e3e19a51c35de67 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 2 Apr 2020 13:25:23 +0200 Subject: [PATCH 069/134] SOVERSION bump to version 1.6.27 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 348483eaa..304e54618 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 26) +set(LIBYANG_MICRO_SOVERSION 27) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From c29e25497e4aaba63b0dc5361e04805f5a29f5d2 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 2 Apr 2020 13:25:34 +0200 Subject: [PATCH 070/134] VERSION bump to version 1.0.151 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 304e54618..026175844 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 150) +set(LIBYANG_MICRO_VERSION 151) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 28760e7e47631047deab9f6a5e6145615c34683a Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 2 Apr 2020 15:56:51 +0200 Subject: [PATCH 071/134] common CHANGE use own byte-swapping functions Because there are no even remotely portable ones. Fixes #1053 --- CMakeLists.txt | 16 ++++++++++------ src/common.h.in | 19 +++++++++++++++++++ src/parser_lyb.c | 16 ---------------- src/printer_lyb.c | 18 ------------------ 4 files changed, 29 insertions(+), 40 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 026175844..13f31fc64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ project(libyang C) include(GNUInstallDirs) include(CheckSymbolExists) +include(TestBigEndian) set(LIBYANG_DESCRIPTION "libyang is YANG data modelling language parser and toolkit written (and providing API) in C.") @@ -190,10 +191,13 @@ set(headers src/xml.h src/dict.h) +# compatibility checks check_symbol_exists(vdprintf "stdio.h;stdarg.h" HAVE_VDPRINTF) if(HAVE_VDPRINTF) add_definitions(-DHAVE_VDPRINTF) -endif(HAVE_VDPRINTF) +endif() + +TEST_BIG_ENDIAN(BIG_ENDIAN) # create static libyang library if(ENABLE_STATIC) @@ -226,7 +230,7 @@ else() target_link_libraries(yang ${CMAKE_DL_LIBS}) set_target_properties(yangobj PROPERTIES COMPILE_FLAGS "-fvisibility=hidden") -endif(ENABLE_STATIC) +endif() set_target_properties(yang PROPERTIES VERSION ${LIBYANG_SOVERSION_FULL} SOVERSION ${LIBYANG_SOVERSION}) @@ -296,7 +300,7 @@ if(ENABLE_BUILD_TESTS) if(CMOCKA_FOUND AND CMAKE_BUILD_TYPE MATCHES debug) list(APPEND EXTENSIONS_LIST "libyang_ext_test") endif(CMOCKA_FOUND AND CMAKE_BUILD_TYPE MATCHES debug) -endif(ENABLE_BUILD_TESTS) +endif() if(ENABLE_STATIC) set(EXTENSIONS_LIST_SIZE " 0 ") @@ -330,7 +334,7 @@ if(ENABLE_STATIC) set(STATIC_LOADED_PLUGINS_COUNT "${ITEM}") else() add_subdirectory(src/user_types) -endif(ENABLE_STATIC) +endif() configure_file(${PROJECT_SOURCE_DIR}/src/plugin_config.h.in ${PROJECT_BINARY_DIR}/src/plugin_config.h) @@ -367,11 +371,11 @@ if(ENABLE_BUILD_TESTS) message(STATUS "Disabling tests because of missing CMocka") set(ENABLE_BUILD_TESTS NO) endif(CMOCKA_FOUND) -endif(ENABLE_BUILD_TESTS) +endif() if(ENABLE_BUILD_FUZZ_TARGETS) add_subdirectory(tests/fuzz) -endif(ENABLE_BUILD_FUZZ_TARGETS) +endif() if(GEN_LANGUAGE_BINDINGS AND GEN_CPP_BINDINGS) add_subdirectory(swig) diff --git a/src/common.h.in b/src/common.h.in index 4469904b8..364d70bc8 100755 --- a/src/common.h.in +++ b/src/common.h.in @@ -55,6 +55,25 @@ # endif #endif +#define bswap64(val) \ + ( (((val) >> 56) & 0x00000000000000FF) | (((val) >> 40) & 0x000000000000FF00) | \ + (((val) >> 24) & 0x0000000000FF0000) | (((val) >> 8) & 0x00000000FF000000) | \ + (((val) << 8) & 0x000000FF00000000) | (((val) << 24) & 0x0000FF0000000000) | \ + (((val) << 40) & 0x00FF000000000000) | (((val) << 56) & 0xFF00000000000000) ) + +#undef le64toh +#undef htole64 + +#cmakedefine BIG_ENDIAN + +#ifdef BIG_ENDIAN +# define le64toh(x) (x) +# define htole64(x) (x) +#else +# define le64toh(x) bswap64(x) +# define htole64(x) bswap64(x) +#endif + #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON #endif /* !MAP_ANONYMOUS */ diff --git a/src/parser_lyb.c b/src/parser_lyb.c index 5e17bedf1..252bf77ec 100644 --- a/src/parser_lyb.c +++ b/src/parser_lyb.c @@ -17,22 +17,6 @@ #include #include #include -#ifdef __APPLE__ -# include -# define le64toh(x) OSSwapLittleToHostInt64(x) -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) -# include -#elif defined(__sun__) -# include -# include -# if defined(_BIG_ENDIAN) -# define le64toh(x) BSWAP_64(x) -# else -# define le64toh(x) (x) -# endif -#else -# include -#endif #include "libyang.h" #include "common.h" diff --git a/src/printer_lyb.c b/src/printer_lyb.c index 741200e1d..d84b2faf9 100644 --- a/src/printer_lyb.c +++ b/src/printer_lyb.c @@ -18,24 +18,6 @@ #include #include #include -#ifdef __APPLE__ -# include -# define htole64(x) OSSwapHostToLittleInt64(x) -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) -# include -#elif defined(__sun__) -# include -# include -# if defined(_BIG_ENDIAN) -# define le64toh(x) BSWAP_64(x) -# define htole64(x) le64toh(x) -# else -# define le64toh(x) (x) -# define htole64(x) (x) -# endif -#else -# include -#endif #include "common.h" #include "printer.h" From 695180067196bb2d6c97fcfd9d09f7d8fe3825d6 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 2 Apr 2020 17:29:52 +0200 Subject: [PATCH 072/134] common CHANGE provide compatibility functions ... for systems that are missing the implementations. Fixes #1051 --- CMakeLists.txt | 37 ++++++++++------- src/common.c | 104 +++++++++++++++++++++++++++++++++++++++--------- src/common.h.in | 28 ++++++++++--- src/printer.c | 11 ----- 4 files changed, 132 insertions(+), 48 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 13f31fc64..7f5cc07fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,11 @@ set(LIBYANG_MICRO_SOVERSION 27) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) +# check the supported platform +if(NOT UNIX) + message(FATAL_ERROR "Only *nix like systems are supported.") +endif() + # set default build type if not specified by user if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE debug) @@ -82,11 +87,28 @@ elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang") set(COMPILER_UNUSED_ATTR "UNUSED_ ## x __attribute__((__unused__))") set(COMPILER_PACKED_ATTR "__attribute__((__packed__))") else() - message(WARNING "You are using an unknown compiler, it must support C11 standard \"_Generic\" statement or the \"__builtin_types_compatible_p\" built-in function.") + message(WARNING "You are using an unknown compiler, it must support C11 standard \"_Generic\" statement" + " or the \"__builtin_types_compatible_p\" built-in function.") set(COMPILER_UNUSED_ATTR "UNUSED_ ## x") set(COMPILER_PACKED_ATTR "") endif() +# compatibility checks +set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200809L) +list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) +check_symbol_exists(vdprintf "stdio.h;stdarg.h" HAVE_VDPRINTF) +check_symbol_exists(asprintf "stdio.h" HAVE_ASPRINTF) +check_symbol_exists(vasprintf "stdio.h" HAVE_VASPRINTF) + +check_symbol_exists(get_current_dir_name "unistd.h" HAVE_GET_CURRENT_DIR_NAME) + +list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200809L) +check_symbol_exists(strndup "string.h" HAVE_STRNDUP) + +unset(CMAKE_REQUIRED_DEFINITIONS) + +TEST_BIG_ENDIAN(BIG_ENDIAN) + include_directories(${PROJECT_BINARY_DIR}/src ${PROJECT_SOURCE_DIR}/src) configure_file(${PROJECT_SOURCE_DIR}/src/libyang.h.in ${PROJECT_BINARY_DIR}/src/libyang.h @ONLY) configure_file(${PROJECT_SOURCE_DIR}/src/common.h.in ${PROJECT_BINARY_DIR}/src/common.h @ONLY) @@ -133,11 +155,6 @@ endif() # static build requires static libpcre library option(ENABLE_STATIC "Build static (.a) library" OFF) -# check the supported platform -if(NOT UNIX) - message(FATAL_ERROR "Only *nix like systems are supported.") -endif() - set(libsrc src/common.c src/context.c @@ -191,14 +208,6 @@ set(headers src/xml.h src/dict.h) -# compatibility checks -check_symbol_exists(vdprintf "stdio.h;stdarg.h" HAVE_VDPRINTF) -if(HAVE_VDPRINTF) - add_definitions(-DHAVE_VDPRINTF) -endif() - -TEST_BIG_ENDIAN(BIG_ENDIAN) - # create static libyang library if(ENABLE_STATIC) add_definitions(-DSTATIC) diff --git a/src/common.c b/src/common.c index dcb78bafc..52c4bfca5 100755 --- a/src/common.c +++ b/src/common.c @@ -13,6 +13,7 @@ */ #define _GNU_SOURCE +#define _ISOC99_SOURCE /* vsnprintf */ #include #include @@ -20,6 +21,8 @@ #include #include #include +#include +#include #include #include #include @@ -32,6 +35,89 @@ THREAD_LOCAL enum int_log_opts log_opt; THREAD_LOCAL int8_t ly_errno_glob; +#ifndef HAVE_VDPRINTF +int +vdprintf(int fd, const char *format, va_list ap) +{ + FILE *stream; + int count; + + stream = fdopen(dup(fd), "a+"); + if (stream) { + count = vfprintf(stream, format, ap); + fclose(stream); + } + return count; +} +#endif + +#ifndef HAVE_ASPRINTF +int +asprintf(char **strp, const char *fmt, ...) +{ + int ret; + va_list ap; + + va_start(ap, fmt); + ret = vasprintf(strp, fmt, ap); + va_end(ap); + return ret; +} +#endif + +#ifndef HAVE_VASPRINTF +int +vasprintf(char **strp, const char *fmt, va_list ap) +{ + va_list ap2; + va_copy(ap2, ap); + int l = vsnprintf(0, 0, fmt, ap2); + va_end(ap2); + + if (l < 0 || !(*strp = malloc(l + 1U))) { + return -1; + } + + return vsnprintf(*strp, l + 1U, fmt, ap); +} +#endif + +#ifndef HAVE_STRNDUP +char * +strndup(const char *s, size_t n) +{ + char *buf; + size_t len = 0; + + /* strnlen */ + for (; (len < n) && (s[len] != '\0'); ++len); + + if (!(buf = malloc(len + 1U))) { + return NULL; + } + + memcpy(buf, s, len); + buf[len] = '\0'; + return buf; +} +#endif + +#ifndef HAVE_GET_CURRENT_DIR_NAME +char * +get_current_dir_name(void) +{ + char tmp[PATH_MAX]; + char *retval; + + if (getcwd(tmp, sizeof(tmp))) { + retval = strdup(tmp); + LY_CHECK_ERR_RETURN(!retval, LOGMEM(NULL), NULL); + return retval; + } + return NULL; +} +#endif + API LY_ERR * ly_errno_glob_address(void) { @@ -157,24 +243,6 @@ ly_err_clean(struct ly_ctx *ctx, struct ly_err_item *eitem) } } -#ifndef __USE_GNU - -char * -get_current_dir_name(void) -{ - char tmp[PATH_MAX]; - char *retval; - - if (getcwd(tmp, sizeof(tmp))) { - retval = strdup(tmp); - LY_CHECK_ERR_RETURN(!retval, LOGMEM(NULL), NULL); - return retval; - } - return NULL; -} - -#endif - const char * strpbrk_backwards(const char *s, const char *accept, unsigned int s_len) { diff --git a/src/common.h.in b/src/common.h.in index 364d70bc8..4bb5bee8a 100755 --- a/src/common.h.in +++ b/src/common.h.in @@ -55,6 +55,12 @@ # endif #endif +#cmakedefine HAVE_VDPRINTF +#cmakedefine HAVE_ASPRINTF +#cmakedefine HAVE_VASPRINTF +#cmakedefine HAVE_STRNDUP +#cmakedefine HAVE_GET_CURRENT_DIR_NAME + #define bswap64(val) \ ( (((val) >> 56) & 0x00000000000000FF) | (((val) >> 40) & 0x000000000000FF00) | \ (((val) >> 24) & 0x0000000000FF0000) | (((val) >> 8) & 0x00000000FF000000) | \ @@ -90,12 +96,24 @@ */ #define API __attribute__((visibility("default"))) -#ifndef __USE_GNU -/* - * If we don't have GNU extension, implement these function on your own - */ -char *get_current_dir_name(void); +#ifndef HAVE_VDPRINTF +int vdprintf(int fd, const char *format, va_list ap); +#endif + +#ifndef HAVE_ASPRINTF +int asprintf(char **strp, const char *fmt, ...); +#endif + +#ifndef HAVE_VASPRINTF +int vasprintf(char **strp, const char *fmt, va_list ap); +#endif +#ifndef HAVE_STRNDUP +char *strndup(const char *s, size_t n); +#endif + +#ifndef HAVE_GET_CURRENT_DIR_NAME +char *get_current_dir_name(void); #endif /* how many bytes add when enlarging buffers */ diff --git a/src/printer.c b/src/printer.c index 0301ec00c..7e15a1c01 100644 --- a/src/printer.c +++ b/src/printer.c @@ -83,23 +83,12 @@ ly_print(struct lyout *out, const char *format, ...) int count = 0; char *msg = NULL, *aux; va_list ap; -#ifndef HAVE_VDPRINTF - FILE *stream; -#endif va_start(ap, format); switch (out->type) { case LYOUT_FD: -#ifdef HAVE_VDPRINTF count = vdprintf(out->method.fd, format, ap); -#else - stream = fdopen(dup(out->method.fd), "a+"); - if (stream) { - count = vfprintf(stream, format, ap); - fclose(stream); - } -#endif break; case LYOUT_STREAM: count = vfprintf(out->method.f, format, ap); From e4cf2737673996a186b5154137aeda20a1c2e117 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 2 Apr 2020 17:30:25 +0200 Subject: [PATCH 073/134] build CHANGE make yangre tool optional Mostly because it uses getline that may not be avilable on all systems. Refs #1051 --- CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f5cc07fd..600aa02de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,7 @@ option(ENABLE_LATEST_REVISIONS "Enable reusing of latest revisions of schemas" O option(ENABLE_LYD_PRIV "Add a private pointer also to struct lyd_node (data node structure), just like in struct lys_node, for arbitrary user data" OFF) option(ENABLE_FUZZ_TARGETS "Build target programs suitable for fuzzing with AFL" OFF) set(PLUGINS_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libyang" CACHE STRING "Directory with libyang plugins (extensions and user types)") +option(BUILD_YANGRE "Build yangre regext testing tool" ON) if(ENABLE_CACHE) set(LY_ENABLED_CACHE 1) @@ -354,10 +355,12 @@ install(TARGETS yanglint DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES ${PROJECT_SOURCE_DIR}/tools/lint/yanglint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) #yangre -add_executable(yangre ${resrc}) -target_link_libraries(yangre yang) -install(TARGETS yangre DESTINATION ${CMAKE_INSTALL_BINDIR}) -install(FILES ${PROJECT_SOURCE_DIR}/tools/re/yangre.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) +if(BUILD_YANGRE) + add_executable(yangre ${resrc}) + target_link_libraries(yangre yang) + install(TARGETS yangre DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(FILES ${PROJECT_SOURCE_DIR}/tools/re/yangre.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) +endif() # yang2yin add_executable(yang2yin ${yang2yinsrc}) From b655819c2f27216f11b91d089dad8824abc40bf1 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 2 Apr 2020 17:31:17 +0200 Subject: [PATCH 074/134] SOVERSION bump to version 1.6.28 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 600aa02de..ad9088ba9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 27) +set(LIBYANG_MICRO_SOVERSION 28) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 125ecf447d02f1047d229be147aa7e1acbaee079 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 2 Apr 2020 17:31:28 +0200 Subject: [PATCH 075/134] VERSION bump to version 1.0.152 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ad9088ba9..ddfd330d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 151) +set(LIBYANG_MICRO_VERSION 152) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 51826ade55bfec02662e518c957de1840256a3e4 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 3 Apr 2020 10:26:10 +0200 Subject: [PATCH 076/134] tree schema MAINTENANCE remove obsolete includes --- src/tree_schema.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/tree_schema.h b/src/tree_schema.h index 81238b0a9..d43db86c4 100644 --- a/src/tree_schema.h +++ b/src/tree_schema.h @@ -15,14 +15,6 @@ #ifndef LY_TREE_SCHEMA_H_ #define LY_TREE_SCHEMA_H_ -#ifdef __APPLE__ - #include -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) - #include -#else - #include -#endif - #include #include #include From 0c5ec1bf4a0c7c49afe4f8b32951b105130c8177 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 3 Apr 2020 10:27:26 +0200 Subject: [PATCH 077/134] compat CHANGE separate compatibility functions Refs #1051 --- CMakeLists.txt | 18 ++-- src/common.c | 0 src/common.h.in | 1 + src/compat.c | 153 +++++++++++++++++++++++++++++++ src/compat.h.in | 106 +++++++++++++++++++++ src/parser.c | 0 src/printer_yang.c | 0 src/tree_schema.c | 0 src/user_types/CMakeLists.txt | 2 +- src/user_types/user_inet_types.c | 1 + src/user_types/user_yang_types.c | 1 + tools/lint/commands.c | 1 + tools/lint/main.c | 1 + tools/re/main.c | 1 + 14 files changed, 276 insertions(+), 9 deletions(-) mode change 100755 => 100644 src/common.c mode change 100755 => 100644 src/common.h.in create mode 100644 src/compat.c create mode 100644 src/compat.h.in mode change 100755 => 100644 src/parser.c mode change 100755 => 100644 src/printer_yang.c mode change 100755 => 100644 src/tree_schema.c diff --git a/CMakeLists.txt b/CMakeLists.txt index ddfd330d5..c9a948d6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,7 +65,6 @@ option(ENABLE_LATEST_REVISIONS "Enable reusing of latest revisions of schemas" O option(ENABLE_LYD_PRIV "Add a private pointer also to struct lyd_node (data node structure), just like in struct lys_node, for arbitrary user data" OFF) option(ENABLE_FUZZ_TARGETS "Build target programs suitable for fuzzing with AFL" OFF) set(PLUGINS_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libyang" CACHE STRING "Directory with libyang plugins (extensions and user types)") -option(BUILD_YANGRE "Build yangre regext testing tool" ON) if(ENABLE_CACHE) set(LY_ENABLED_CACHE 1) @@ -105,6 +104,7 @@ check_symbol_exists(get_current_dir_name "unistd.h" HAVE_GET_CURRENT_DIR_NAME) list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200809L) check_symbol_exists(strndup "string.h" HAVE_STRNDUP) +check_symbol_exists(getline "stdio.h" HAVE_GETLINE) unset(CMAKE_REQUIRED_DEFINITIONS) @@ -112,6 +112,7 @@ TEST_BIG_ENDIAN(BIG_ENDIAN) include_directories(${PROJECT_BINARY_DIR}/src ${PROJECT_SOURCE_DIR}/src) configure_file(${PROJECT_SOURCE_DIR}/src/libyang.h.in ${PROJECT_BINARY_DIR}/src/libyang.h @ONLY) +configure_file(${PROJECT_SOURCE_DIR}/src/compat.h.in ${PROJECT_BINARY_DIR}/src/compat.h @ONLY) configure_file(${PROJECT_SOURCE_DIR}/src/common.h.in ${PROJECT_BINARY_DIR}/src/common.h @ONLY) set(EXTENSIONS_PLUGINS_DIR_MACRO "${PLUGINS_DIR}/extensions") @@ -157,6 +158,7 @@ endif() option(ENABLE_STATIC "Build static (.a) library" OFF) set(libsrc + src/compat.c src/common.c src/context.c src/log.c @@ -193,10 +195,12 @@ set(lintsrc tools/lint/commands.c tools/lint/completion.c tools/lint/configuration.c + src/compat.c linenoise/linenoise.c) set(resrc - tools/re/main.c) + tools/re/main.c + src/compat.c) set(yang2yinsrc tools/yang2yin/main.c) @@ -355,12 +359,10 @@ install(TARGETS yanglint DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES ${PROJECT_SOURCE_DIR}/tools/lint/yanglint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) #yangre -if(BUILD_YANGRE) - add_executable(yangre ${resrc}) - target_link_libraries(yangre yang) - install(TARGETS yangre DESTINATION ${CMAKE_INSTALL_BINDIR}) - install(FILES ${PROJECT_SOURCE_DIR}/tools/re/yangre.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) -endif() +add_executable(yangre ${resrc}) +target_link_libraries(yangre yang) +install(TARGETS yangre DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(FILES ${PROJECT_SOURCE_DIR}/tools/re/yangre.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) # yang2yin add_executable(yang2yin ${yang2yinsrc}) diff --git a/src/common.c b/src/common.c old mode 100755 new mode 100644 diff --git a/src/common.h.in b/src/common.h.in old mode 100755 new mode 100644 index 4bb5bee8a..1c6cba6e5 --- a/src/common.h.in +++ b/src/common.h.in @@ -19,6 +19,7 @@ #include #include +#include "compat.h" #include "libyang.h" #include "hash_table.h" #include "resolve.h" diff --git a/src/compat.c b/src/compat.c new file mode 100644 index 000000000..70ebece30 --- /dev/null +++ b/src/compat.c @@ -0,0 +1,153 @@ +/** + * @file compat.c + * @author Michal Vasko + * @brief compatibility functions + * + * Copyright (c) 2020 CESNET, z.s.p.o. + * + * This source code is licensed under BSD 3-Clause License (the "License"). + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://opensource.org/licenses/BSD-3-Clause + */ +#define _POSIX_C_SOURCE 1 /* fdopen, _POSIX_PATH_MAX */ +#define _ISOC99_SOURCE /* vsnprintf */ +#define _XOPEN_SOURCE 500 /* strdup */ + +#include +#include +#include +#include +#include +#include +#include + +#include "compat.h" + +#ifndef HAVE_VDPRINTF +int +vdprintf(int fd, const char *format, va_list ap) +{ + FILE *stream; + int count; + + stream = fdopen(dup(fd), "a+"); + if (stream) { + count = vfprintf(stream, format, ap); + fclose(stream); + } + return count; +} +#endif + +#ifndef HAVE_ASPRINTF +int +asprintf(char **strp, const char *fmt, ...) +{ + int ret; + va_list ap; + + va_start(ap, fmt); + ret = vasprintf(strp, fmt, ap); + va_end(ap); + return ret; +} +#endif + +#ifndef HAVE_VASPRINTF +int +vasprintf(char **strp, const char *fmt, va_list ap) +{ + va_list ap2; + va_copy(ap2, ap); + int l = vsnprintf(0, 0, fmt, ap2); + va_end(ap2); + + if (l < 0 || !(*strp = malloc(l + 1U))) { + return -1; + } + + return vsnprintf(*strp, l + 1U, fmt, ap); +} +#endif + +#ifndef HAVE_STRNDUP +char * +strndup(const char *s, size_t n) +{ + char *buf; + size_t len = 0; + + /* strnlen */ + for (; (len < n) && (s[len] != '\0'); ++len); + + if (!(buf = malloc(len + 1U))) { + return NULL; + } + + memcpy(buf, s, len); + buf[len] = '\0'; + return buf; +} +#endif + +#ifndef HAVE_GETLINE +ssize_t +getline(char **lineptr, size_t *n, FILE *stream) +{ + static char line[256]; + char *ptr; + unsigned int len; + + if (!lineptr || !n) { + errno = EINVAL; + return -1; + } + + if (ferror(stream) || feof(stream)) { + return -1; + } + + if (!fgets(line, 256, stream)) { + return -1; + } + + ptr = strchr(line, '\n'); + if (ptr) { + *ptr = '\0'; + } + + len = strlen(line); + + if (len + 1 < 256) { + ptr = realloc(*lineptr, 256); + if (!ptr) { + return -1; + } + *lineptr = ptr; + *n = 256; + } + + strcpy(*lineptr, line); + return len; +} +#endif + +#ifndef HAVE_GET_CURRENT_DIR_NAME +char * +get_current_dir_name(void) +{ + char tmp[_POSIX_PATH_MAX]; + char *retval = NULL; + + if (getcwd(tmp, sizeof(tmp))) { + retval = strdup(tmp); + if (!retval) { + errno = ENOMEM; + } + } + + return retval; +} +#endif diff --git a/src/compat.h.in b/src/compat.h.in new file mode 100644 index 000000000..19782fe96 --- /dev/null +++ b/src/compat.h.in @@ -0,0 +1,106 @@ +/** + * @file compat.h + * @author Michal Vasko + * @brief compatibility functions header + * + * Copyright (c) 2020 CESNET, z.s.p.o. + * + * This source code is licensed under BSD 3-Clause License (the "License"). + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://opensource.org/licenses/BSD-3-Clause + */ + +#ifndef LY_COMPAT_H_ +#define LY_COMPAT_H_ + +#include +#include +#include + +#if __STDC_VERSION__ >= 201112 && \ + !defined __STDC_NO_THREADS__ && \ + !defined __NetBSD__ +# define THREAD_LOCAL _Thread_local +#elif defined __GNUC__ || \ + defined __SUNPRO_C || \ + defined __xlC__ +# define THREAD_LOCAL __thread +#else +# error "Cannot define THREAD_LOCAL" +#endif + +#ifndef __WORDSIZE +# if defined __x86_64__ && !defined __ILP32__ +# define __WORDSIZE 64 +# else +# define __WORDSIZE 32 +# endif +#endif + +#ifndef __INT64_C +# if __WORDSIZE == 64 +# define __INT64_C(c) c ## L +# define __UINT64_C(c) c ## UL +# else +# define __INT64_C(c) c ## LL +# define __UINT64_C(c) c ## ULL +# endif +#endif + +#cmakedefine HAVE_VDPRINTF +#cmakedefine HAVE_ASPRINTF +#cmakedefine HAVE_VASPRINTF +#cmakedefine HAVE_STRNDUP +#cmakedefine HAVE_GETLINE +#cmakedefine HAVE_GET_CURRENT_DIR_NAME + +#define bswap64(val) \ + ( (((val) >> 56) & 0x00000000000000FF) | (((val) >> 40) & 0x000000000000FF00) | \ + (((val) >> 24) & 0x0000000000FF0000) | (((val) >> 8) & 0x00000000FF000000) | \ + (((val) << 8) & 0x000000FF00000000) | (((val) << 24) & 0x0000FF0000000000) | \ + (((val) << 40) & 0x00FF000000000000) | (((val) << 56) & 0xFF00000000000000) ) + +#undef le64toh +#undef htole64 + +#cmakedefine BIG_ENDIAN + +#ifdef BIG_ENDIAN +# define le64toh(x) (x) +# define htole64(x) (x) +#else +# define le64toh(x) bswap64(x) +# define htole64(x) bswap64(x) +#endif + +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif /* !MAP_ANONYMOUS */ + +#ifndef HAVE_VDPRINTF +int vdprintf(int fd, const char *format, va_list ap); +#endif + +#ifndef HAVE_ASPRINTF +int asprintf(char **strp, const char *fmt, ...); +#endif + +#ifndef HAVE_VASPRINTF +int vasprintf(char **strp, const char *fmt, va_list ap); +#endif + +#ifndef HAVE_STRNDUP +char *strndup(const char *s, size_t n); +#endif + +#ifndef HAVE_GETLINE +ssize_t getline(char **lineptr, size_t *n, FILE *stream); +#endif + +#ifndef HAVE_GET_CURRENT_DIR_NAME +char *get_current_dir_name(void); +#endif + +#endif /* LY_COMPAT_H_ */ diff --git a/src/parser.c b/src/parser.c old mode 100755 new mode 100644 diff --git a/src/printer_yang.c b/src/printer_yang.c old mode 100755 new mode 100644 diff --git a/src/tree_schema.c b/src/tree_schema.c old mode 100755 new mode 100644 diff --git a/src/user_types/CMakeLists.txt b/src/user_types/CMakeLists.txt index 74aae322e..200848246 100644 --- a/src/user_types/CMakeLists.txt +++ b/src/user_types/CMakeLists.txt @@ -6,5 +6,5 @@ macro(USER_TYPE_PLUGIN PLUGIN_NAME SRCS) endmacro(USER_TYPE_PLUGIN) foreach(USER_TYPE ${USER_TYPE_LIST}) - USER_TYPE_PLUGIN(${USER_TYPE} "${USER_TYPE}.c") + USER_TYPE_PLUGIN(${USER_TYPE} "${USER_TYPE}.c;../compat.c") endforeach() diff --git a/src/user_types/user_inet_types.c b/src/user_types/user_inet_types.c index 7b0cc7dfb..627c60262 100644 --- a/src/user_types/user_inet_types.c +++ b/src/user_types/user_inet_types.c @@ -21,6 +21,7 @@ #include #include +#include "../src/compat.h" #include "../user_types.h" /** diff --git a/src/user_types/user_yang_types.c b/src/user_types/user_yang_types.c index d0d29be18..5dcda9397 100644 --- a/src/user_types/user_yang_types.c +++ b/src/user_types/user_yang_types.c @@ -20,6 +20,7 @@ #include #include +#include "../src/compat.h" #include "../user_types.h" /** diff --git a/tools/lint/commands.c b/tools/lint/commands.c index a23cb4a61..a740d91cd 100644 --- a/tools/lint/commands.c +++ b/tools/lint/commands.c @@ -23,6 +23,7 @@ #include #include +#include "compat.h" #include "commands.h" #include "libyang.h" #include "../../src/tree_schema.h" diff --git a/tools/lint/main.c b/tools/lint/main.c index f41879a6f..46cd8242f 100644 --- a/tools/lint/main.c +++ b/tools/lint/main.c @@ -18,6 +18,7 @@ #include #include +#include "compat.h" #include "commands.h" #include "configuration.h" #include "completion.h" diff --git a/tools/re/main.c b/tools/re/main.c index 7f81970b9..b223e44d0 100644 --- a/tools/re/main.c +++ b/tools/re/main.c @@ -23,6 +23,7 @@ #include #include +#include "compat.h" #include "libyang.h" void From 93ecf90c5c4d1f1cfded37f9645874d1b2a23d62 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 3 Apr 2020 10:28:05 +0200 Subject: [PATCH 078/134] SOVERSION bump to version 1.6.29 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c9a948d6f..3d3b90a5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 28) +set(LIBYANG_MICRO_SOVERSION 29) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From d6c2aee1994cc5cae50188f97a62e4b74c8f6457 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 3 Apr 2020 10:28:16 +0200 Subject: [PATCH 079/134] VERSION bump to version 1.0.153 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d3b90a5d..44a2b7130 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 152) +set(LIBYANG_MICRO_VERSION 153) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From b9a008a3d9f16583ff8c5860eb2f67a5aa9e1e97 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 3 Apr 2020 15:40:05 +0200 Subject: [PATCH 080/134] dict BUGFIX use value length after resize ... because we are again comparing a possibly unterminated string. Refs #1045 --- src/hash_table.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/hash_table.c b/src/hash_table.c index 59c1c4c4b..c1905d593 100644 --- a/src/hash_table.c +++ b/src/hash_table.c @@ -192,7 +192,7 @@ lydict_remove(struct ly_ctx *ctx, const char *value) } static int -lydict_resize_val_eq(void *val1_p, void *val2_p, int UNUSED(mod), void *UNUSED(cb_data)) +lydict_resize_val_eq(void *val1_p, void *val2_p, int mod, void *cb_data) { if (!val1_p || !val2_p) { LOGARG; @@ -207,8 +207,14 @@ lydict_resize_val_eq(void *val1_p, void *val2_p, int UNUSED(mod), void *UNUSED(c return 0; } - if (strcmp(str1, str2) == 0) { - return 1; + if (mod) { + /* used when inserting new values */ + if (strcmp(str1, str2) == 0) { + return 1; + } + } else { + /* used when finding the original value again in the resized table */ + return lydict_val_eq(val1_p, val2_p, mod, cb_data); } return 0; From 6007ba9eccd789a5e2b4562a63166925d811b0cd Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 3 Apr 2020 15:41:14 +0200 Subject: [PATCH 081/134] SOVERSION bum pto version 1.6.30 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44a2b7130..31da167f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 29) +set(LIBYANG_MICRO_SOVERSION 30) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From e7a38a8ddf53691a4bed8943e796a936e7fae8b2 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 3 Apr 2020 15:41:24 +0200 Subject: [PATCH 082/134] VERSION bump to version 1.0.154 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31da167f8..88154dd31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 153) +set(LIBYANG_MICRO_VERSION 154) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From e5b6117a1edfe1592921e9110b357189809a1275 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 3 Apr 2020 16:09:36 +0200 Subject: [PATCH 083/134] fixup! compat CHANGE separate compatibility functions --- src/common.c | 86 +------------------------------------------------ src/common.h.in | 79 --------------------------------------------- src/compat.h.in | 2 +- 3 files changed, 2 insertions(+), 165 deletions(-) diff --git a/src/common.c b/src/common.c index 52c4bfca5..3f5ccf6f1 100644 --- a/src/common.c +++ b/src/common.c @@ -12,8 +12,7 @@ * https://opensource.org/licenses/BSD-3-Clause */ -#define _GNU_SOURCE -#define _ISOC99_SOURCE /* vsnprintf */ +#define _GNU_SOURCE /*strndup */ #include #include @@ -35,89 +34,6 @@ THREAD_LOCAL enum int_log_opts log_opt; THREAD_LOCAL int8_t ly_errno_glob; -#ifndef HAVE_VDPRINTF -int -vdprintf(int fd, const char *format, va_list ap) -{ - FILE *stream; - int count; - - stream = fdopen(dup(fd), "a+"); - if (stream) { - count = vfprintf(stream, format, ap); - fclose(stream); - } - return count; -} -#endif - -#ifndef HAVE_ASPRINTF -int -asprintf(char **strp, const char *fmt, ...) -{ - int ret; - va_list ap; - - va_start(ap, fmt); - ret = vasprintf(strp, fmt, ap); - va_end(ap); - return ret; -} -#endif - -#ifndef HAVE_VASPRINTF -int -vasprintf(char **strp, const char *fmt, va_list ap) -{ - va_list ap2; - va_copy(ap2, ap); - int l = vsnprintf(0, 0, fmt, ap2); - va_end(ap2); - - if (l < 0 || !(*strp = malloc(l + 1U))) { - return -1; - } - - return vsnprintf(*strp, l + 1U, fmt, ap); -} -#endif - -#ifndef HAVE_STRNDUP -char * -strndup(const char *s, size_t n) -{ - char *buf; - size_t len = 0; - - /* strnlen */ - for (; (len < n) && (s[len] != '\0'); ++len); - - if (!(buf = malloc(len + 1U))) { - return NULL; - } - - memcpy(buf, s, len); - buf[len] = '\0'; - return buf; -} -#endif - -#ifndef HAVE_GET_CURRENT_DIR_NAME -char * -get_current_dir_name(void) -{ - char tmp[PATH_MAX]; - char *retval; - - if (getcwd(tmp, sizeof(tmp))) { - retval = strdup(tmp); - LY_CHECK_ERR_RETURN(!retval, LOGMEM(NULL), NULL); - return retval; - } - return NULL; -} -#endif - API LY_ERR * ly_errno_glob_address(void) { diff --git a/src/common.h.in b/src/common.h.in index 1c6cba6e5..565305666 100644 --- a/src/common.h.in +++ b/src/common.h.in @@ -26,65 +26,6 @@ #define UNUSED(x) @COMPILER_UNUSED_ATTR@ -#if __STDC_VERSION__ >= 201112 && \ - !defined __STDC_NO_THREADS__ && \ - !defined __NetBSD__ -# define THREAD_LOCAL _Thread_local -#elif defined __GNUC__ || \ - defined __SUNPRO_C || \ - defined __xlC__ -# define THREAD_LOCAL __thread -#else -# error "Cannot define THREAD_LOCAL" -#endif - -#ifndef __WORDSIZE -# if defined __x86_64__ && !defined __ILP32__ -# define __WORDSIZE 64 -# else -# define __WORDSIZE 32 -# endif -#endif - -#ifndef __INT64_C -# if __WORDSIZE == 64 -# define __INT64_C(c) c ## L -# define __UINT64_C(c) c ## UL -# else -# define __INT64_C(c) c ## LL -# define __UINT64_C(c) c ## ULL -# endif -#endif - -#cmakedefine HAVE_VDPRINTF -#cmakedefine HAVE_ASPRINTF -#cmakedefine HAVE_VASPRINTF -#cmakedefine HAVE_STRNDUP -#cmakedefine HAVE_GET_CURRENT_DIR_NAME - -#define bswap64(val) \ - ( (((val) >> 56) & 0x00000000000000FF) | (((val) >> 40) & 0x000000000000FF00) | \ - (((val) >> 24) & 0x0000000000FF0000) | (((val) >> 8) & 0x00000000FF000000) | \ - (((val) << 8) & 0x000000FF00000000) | (((val) << 24) & 0x0000FF0000000000) | \ - (((val) << 40) & 0x00FF000000000000) | (((val) << 56) & 0xFF00000000000000) ) - -#undef le64toh -#undef htole64 - -#cmakedefine BIG_ENDIAN - -#ifdef BIG_ENDIAN -# define le64toh(x) (x) -# define htole64(x) (x) -#else -# define le64toh(x) bswap64(x) -# define htole64(x) bswap64(x) -#endif - -#ifndef MAP_ANONYMOUS -#define MAP_ANONYMOUS MAP_ANON -#endif /* !MAP_ANONYMOUS */ - #define LY_CHECK_GOTO(COND, GOTO) if (COND) {goto GOTO;} #define LY_CHECK_ERR_GOTO(COND, ERR, GOTO) if (COND) {ERR; goto GOTO;} #define LY_CHECK_RETURN(COND, RETVAL) if (COND) {return RETVAL;} @@ -97,26 +38,6 @@ */ #define API __attribute__((visibility("default"))) -#ifndef HAVE_VDPRINTF -int vdprintf(int fd, const char *format, va_list ap); -#endif - -#ifndef HAVE_ASPRINTF -int asprintf(char **strp, const char *fmt, ...); -#endif - -#ifndef HAVE_VASPRINTF -int vasprintf(char **strp, const char *fmt, va_list ap); -#endif - -#ifndef HAVE_STRNDUP -char *strndup(const char *s, size_t n); -#endif - -#ifndef HAVE_GET_CURRENT_DIR_NAME -char *get_current_dir_name(void); -#endif - /* how many bytes add when enlarging buffers */ #define LY_BUF_STEP 128 diff --git a/src/compat.h.in b/src/compat.h.in index 19782fe96..f60b5f521 100644 --- a/src/compat.h.in +++ b/src/compat.h.in @@ -15,7 +15,7 @@ #ifndef LY_COMPAT_H_ #define LY_COMPAT_H_ -#include +#include #include #include From 1c9515e62ef726465ce3957e524311b105cdce5a Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 3 Apr 2020 16:09:53 +0200 Subject: [PATCH 084/134] SOVERSIOn bump to version 1.6.31 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 88154dd31..634b3790f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 30) +set(LIBYANG_MICRO_SOVERSION 31) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From e057548259896f41900c651ccc75ef48d58ade42 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 3 Apr 2020 16:10:05 +0200 Subject: [PATCH 085/134] VERSION bump to version 1.0.155 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 634b3790f..41153c822 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 154) +set(LIBYANG_MICRO_VERSION 155) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 57b007e8e6cc8336b6d9000bd0c5712fe6af5289 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Mon, 6 Apr 2020 04:06:48 -0300 Subject: [PATCH 086/134] package BUGFIX fixes for CentOS 6 and 7 CentOS 6 needs all the language bindings turned off and the cache disabled as it doesn't have the needed swig version or the pcre_* functions CentOS 7 needs swig3 package instead of swig package Signed-off-by: Martin Winter Co-authored-by: Martin Winter --- packages/libyang.spec.in | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/libyang.spec.in b/packages/libyang.spec.in index 5b4dc5705..38f3b398d 100644 --- a/packages/libyang.spec.in +++ b/packages/libyang.spec.in @@ -8,12 +8,18 @@ Source1: @PACKAGE@.rpmlintrc License: BSD-3-Clause BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} -%if 0%{?scientificlinux_version} == 700 +%if 0%{?scientificlinux_version} == 700 || 0%{?centos_ver} < 7 %define with_lang_bind 0 %else %define with_lang_bind 1 %endif +%if 0%{?centos_ver} < 7 + %define with_ly_cache 0 +%else + %define with_ly_cache 1 +%endif + Requires: pcre BuildRequires: cmake BuildRequires: doxygen @@ -24,7 +30,7 @@ BuildRequires: libcmocka-devel %if %{with_lang_bind} BuildRequires: gcc-c++ -%if 0%{?centos_version} +%if 0%{?centos_version} || 0%{?centos_ver} == 7 BuildRequires: swig3 >= 3.0.12 %else BuildRequires: swig >= 3.0.12 @@ -85,12 +91,19 @@ cd build %else %define cmake_lang_bind "-DGEN_LANGUAGE_BINDINGS=OFF" %endif +%if %{with_ly_cache} + %define cmake_ly_cache "-DENABLE_CACHE=ON" +%else + %define cmake_ly_cache "-DENABLE_CACHE=OFF" +%endif + cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr \ -DCMAKE_BUILD_TYPE:String="Package" \ -DENABLE_LYD_PRIV=ON \ -DGEN_JAVA_BINDINGS=OFF \ -DGEN_JAVASCRIPT_BINDINGS=OFF \ - %{cmake_lang_bind} .. + %{cmake_lang_bind} \ + %{cmake_ly_cache} .. make %check From c45c49e19711ade5142800752899ea48bf7433a4 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 6 Apr 2020 16:02:41 +0200 Subject: [PATCH 087/134] data tree NEW function for getting real value type --- src/tree_data.c | 19 ++++++++++++------- src/tree_data.h | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/tree_data.c b/src/tree_data.c index c40c2607b..345c36a28 100644 --- a/src/tree_data.c +++ b/src/tree_data.c @@ -5246,12 +5246,18 @@ lyd_validate_modules(struct lyd_node **node, const struct lys_module **modules, API int lyd_validate_value(struct lys_node *node, const char *value) +{ + return lyd_value_type(node, value, NULL); +} + +API int +lyd_value_type(struct lys_node *node, const char *value, struct lys_type **type) { FUN_IN; struct lyd_node_leaf_list leaf; struct lys_node_leaf *sleaf = (struct lys_node_leaf*)node; - int ret = EXIT_SUCCESS; + struct lys_type *t = NULL; if (!node || !(node->nodetype & (LYS_LEAF | LYS_LEAFLIST))) { LOGARG; @@ -5274,21 +5280,20 @@ lyd_validate_value(struct lys_node *node, const char *value) if (!sleaf->type.info.lref.target) { /* it should either be unresolved leafref (leaf.value_type are ORed flags) or it will be resolved */ LOGINT(node->module->ctx); - ret = EXIT_FAILURE; goto cleanup; } sleaf = sleaf->type.info.lref.target; goto repeat; } else { - if (!lyp_parse_value(&sleaf->type, &leaf.value_str, NULL, &leaf, NULL, NULL, 0, 0)) { - ret = EXIT_FAILURE; - goto cleanup; - } + t = lyp_parse_value(&sleaf->type, &leaf.value_str, NULL, &leaf, NULL, NULL, 0, 0); } cleanup: lydict_remove(node->module->ctx, leaf.value_str); - return ret; + if (type) { + *type = t; + } + return t ? EXIT_SUCCESS : EXIT_FAILURE; } /* create an attribute copy */ diff --git a/src/tree_data.h b/src/tree_data.h index 61679757c..16083fb22 100644 --- a/src/tree_data.h +++ b/src/tree_data.h @@ -1296,6 +1296,24 @@ void lyd_free_val_diff(struct lyd_difflist *diff); */ int lyd_validate_value(struct lys_node *node, const char *value); +/** + * @brief Check restrictions applicable to the particular leaf/leaf-list on the given string value and optionally + * return its final type. + * + * Validates the value only using the types' restrictions. Do not check the rest of restrictions dependent on the + * data tree (must, when statements or uniqueness of the leaf-list item). + * + * The format of the data must follow rules for the lexical representation of the specific YANG type. Note + * that if there are some extensions of the lexical representation for the YANG module (default value), they are + * not supported by this function - it strictly follows rules for the lexical representations in data trees. + * + * @param[in] node Schema node of the leaf or leaf-list eventually holding the \p value. + * @param[in] value Value to be checked (NULL is checked as empty string). + * @param[out] type Optional resolved value type, useful mainly for unions. + * @return EXIT_SUCCESS if the \p value conforms to the restrictions, EXIT_FAILURE otherwise. + */ +int lyd_value_type(struct lys_node *node, const char *value, struct lys_type **type); + /** * @brief Get know if the node contain (despite implicit or explicit) default value. * From ed987649579c77c1eba4ce1167a4e6b83849a17c Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 6 Apr 2020 16:03:16 +0200 Subject: [PATCH 088/134] SOVERSION bump to version 1.7.0 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41153c822..3c681bfcf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,8 +29,8 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # Major version is changed with every backward non-compatible API/ABI change in libyang, minor version changes # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) -set(LIBYANG_MINOR_SOVERSION 6) -set(LIBYANG_MICRO_SOVERSION 31) +set(LIBYANG_MINOR_SOVERSION 7) +set(LIBYANG_MICRO_SOVERSION 0) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From cdab803e65d223c69f470bfa7b1eb53875a5d11a Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 6 Apr 2020 16:03:29 +0200 Subject: [PATCH 089/134] VERSION bump to version 1.0.156 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c681bfcf..33cd31e4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 155) +set(LIBYANG_MICRO_VERSION 156) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 337bb9fa82dddd19e879ceb55435017bbb22014c Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 7 Apr 2020 10:38:38 +0200 Subject: [PATCH 090/134] parse CHANGE identiy without namespace is not internal error Refs #1057 --- src/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser.c b/src/parser.c index ddb420421..2c3a3afdf 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1177,7 +1177,7 @@ ident_val_add_module_prefix(const char *value, const struct lyxml_elem *xml, str if (!ns) { /* no default namespace */ - LOGINT(ctx); + LOGERR(ctx, LY_EINVAL, "Identity \"%s\" has no namespace.", value); return NULL; } From e21c8bf31241449663880d23cc5519b9b588d522 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 7 Apr 2020 12:53:37 +0200 Subject: [PATCH 091/134] compat CHANGE make it a separate small object library --- CMakeLists.txt | 42 +++++++++----------------------- CMakeModules/UseCompat.cmake | 26 ++++++++++++++++++++ {src => compat}/compat.c | 0 {src => compat}/compat.h.in | 18 +++----------- src/common.h.in | 12 +++++++++ src/user_types/CMakeLists.txt | 4 +-- src/user_types/user_inet_types.c | 2 +- src/user_types/user_yang_types.c | 2 +- 8 files changed, 57 insertions(+), 49 deletions(-) create mode 100644 CMakeModules/UseCompat.cmake rename {src => compat}/compat.c (100%) rename {src => compat}/compat.h.in (85%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33cd31e4c..ceba6c598 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,9 +7,12 @@ endif() project(libyang C) +# include custom Modules +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/") + include(GNUInstallDirs) include(CheckSymbolExists) -include(TestBigEndian) +include(UseCompat) set(LIBYANG_DESCRIPTION "libyang is YANG data modelling language parser and toolkit written (and providing API) in C.") @@ -93,34 +96,13 @@ else() set(COMPILER_PACKED_ATTR "") endif() -# compatibility checks -set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200809L) -list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) -check_symbol_exists(vdprintf "stdio.h;stdarg.h" HAVE_VDPRINTF) -check_symbol_exists(asprintf "stdio.h" HAVE_ASPRINTF) -check_symbol_exists(vasprintf "stdio.h" HAVE_VASPRINTF) - -check_symbol_exists(get_current_dir_name "unistd.h" HAVE_GET_CURRENT_DIR_NAME) - -list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200809L) -check_symbol_exists(strndup "string.h" HAVE_STRNDUP) -check_symbol_exists(getline "stdio.h" HAVE_GETLINE) - -unset(CMAKE_REQUIRED_DEFINITIONS) - -TEST_BIG_ENDIAN(BIG_ENDIAN) - include_directories(${PROJECT_BINARY_DIR}/src ${PROJECT_SOURCE_DIR}/src) configure_file(${PROJECT_SOURCE_DIR}/src/libyang.h.in ${PROJECT_BINARY_DIR}/src/libyang.h @ONLY) -configure_file(${PROJECT_SOURCE_DIR}/src/compat.h.in ${PROJECT_BINARY_DIR}/src/compat.h @ONLY) configure_file(${PROJECT_SOURCE_DIR}/src/common.h.in ${PROJECT_BINARY_DIR}/src/common.h @ONLY) set(EXTENSIONS_PLUGINS_DIR_MACRO "${PLUGINS_DIR}/extensions") set(USER_TYPES_PLUGINS_DIR_MACRO "${PLUGINS_DIR}/user_types") -# include custom Modules -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/") - # setup bindings set(GEN_LANGUAGE_BINDINGS 0 CACHE BOOL "Enable language bindings generation.") set(GEN_CPP_BINDINGS 1 CACHE BOOL "Enable C++ bindings.") @@ -158,7 +140,6 @@ endif() option(ENABLE_STATIC "Build static (.a) library" OFF) set(libsrc - src/compat.c src/common.c src/context.c src/log.c @@ -195,12 +176,10 @@ set(lintsrc tools/lint/commands.c tools/lint/completion.c tools/lint/configuration.c - src/compat.c linenoise/linenoise.c) set(resrc - tools/re/main.c - src/compat.c) + tools/re/main.c) set(yang2yinsrc tools/yang2yin/main.c) @@ -213,6 +192,9 @@ set(headers src/xml.h src/dict.h) +# link compat +use_compat() + # create static libyang library if(ENABLE_STATIC) add_definitions(-DSTATIC) @@ -220,7 +202,7 @@ if(ENABLE_STATIC) set(CMAKE_FIND_LIBRARY_SUFFIXES .a) set(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS) # remove -Wl,-Bdynamic set(CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS) - add_library(yang STATIC ${libsrc}) + add_library(yang STATIC ${libsrc} compat) # switch off the tests if(ENABLE_BUILD_TESTS) @@ -235,7 +217,7 @@ if(ENABLE_STATIC) else() set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) add_library(yangobj OBJECT ${libsrc}) - add_library(yang SHARED $) + add_library(yang SHARED $ compat) #only for tests with visible internal symbols add_library(yangobj_tests OBJECT ${libsrc}) @@ -354,13 +336,13 @@ configure_file(${PROJECT_SOURCE_DIR}/src/plugin_config.h.in ${PROJECT_BINARY_DIR # yanglint add_executable(yanglint ${lintsrc}) -target_link_libraries(yanglint yang) +target_link_libraries(yanglint yang compat) install(TARGETS yanglint DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES ${PROJECT_SOURCE_DIR}/tools/lint/yanglint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) #yangre add_executable(yangre ${resrc}) -target_link_libraries(yangre yang) +target_link_libraries(yangre yang compat) install(TARGETS yangre DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES ${PROJECT_SOURCE_DIR}/tools/re/yangre.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) diff --git a/CMakeModules/UseCompat.cmake b/CMakeModules/UseCompat.cmake new file mode 100644 index 000000000..358271c18 --- /dev/null +++ b/CMakeModules/UseCompat.cmake @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 2.8.12) + +include(CheckSymbolExists) +include(TestBigEndian) + +macro(USE_COMPAT) + # compatibility checks + set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200809L) + list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) + check_symbol_exists(vdprintf "stdio.h;stdarg.h" HAVE_VDPRINTF) + check_symbol_exists(asprintf "stdio.h" HAVE_ASPRINTF) + check_symbol_exists(vasprintf "stdio.h" HAVE_VASPRINTF) + + check_symbol_exists(get_current_dir_name "unistd.h" HAVE_GET_CURRENT_DIR_NAME) + + list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200809L) + check_symbol_exists(strndup "string.h" HAVE_STRNDUP) + check_symbol_exists(getline "stdio.h" HAVE_GETLINE) + + TEST_BIG_ENDIAN(BIG_ENDIAN) + + # header and object file + configure_file(${PROJECT_SOURCE_DIR}/compat/compat.h.in ${PROJECT_BINARY_DIR}/compat.h @ONLY) + include_directories(${PROJECT_BINARY_DIR}) + add_library(compat OBJECT ${PROJECT_SOURCE_DIR}/compat/compat.c) +endmacro() diff --git a/src/compat.c b/compat/compat.c similarity index 100% rename from src/compat.c rename to compat/compat.c diff --git a/src/compat.h.in b/compat/compat.h.in similarity index 85% rename from src/compat.h.in rename to compat/compat.h.in index f60b5f521..947b0aae2 100644 --- a/src/compat.h.in +++ b/compat/compat.h.in @@ -12,25 +12,13 @@ * https://opensource.org/licenses/BSD-3-Clause */ -#ifndef LY_COMPAT_H_ -#define LY_COMPAT_H_ +#ifndef _COMPAT_H_ +#define _COMPAT_H_ #include #include #include -#if __STDC_VERSION__ >= 201112 && \ - !defined __STDC_NO_THREADS__ && \ - !defined __NetBSD__ -# define THREAD_LOCAL _Thread_local -#elif defined __GNUC__ || \ - defined __SUNPRO_C || \ - defined __xlC__ -# define THREAD_LOCAL __thread -#else -# error "Cannot define THREAD_LOCAL" -#endif - #ifndef __WORDSIZE # if defined __x86_64__ && !defined __ILP32__ # define __WORDSIZE 64 @@ -103,4 +91,4 @@ ssize_t getline(char **lineptr, size_t *n, FILE *stream); char *get_current_dir_name(void); #endif -#endif /* LY_COMPAT_H_ */ +#endif /* _COMPAT_H_ */ diff --git a/src/common.h.in b/src/common.h.in index 565305666..c585ad911 100644 --- a/src/common.h.in +++ b/src/common.h.in @@ -24,6 +24,18 @@ #include "hash_table.h" #include "resolve.h" +#if __STDC_VERSION__ >= 201112 && \ + !defined __STDC_NO_THREADS__ && \ + !defined __NetBSD__ +# define THREAD_LOCAL _Thread_local +#elif defined __GNUC__ || \ + defined __SUNPRO_C || \ + defined __xlC__ +# define THREAD_LOCAL __thread +#else +# error "Cannot define THREAD_LOCAL" +#endif + #define UNUSED(x) @COMPILER_UNUSED_ATTR@ #define LY_CHECK_GOTO(COND, GOTO) if (COND) {goto GOTO;} diff --git a/src/user_types/CMakeLists.txt b/src/user_types/CMakeLists.txt index 200848246..74c37ec10 100644 --- a/src/user_types/CMakeLists.txt +++ b/src/user_types/CMakeLists.txt @@ -1,10 +1,10 @@ macro(USER_TYPE_PLUGIN PLUGIN_NAME SRCS) add_library(${PLUGIN_NAME} SHARED ${SRCS}) set_target_properties(${PLUGIN_NAME} PROPERTIES PREFIX "") - target_link_libraries(${PLUGIN_NAME} yang) + target_link_libraries(${PLUGIN_NAME} yang compat) install(TARGETS ${PLUGIN_NAME} DESTINATION ${USER_TYPES_PLUGINS_DIR_MACRO}) endmacro(USER_TYPE_PLUGIN) foreach(USER_TYPE ${USER_TYPE_LIST}) - USER_TYPE_PLUGIN(${USER_TYPE} "${USER_TYPE}.c;../compat.c") + USER_TYPE_PLUGIN(${USER_TYPE} ${USER_TYPE}.c) endforeach() diff --git a/src/user_types/user_inet_types.c b/src/user_types/user_inet_types.c index 627c60262..b7f2e2811 100644 --- a/src/user_types/user_inet_types.c +++ b/src/user_types/user_inet_types.c @@ -21,7 +21,7 @@ #include #include -#include "../src/compat.h" +#include "compat.h" #include "../user_types.h" /** diff --git a/src/user_types/user_yang_types.c b/src/user_types/user_yang_types.c index 5dcda9397..fb882daa7 100644 --- a/src/user_types/user_yang_types.c +++ b/src/user_types/user_yang_types.c @@ -20,7 +20,7 @@ #include #include -#include "../src/compat.h" +#include "compat.h" #include "../user_types.h" /** From 466b34fe29f11662ce7b1868f0c27a0a4a304995 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 8 Apr 2020 08:10:20 +0200 Subject: [PATCH 092/134] build BUGFIX link compat as objects Fixes #1058 --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ceba6c598..0c133b3a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,7 +202,7 @@ if(ENABLE_STATIC) set(CMAKE_FIND_LIBRARY_SUFFIXES .a) set(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS) # remove -Wl,-Bdynamic set(CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS) - add_library(yang STATIC ${libsrc} compat) + add_library(yang STATIC ${libsrc} $) # switch off the tests if(ENABLE_BUILD_TESTS) @@ -217,7 +217,7 @@ if(ENABLE_STATIC) else() set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) add_library(yangobj OBJECT ${libsrc}) - add_library(yang SHARED $ compat) + add_library(yang SHARED $ $) #only for tests with visible internal symbols add_library(yangobj_tests OBJECT ${libsrc}) @@ -336,13 +336,13 @@ configure_file(${PROJECT_SOURCE_DIR}/src/plugin_config.h.in ${PROJECT_BINARY_DIR # yanglint add_executable(yanglint ${lintsrc}) -target_link_libraries(yanglint yang compat) +target_link_libraries(yanglint yang $) install(TARGETS yanglint DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES ${PROJECT_SOURCE_DIR}/tools/lint/yanglint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) #yangre add_executable(yangre ${resrc}) -target_link_libraries(yangre yang compat) +target_link_libraries(yangre yang $) install(TARGETS yangre DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES ${PROJECT_SOURCE_DIR}/tools/re/yangre.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) From fe22b668f6c5bcedf6e6da9c357047d46b8057e3 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 8 Apr 2020 09:47:14 +0200 Subject: [PATCH 093/134] fixup! build BUGFIX link compat as objects --- src/user_types/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/user_types/CMakeLists.txt b/src/user_types/CMakeLists.txt index 74c37ec10..187937392 100644 --- a/src/user_types/CMakeLists.txt +++ b/src/user_types/CMakeLists.txt @@ -1,7 +1,7 @@ macro(USER_TYPE_PLUGIN PLUGIN_NAME SRCS) add_library(${PLUGIN_NAME} SHARED ${SRCS}) set_target_properties(${PLUGIN_NAME} PROPERTIES PREFIX "") - target_link_libraries(${PLUGIN_NAME} yang compat) + target_link_libraries(${PLUGIN_NAME} yang $) install(TARGETS ${PLUGIN_NAME} DESTINATION ${USER_TYPES_PLUGINS_DIR_MACRO}) endmacro(USER_TYPE_PLUGIN) From 66e24167336099640b168e4659ca737298d384da Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 8 Apr 2020 13:52:14 +0200 Subject: [PATCH 094/134] context BUGFIX fix old yang-library revision ... to match the one in the RFC --- src/context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/context.c b/src/context.c index b20ba5836..926874d10 100644 --- a/src/context.c +++ b/src/context.c @@ -1778,7 +1778,7 @@ ly_ctx_info(struct ly_ctx *ctx) LOGERR(ctx, LY_EINVAL, "ietf-yang-library is not implemented."); return NULL; } - if (mod->rev && !strcmp(mod->rev[0].date, "2016-04-09")) { + if (mod->rev && !strcmp(mod->rev[0].date, "2016-06-21")) { bis = 0; } else if (mod->rev && !strcmp(mod->rev[0].date, IETF_YANG_LIB_REV)) { bis = 1; From 3f376e9614ba512c9ace36d5e2321c6f92884ff8 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 8 Apr 2020 13:52:57 +0200 Subject: [PATCH 095/134] context CHANGE use released ietf-datastores revision --- models/ietf-datastores@2017-08-17.h | 262 ---------------- models/ietf-datastores@2018-02-14.h | 285 ++++++++++++++++++ ...7.yang => ietf-datastores@2018-02-14.yang} | 36 ++- src/context.c | 4 +- tests/schema/test_conformance.c | 8 +- 5 files changed, 308 insertions(+), 287 deletions(-) delete mode 100644 models/ietf-datastores@2017-08-17.h create mode 100644 models/ietf-datastores@2018-02-14.h rename models/{ietf-datastores@2017-08-17.yang => ietf-datastores@2018-02-14.yang} (66%) diff --git a/models/ietf-datastores@2017-08-17.h b/models/ietf-datastores@2017-08-17.h deleted file mode 100644 index 335b30822..000000000 --- a/models/ietf-datastores@2017-08-17.h +++ /dev/null @@ -1,262 +0,0 @@ -unsigned char ietf_datastores_2017_08_17_yin[] = { - 0x3c, 0x3f, 0x78, 0x6d, 0x6c, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x3d, 0x22, 0x31, 0x2e, 0x30, 0x22, 0x20, 0x65, 0x6e, 0x63, 0x6f, - 0x64, 0x69, 0x6e, 0x67, 0x3d, 0x22, 0x55, 0x54, 0x46, 0x2d, 0x38, 0x22, - 0x3f, 0x3e, 0x0a, 0x3c, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x20, 0x78, - 0x6d, 0x6c, 0x6e, 0x73, 0x3d, 0x22, 0x75, 0x72, 0x6e, 0x3a, 0x69, 0x65, - 0x74, 0x66, 0x3a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x78, 0x6d, - 0x6c, 0x3a, 0x6e, 0x73, 0x3a, 0x79, 0x61, 0x6e, 0x67, 0x3a, 0x79, 0x69, - 0x6e, 0x3a, 0x31, 0x22, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x64, - 0x73, 0x3d, 0x22, 0x75, 0x72, 0x6e, 0x3a, 0x69, 0x65, 0x74, 0x66, 0x3a, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x78, 0x6d, 0x6c, 0x3a, 0x6e, - 0x73, 0x3a, 0x79, 0x61, 0x6e, 0x67, 0x3a, 0x69, 0x65, 0x74, 0x66, 0x2d, - 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x22, 0x20, - 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x69, 0x65, 0x74, 0x66, 0x2d, 0x64, - 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x22, 0x3e, 0x3c, - 0x79, 0x61, 0x6e, 0x67, 0x2d, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3d, 0x22, 0x31, 0x2e, 0x31, 0x22, - 0x2f, 0x3e, 0x3c, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x20, 0x75, 0x72, 0x69, 0x3d, 0x22, 0x75, 0x72, 0x6e, 0x3a, 0x69, 0x65, - 0x74, 0x66, 0x3a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x78, 0x6d, - 0x6c, 0x3a, 0x6e, 0x73, 0x3a, 0x79, 0x61, 0x6e, 0x67, 0x3a, 0x69, 0x65, - 0x74, 0x66, 0x2d, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x73, 0x22, 0x2f, 0x3e, 0x3c, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3d, 0x22, 0x64, 0x73, 0x22, 0x2f, 0x3e, - 0x3c, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x49, 0x45, 0x54, 0x46, - 0x20, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x4d, 0x6f, 0x64, - 0x65, 0x6c, 0x69, 0x6e, 0x67, 0x20, 0x28, 0x4e, 0x45, 0x54, 0x4d, 0x4f, - 0x44, 0x29, 0x20, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, - 0x2f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x3e, 0x3c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x3e, 0x3c, - 0x74, 0x65, 0x78, 0x74, 0x3e, 0x57, 0x47, 0x20, 0x57, 0x65, 0x62, 0x3a, - 0x20, 0x20, 0x20, 0x26, 0x6c, 0x74, 0x3b, 0x68, 0x74, 0x74, 0x70, 0x73, - 0x3a, 0x2f, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x74, 0x72, 0x61, 0x63, 0x6b, - 0x65, 0x72, 0x2e, 0x69, 0x65, 0x74, 0x66, 0x2e, 0x6f, 0x72, 0x67, 0x2f, - 0x77, 0x67, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x6f, 0x64, 0x2f, 0x26, 0x67, - 0x74, 0x3b, 0x0a, 0x0a, 0x57, 0x47, 0x20, 0x4c, 0x69, 0x73, 0x74, 0x3a, - 0x20, 0x20, 0x26, 0x6c, 0x74, 0x3b, 0x6d, 0x61, 0x69, 0x6c, 0x74, 0x6f, - 0x3a, 0x6e, 0x65, 0x74, 0x6d, 0x6f, 0x64, 0x40, 0x69, 0x65, 0x74, 0x66, - 0x2e, 0x6f, 0x72, 0x67, 0x26, 0x67, 0x74, 0x3b, 0x0a, 0x0a, 0x41, 0x75, - 0x74, 0x68, 0x6f, 0x72, 0x3a, 0x20, 0x20, 0x20, 0x4d, 0x61, 0x72, 0x74, - 0x69, 0x6e, 0x20, 0x42, 0x6a, 0x6f, 0x72, 0x6b, 0x6c, 0x75, 0x6e, 0x64, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x26, - 0x6c, 0x74, 0x3b, 0x6d, 0x61, 0x69, 0x6c, 0x74, 0x6f, 0x3a, 0x6d, 0x62, - 0x6a, 0x40, 0x74, 0x61, 0x69, 0x6c, 0x2d, 0x66, 0x2e, 0x63, 0x6f, 0x6d, - 0x26, 0x67, 0x74, 0x3b, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x3a, 0x20, 0x20, 0x20, 0x4a, 0x75, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x20, - 0x53, 0x63, 0x68, 0x6f, 0x65, 0x6e, 0x77, 0x61, 0x65, 0x6c, 0x64, 0x65, - 0x72, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x26, 0x6c, 0x74, 0x3b, 0x6d, 0x61, 0x69, 0x6c, 0x74, 0x6f, 0x3a, 0x6a, - 0x2e, 0x73, 0x63, 0x68, 0x6f, 0x65, 0x6e, 0x77, 0x61, 0x65, 0x6c, 0x64, - 0x65, 0x72, 0x40, 0x6a, 0x61, 0x63, 0x6f, 0x62, 0x73, 0x2d, 0x75, 0x6e, - 0x69, 0x76, 0x65, 0x72, 0x73, 0x69, 0x74, 0x79, 0x2e, 0x64, 0x65, 0x26, - 0x67, 0x74, 0x3b, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x3a, - 0x20, 0x20, 0x20, 0x50, 0x68, 0x69, 0x6c, 0x20, 0x53, 0x68, 0x61, 0x66, - 0x65, 0x72, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x26, 0x6c, 0x74, 0x3b, 0x6d, 0x61, 0x69, 0x6c, 0x74, 0x6f, 0x3a, - 0x70, 0x68, 0x69, 0x6c, 0x40, 0x6a, 0x75, 0x6e, 0x69, 0x70, 0x65, 0x72, - 0x2e, 0x6e, 0x65, 0x74, 0x26, 0x67, 0x74, 0x3b, 0x0a, 0x0a, 0x41, 0x75, - 0x74, 0x68, 0x6f, 0x72, 0x3a, 0x20, 0x20, 0x20, 0x4b, 0x65, 0x6e, 0x74, - 0x20, 0x57, 0x61, 0x74, 0x73, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x26, 0x6c, 0x74, 0x3b, 0x6d, 0x61, - 0x69, 0x6c, 0x74, 0x6f, 0x3a, 0x6b, 0x77, 0x61, 0x74, 0x73, 0x65, 0x6e, - 0x40, 0x6a, 0x75, 0x6e, 0x69, 0x70, 0x65, 0x72, 0x2e, 0x6e, 0x65, 0x74, - 0x26, 0x67, 0x74, 0x3b, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x3a, 0x20, 0x20, 0x20, 0x52, 0x6f, 0x62, 0x20, 0x57, 0x69, 0x6c, 0x74, - 0x6f, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x26, 0x6c, 0x74, 0x3b, 0x72, 0x77, 0x69, 0x6c, 0x74, 0x6f, 0x6e, - 0x40, 0x63, 0x69, 0x73, 0x63, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x26, 0x67, - 0x74, 0x3b, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x3e, 0x3c, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x3c, 0x74, 0x65, 0x78, - 0x74, 0x3e, 0x54, 0x68, 0x69, 0x73, 0x20, 0x59, 0x41, 0x4e, 0x47, 0x20, - 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, - 0x65, 0x73, 0x20, 0x74, 0x77, 0x6f, 0x20, 0x73, 0x65, 0x74, 0x73, 0x20, - 0x6f, 0x66, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, - 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, - 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x0a, 0x54, 0x68, 0x65, 0x20, 0x66, 0x69, - 0x72, 0x73, 0x74, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, - 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x61, 0x74, 0x61, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x6d, 0x73, 0x65, - 0x6c, 0x76, 0x65, 0x73, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x65, - 0x63, 0x6f, 0x6e, 0x64, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x73, 0x20, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x20, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, - 0x2e, 0x0a, 0x0a, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, - 0x20, 0x28, 0x63, 0x29, 0x20, 0x32, 0x30, 0x31, 0x37, 0x20, 0x49, 0x45, - 0x54, 0x46, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x61, 0x6e, 0x64, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x73, - 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, - 0x61, 0x73, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x73, 0x20, 0x6f, - 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x20, - 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, - 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0a, 0x0a, 0x52, - 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, - 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, - 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, - 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x73, - 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x72, 0x0a, 0x77, 0x69, - 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x69, 0x73, 0x20, 0x70, - 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x70, 0x75, 0x72, - 0x73, 0x75, 0x61, 0x6e, 0x74, 0x20, 0x74, 0x6f, 0x2c, 0x20, 0x61, 0x6e, - 0x64, 0x20, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x74, 0x6f, - 0x0a, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, - 0x20, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x2c, 0x20, 0x74, 0x68, 0x65, - 0x20, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, - 0x42, 0x53, 0x44, 0x20, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x20, - 0x73, 0x65, 0x74, 0x0a, 0x66, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x69, 0x6e, - 0x20, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x34, 0x2e, 0x63, - 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x49, 0x45, 0x54, 0x46, - 0x20, 0x54, 0x72, 0x75, 0x73, 0x74, 0x27, 0x73, 0x20, 0x4c, 0x65, 0x67, - 0x61, 0x6c, 0x20, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, - 0x73, 0x0a, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x74, - 0x6f, 0x20, 0x49, 0x45, 0x54, 0x46, 0x20, 0x44, 0x6f, 0x63, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x0a, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, - 0x2f, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x65, 0x2e, 0x69, 0x65, 0x74, - 0x66, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, - 0x65, 0x2d, 0x69, 0x6e, 0x66, 0x6f, 0x29, 0x2e, 0x0a, 0x0a, 0x54, 0x68, - 0x69, 0x73, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, - 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x59, 0x41, 0x4e, 0x47, 0x20, - 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x20, 0x69, 0x73, 0x20, 0x70, 0x61, - 0x72, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x52, 0x46, 0x43, 0x20, 0x58, 0x58, - 0x58, 0x58, 0x0a, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, - 0x77, 0x77, 0x2e, 0x72, 0x66, 0x63, 0x2d, 0x65, 0x64, 0x69, 0x74, 0x6f, - 0x72, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x72, - 0x66, 0x63, 0x78, 0x78, 0x78, 0x78, 0x29, 0x3b, 0x20, 0x73, 0x65, 0x65, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x52, 0x46, 0x43, 0x20, 0x69, 0x74, 0x73, - 0x65, 0x6c, 0x66, 0x0a, 0x66, 0x6f, 0x72, 0x20, 0x66, 0x75, 0x6c, 0x6c, - 0x20, 0x6c, 0x65, 0x67, 0x61, 0x6c, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, - 0x65, 0x73, 0x2e, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, - 0x3c, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x61, - 0x74, 0x65, 0x3d, 0x22, 0x32, 0x30, 0x31, 0x37, 0x2d, 0x30, 0x38, 0x2d, - 0x31, 0x37, 0x22, 0x3e, 0x3c, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x49, - 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x72, 0x65, 0x76, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x2e, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, - 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x3e, 0x3c, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x3e, - 0x3c, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x52, 0x46, 0x43, 0x20, 0x58, 0x58, - 0x58, 0x58, 0x3a, 0x20, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x20, - 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x44, - 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x20, 0x41, 0x72, 0x63, - 0x68, 0x69, 0x74, 0x65, 0x63, 0x74, 0x75, 0x72, 0x65, 0x3c, 0x2f, 0x74, - 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x3e, 0x3c, 0x2f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, - 0x6f, 0x6e, 0x3e, 0x3c, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x64, 0x61, 0x74, 0x61, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x22, 0x3e, 0x3c, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, - 0x3e, 0x41, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x20, 0x62, 0x61, - 0x73, 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, - 0x66, 0x6f, 0x72, 0x20, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, - 0x2e, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x3c, 0x2f, - 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x3e, 0x3c, 0x69, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, - 0x22, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x22, 0x3e, 0x3c, 0x62, 0x61, 0x73, 0x65, 0x20, 0x6e, 0x61, 0x6d, - 0x65, 0x3d, 0x22, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x22, 0x2f, 0x3e, 0x3c, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x41, 0x62, - 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x20, 0x62, 0x61, 0x73, 0x65, 0x20, - 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x66, 0x6f, 0x72, - 0x20, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x73, 0x2e, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, - 0x3c, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x3e, 0x3c, - 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x6e, 0x61, 0x6d, - 0x65, 0x3d, 0x22, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x22, 0x3e, - 0x3c, 0x62, 0x61, 0x73, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, - 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x22, 0x2f, 0x3e, 0x3c, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x54, 0x68, - 0x65, 0x20, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, - 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x3c, 0x2f, - 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x3c, 0x2f, 0x69, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x74, 0x79, 0x3e, 0x3c, 0x69, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x74, 0x79, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x63, 0x61, - 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x22, 0x3e, 0x3c, 0x62, 0x61, - 0x73, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x63, 0x6f, 0x6e, - 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0x2f, 0x3e, - 0x3c, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x54, 0x68, 0x65, 0x20, 0x63, - 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x20, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, - 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x3c, 0x2f, 0x74, - 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x3c, 0x2f, 0x69, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x74, 0x79, 0x3e, 0x3c, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x74, 0x79, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x75, 0x70, 0x22, 0x3e, 0x3c, 0x62, 0x61, 0x73, 0x65, 0x20, - 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x6e, - 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0x2f, 0x3e, 0x3c, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x3c, 0x74, - 0x65, 0x78, 0x74, 0x3e, 0x54, 0x68, 0x65, 0x20, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x75, 0x70, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, - 0x6f, 0x72, 0x65, 0x2e, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, - 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x3e, 0x3c, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x3e, - 0x3c, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x6e, 0x61, - 0x6d, 0x65, 0x3d, 0x22, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, - 0x22, 0x3e, 0x3c, 0x62, 0x61, 0x73, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, - 0x3d, 0x22, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x22, 0x2f, 0x3e, 0x3c, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x3e, - 0x54, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, - 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x2e, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x3c, 0x2f, - 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x3e, 0x3c, 0x69, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, - 0x22, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x22, 0x3e, 0x3c, 0x62, - 0x61, 0x73, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x64, 0x61, - 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x2f, 0x3e, 0x3c, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x3c, - 0x74, 0x65, 0x78, 0x74, 0x3e, 0x41, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, - 0x74, 0x20, 0x62, 0x61, 0x73, 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x74, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x64, 0x79, 0x6e, 0x61, - 0x6d, 0x69, 0x63, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, - 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, - 0x3c, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x3e, 0x3c, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x3e, 0x3c, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x6e, - 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0x3e, 0x3c, 0x62, 0x61, 0x73, 0x65, 0x20, - 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, - 0x6f, 0x72, 0x65, 0x22, 0x2f, 0x3e, 0x3c, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x3c, 0x74, 0x65, 0x78, 0x74, - 0x3e, 0x54, 0x68, 0x65, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x64, - 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x3c, 0x2f, 0x74, - 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x3c, 0x2f, 0x69, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x74, 0x79, 0x3e, 0x3c, 0x74, 0x79, 0x70, 0x65, 0x64, 0x65, - 0x66, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x64, 0x61, 0x74, 0x61, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2d, 0x72, 0x65, 0x66, 0x22, 0x3e, 0x3c, - 0x74, 0x79, 0x70, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x69, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x72, 0x65, 0x66, 0x22, 0x3e, - 0x3c, 0x62, 0x61, 0x73, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, - 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x2f, 0x3e, - 0x3c, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x3e, 0x3c, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x3c, 0x74, 0x65, 0x78, - 0x74, 0x3e, 0x41, 0x20, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x72, - 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x3c, 0x2f, 0x74, - 0x65, 0x78, 0x74, 0x3e, 0x3c, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x3c, 0x2f, 0x74, 0x79, 0x70, 0x65, - 0x64, 0x65, 0x66, 0x3e, 0x3c, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, - 0x3e, 0x00 -}; diff --git a/models/ietf-datastores@2018-02-14.h b/models/ietf-datastores@2018-02-14.h new file mode 100644 index 000000000..8da121fc6 --- /dev/null +++ b/models/ietf-datastores@2018-02-14.h @@ -0,0 +1,285 @@ +unsigned char ietf_datastores_2018_02_14_yin[] = { + 0x3c, 0x3f, 0x78, 0x6d, 0x6c, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x3d, 0x22, 0x31, 0x2e, 0x30, 0x22, 0x20, 0x65, 0x6e, 0x63, 0x6f, + 0x64, 0x69, 0x6e, 0x67, 0x3d, 0x22, 0x55, 0x54, 0x46, 0x2d, 0x38, 0x22, + 0x3f, 0x3e, 0x0a, 0x3c, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x20, 0x6e, + 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x69, 0x65, 0x74, 0x66, 0x2d, 0x64, 0x61, + 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x22, 0x0a, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3d, + 0x22, 0x75, 0x72, 0x6e, 0x3a, 0x69, 0x65, 0x74, 0x66, 0x3a, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x78, 0x6d, 0x6c, 0x3a, 0x6e, 0x73, 0x3a, + 0x79, 0x61, 0x6e, 0x67, 0x3a, 0x79, 0x69, 0x6e, 0x3a, 0x31, 0x22, 0x0a, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x78, 0x6d, 0x6c, 0x6e, + 0x73, 0x3a, 0x64, 0x73, 0x3d, 0x22, 0x75, 0x72, 0x6e, 0x3a, 0x69, 0x65, + 0x74, 0x66, 0x3a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x78, 0x6d, + 0x6c, 0x3a, 0x6e, 0x73, 0x3a, 0x79, 0x61, 0x6e, 0x67, 0x3a, 0x69, 0x65, + 0x74, 0x66, 0x2d, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0x73, 0x22, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x79, 0x61, 0x6e, 0x67, 0x2d, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3d, 0x22, 0x31, 0x2e, 0x31, 0x22, 0x2f, 0x3e, 0x0a, 0x20, 0x20, + 0x3c, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x75, + 0x72, 0x69, 0x3d, 0x22, 0x75, 0x72, 0x6e, 0x3a, 0x69, 0x65, 0x74, 0x66, + 0x3a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x78, 0x6d, 0x6c, 0x3a, + 0x6e, 0x73, 0x3a, 0x79, 0x61, 0x6e, 0x67, 0x3a, 0x69, 0x65, 0x74, 0x66, + 0x2d, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x22, + 0x2f, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, + 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3d, 0x22, 0x64, 0x73, 0x22, 0x2f, + 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, + 0x74, 0x65, 0x78, 0x74, 0x3e, 0x49, 0x45, 0x54, 0x46, 0x20, 0x4e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x69, + 0x6e, 0x67, 0x20, 0x28, 0x4e, 0x45, 0x54, 0x4d, 0x4f, 0x44, 0x29, 0x20, + 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x3c, + 0x2f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, + 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x74, 0x65, 0x78, 0x74, + 0x3e, 0x57, 0x47, 0x20, 0x57, 0x65, 0x62, 0x3a, 0x20, 0x20, 0x20, 0x26, + 0x6c, 0x74, 0x3b, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, + 0x61, 0x74, 0x61, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x2e, 0x69, + 0x65, 0x74, 0x66, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x77, 0x67, 0x2f, 0x6e, + 0x65, 0x74, 0x6d, 0x6f, 0x64, 0x2f, 0x26, 0x67, 0x74, 0x3b, 0x0a, 0x0a, + 0x57, 0x47, 0x20, 0x4c, 0x69, 0x73, 0x74, 0x3a, 0x20, 0x20, 0x26, 0x6c, + 0x74, 0x3b, 0x6d, 0x61, 0x69, 0x6c, 0x74, 0x6f, 0x3a, 0x6e, 0x65, 0x74, + 0x6d, 0x6f, 0x64, 0x40, 0x69, 0x65, 0x74, 0x66, 0x2e, 0x6f, 0x72, 0x67, + 0x26, 0x67, 0x74, 0x3b, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x3a, 0x20, 0x20, 0x20, 0x4d, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x20, 0x42, + 0x6a, 0x6f, 0x72, 0x6b, 0x6c, 0x75, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x26, 0x6c, 0x74, 0x3b, 0x6d, + 0x61, 0x69, 0x6c, 0x74, 0x6f, 0x3a, 0x6d, 0x62, 0x6a, 0x40, 0x74, 0x61, + 0x69, 0x6c, 0x2d, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x26, 0x67, 0x74, 0x3b, + 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x3a, 0x20, 0x20, 0x20, + 0x4a, 0x75, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x20, 0x53, 0x63, 0x68, 0x6f, + 0x65, 0x6e, 0x77, 0x61, 0x65, 0x6c, 0x64, 0x65, 0x72, 0x0a, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x26, 0x6c, 0x74, 0x3b, + 0x6d, 0x61, 0x69, 0x6c, 0x74, 0x6f, 0x3a, 0x6a, 0x2e, 0x73, 0x63, 0x68, + 0x6f, 0x65, 0x6e, 0x77, 0x61, 0x65, 0x6c, 0x64, 0x65, 0x72, 0x40, 0x6a, + 0x61, 0x63, 0x6f, 0x62, 0x73, 0x2d, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x74, 0x79, 0x2e, 0x64, 0x65, 0x26, 0x67, 0x74, 0x3b, 0x0a, + 0x0a, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x3a, 0x20, 0x20, 0x20, 0x50, + 0x68, 0x69, 0x6c, 0x20, 0x53, 0x68, 0x61, 0x66, 0x65, 0x72, 0x0a, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x26, 0x6c, 0x74, + 0x3b, 0x6d, 0x61, 0x69, 0x6c, 0x74, 0x6f, 0x3a, 0x70, 0x68, 0x69, 0x6c, + 0x40, 0x6a, 0x75, 0x6e, 0x69, 0x70, 0x65, 0x72, 0x2e, 0x6e, 0x65, 0x74, + 0x26, 0x67, 0x74, 0x3b, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x3a, 0x20, 0x20, 0x20, 0x4b, 0x65, 0x6e, 0x74, 0x20, 0x57, 0x61, 0x74, + 0x73, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x26, 0x6c, 0x74, 0x3b, 0x6d, 0x61, 0x69, 0x6c, 0x74, 0x6f, + 0x3a, 0x6b, 0x77, 0x61, 0x74, 0x73, 0x65, 0x6e, 0x40, 0x6a, 0x75, 0x6e, + 0x69, 0x70, 0x65, 0x72, 0x2e, 0x6e, 0x65, 0x74, 0x26, 0x67, 0x74, 0x3b, + 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x3a, 0x20, 0x20, 0x20, + 0x52, 0x6f, 0x62, 0x20, 0x57, 0x69, 0x6c, 0x74, 0x6f, 0x6e, 0x0a, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x26, 0x6c, 0x74, + 0x3b, 0x72, 0x77, 0x69, 0x6c, 0x74, 0x6f, 0x6e, 0x40, 0x63, 0x69, 0x73, + 0x63, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x26, 0x67, 0x74, 0x3b, 0x3c, 0x2f, + 0x74, 0x65, 0x78, 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x2f, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x63, 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x54, 0x68, 0x69, + 0x73, 0x20, 0x59, 0x41, 0x4e, 0x47, 0x20, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x61, 0x20, + 0x73, 0x65, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x69, 0x65, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x69, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x79, 0x69, 0x6e, 0x67, 0x0a, 0x64, 0x61, + 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x0a, 0x0a, 0x43, + 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, + 0x20, 0x32, 0x30, 0x31, 0x38, 0x20, 0x49, 0x45, 0x54, 0x46, 0x20, 0x54, + 0x72, 0x75, 0x73, 0x74, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, + 0x20, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x61, 0x73, 0x0a, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, + 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x20, 0x20, 0x41, 0x6c, 0x6c, + 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0a, 0x0a, 0x52, 0x65, 0x64, 0x69, 0x73, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, + 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x69, 0x6e, 0x61, + 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2c, 0x20, 0x77, 0x69, + 0x74, 0x68, 0x20, 0x6f, 0x72, 0x0a, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, + 0x74, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2c, 0x20, 0x69, 0x73, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, + 0x74, 0x74, 0x65, 0x64, 0x20, 0x70, 0x75, 0x72, 0x73, 0x75, 0x61, 0x6e, + 0x74, 0x20, 0x74, 0x6f, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x74, 0x6f, 0x0a, 0x74, 0x68, 0x65, + 0x20, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x20, 0x74, 0x65, 0x72, + 0x6d, 0x73, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x64, + 0x20, 0x69, 0x6e, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x53, 0x69, 0x6d, + 0x70, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x42, 0x53, 0x44, 0x20, + 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x20, 0x73, 0x65, 0x74, 0x0a, + 0x66, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x69, 0x6e, 0x20, 0x53, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x34, 0x2e, 0x63, 0x20, 0x6f, 0x66, 0x20, + 0x74, 0x68, 0x65, 0x20, 0x49, 0x45, 0x54, 0x46, 0x20, 0x54, 0x72, 0x75, + 0x73, 0x74, 0x27, 0x73, 0x20, 0x4c, 0x65, 0x67, 0x61, 0x6c, 0x20, 0x50, + 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x52, 0x65, + 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x49, 0x45, + 0x54, 0x46, 0x20, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x0a, 0x28, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x74, 0x72, + 0x75, 0x73, 0x74, 0x65, 0x65, 0x2e, 0x69, 0x65, 0x74, 0x66, 0x2e, 0x6f, + 0x72, 0x67, 0x2f, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x2d, 0x69, + 0x6e, 0x66, 0x6f, 0x29, 0x2e, 0x0a, 0x0a, 0x54, 0x68, 0x69, 0x73, 0x20, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, + 0x68, 0x69, 0x73, 0x20, 0x59, 0x41, 0x4e, 0x47, 0x20, 0x6d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x20, 0x69, 0x73, 0x20, 0x70, 0x61, 0x72, 0x74, 0x20, + 0x6f, 0x66, 0x20, 0x52, 0x46, 0x43, 0x20, 0x38, 0x33, 0x34, 0x32, 0x0a, + 0x28, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, + 0x2e, 0x72, 0x66, 0x63, 0x2d, 0x65, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, + 0x6f, 0x72, 0x67, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x72, 0x66, 0x63, + 0x38, 0x33, 0x34, 0x32, 0x29, 0x3b, 0x20, 0x73, 0x65, 0x65, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x52, 0x46, 0x43, 0x20, 0x69, 0x74, 0x73, 0x65, 0x6c, + 0x66, 0x0a, 0x66, 0x6f, 0x72, 0x20, 0x66, 0x75, 0x6c, 0x6c, 0x20, 0x6c, + 0x65, 0x67, 0x61, 0x6c, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x73, + 0x2e, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x3c, + 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x20, 0x64, 0x61, 0x74, 0x65, 0x3d, 0x22, 0x32, 0x30, 0x31, 0x38, + 0x2d, 0x30, 0x32, 0x2d, 0x31, 0x34, 0x22, 0x3e, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x3c, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x74, 0x65, + 0x78, 0x74, 0x3e, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x72, + 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x3c, 0x2f, 0x74, 0x65, + 0x78, 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x74, 0x65, + 0x78, 0x74, 0x3e, 0x52, 0x46, 0x43, 0x20, 0x38, 0x33, 0x34, 0x32, 0x3a, + 0x20, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x4d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x44, 0x61, 0x74, 0x61, + 0x73, 0x74, 0x6f, 0x72, 0x65, 0x20, 0x41, 0x72, 0x63, 0x68, 0x69, 0x74, + 0x65, 0x63, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x4e, 0x4d, 0x44, 0x41, + 0x29, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x3c, 0x2f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, + 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x2f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, + 0x6f, 0x6e, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x64, 0x61, + 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x3e, 0x0a, 0x20, 0x20, + 0x20, 0x20, 0x3c, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x74, + 0x65, 0x78, 0x74, 0x3e, 0x41, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, + 0x20, 0x62, 0x61, 0x73, 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x64, 0x61, 0x74, 0x61, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x69, 0x65, 0x73, 0x2e, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x0a, + 0x20, 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x2f, 0x69, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x3e, 0x0a, 0x20, 0x20, 0x3c, + 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x6e, 0x61, 0x6d, + 0x65, 0x3d, 0x22, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, + 0x6e, 0x61, 0x6c, 0x22, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x62, + 0x61, 0x73, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x64, 0x61, + 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x2f, 0x3e, 0x0a, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, + 0x74, 0x65, 0x78, 0x74, 0x3e, 0x41, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, + 0x74, 0x20, 0x62, 0x61, 0x73, 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x76, + 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x64, + 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x3c, 0x2f, + 0x74, 0x65, 0x78, 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x2f, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, + 0x0a, 0x20, 0x20, 0x3c, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x72, 0x75, 0x6e, + 0x6e, 0x69, 0x6e, 0x67, 0x22, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, + 0x62, 0x61, 0x73, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x63, + 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, + 0x2f, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x54, 0x68, 0x65, + 0x20, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, + 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x3c, 0x2f, 0x74, + 0x65, 0x78, 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x64, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, + 0x20, 0x20, 0x3c, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x63, 0x61, 0x6e, 0x64, + 0x69, 0x64, 0x61, 0x74, 0x65, 0x22, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x3c, 0x62, 0x61, 0x73, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, + 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, + 0x22, 0x2f, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x54, 0x68, + 0x65, 0x20, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x20, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x20, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, + 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x3c, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x69, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x75, 0x70, 0x22, 0x3e, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x3c, 0x62, 0x61, 0x73, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, + 0x22, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, + 0x6c, 0x22, 0x2f, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x54, + 0x68, 0x65, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x75, 0x70, 0x20, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x20, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x3c, + 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, + 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x69, 0x6e, + 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x22, 0x3e, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x3c, 0x62, 0x61, 0x73, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, + 0x22, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, + 0x6c, 0x22, 0x2f, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x54, + 0x68, 0x65, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x20, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x20, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, + 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x3c, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x69, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x64, + 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x22, 0x3e, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x3c, 0x62, 0x61, 0x73, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, + 0x22, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x2f, + 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x41, 0x62, 0x73, 0x74, + 0x72, 0x61, 0x63, 0x74, 0x20, 0x62, 0x61, 0x73, 0x65, 0x20, 0x69, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x64, + 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x61, 0x74, + 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x3c, 0x2f, 0x74, 0x65, + 0x78, 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, + 0x20, 0x3c, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x3e, + 0x0a, 0x20, 0x20, 0x3c, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x6f, 0x70, 0x65, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0x3e, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x3c, 0x62, 0x61, 0x73, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, + 0x22, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x2f, + 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x3c, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x54, 0x68, 0x65, 0x20, + 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x2e, 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x3e, 0x0a, + 0x20, 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, 0x20, 0x3c, 0x2f, 0x69, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x3e, 0x0a, 0x20, 0x20, 0x3c, + 0x74, 0x79, 0x70, 0x65, 0x64, 0x65, 0x66, 0x20, 0x6e, 0x61, 0x6d, 0x65, + 0x3d, 0x22, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2d, + 0x72, 0x65, 0x66, 0x22, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x74, + 0x79, 0x70, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x69, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x72, 0x65, 0x66, 0x22, 0x3e, 0x0a, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x62, 0x61, 0x73, 0x65, 0x20, + 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x22, 0x2f, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x74, 0x65, 0x78, 0x74, + 0x3e, 0x41, 0x20, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x72, 0x65, + 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x3c, 0x2f, 0x74, 0x65, + 0x78, 0x74, 0x3e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x0a, 0x20, + 0x20, 0x3c, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x64, 0x65, 0x66, 0x3e, 0x0a, + 0x3c, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3e, 0x0a, 0x00 +}; diff --git a/models/ietf-datastores@2017-08-17.yang b/models/ietf-datastores@2018-02-14.yang similarity index 66% rename from models/ietf-datastores@2017-08-17.yang rename to models/ietf-datastores@2018-02-14.yang index 0a5a0fd83..9e875ab6a 100644 --- a/models/ietf-datastores@2017-08-17.yang +++ b/models/ietf-datastores@2018-02-14.yang @@ -27,11 +27,10 @@ module ietf-datastores { "; description - "This YANG module defines two sets of identities for datastores. - The first identifies the datastores themselves, the second - identifies datastore properties. + "This YANG module defines a set of identities for identifying + datastores. - Copyright (c) 2017 IETF Trust and the persons identified as + Copyright (c) 2018 IETF Trust and the persons identified as authors of the code. All rights reserved. Redistribution and use in source and binary forms, with or @@ -39,17 +38,17 @@ module ietf-datastores { the license terms contained in, the Simplified BSD License set forth in Section 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents - (http://trustee.ietf.org/license-info). + (https://trustee.ietf.org/license-info). - This version of this YANG module is part of RFC XXXX - (http://www.rfc-editor.org/info/rfcxxxx); see the RFC itself + This version of this YANG module is part of RFC 8342 + (https://www.rfc-editor.org/info/rfc8342); see the RFC itself for full legal notices."; - revision 2017-08-17 { + revision 2018-02-14 { description "Initial revision."; reference - "RFC XXXX: Network Management Datastore Architecture"; + "RFC 8342: Network Management Datastore Architecture (NMDA)"; } /* @@ -58,50 +57,50 @@ module ietf-datastores { identity datastore { description - "Abstract base identity for datastore identities."; + "Abstract base identity for datastore identities."; } identity conventional { base datastore; description - "Abstract base identity for conventional configuration - datastores."; + "Abstract base identity for conventional configuration + datastores."; } identity running { base conventional; description - "The running configuration datastore."; + "The running configuration datastore."; } identity candidate { base conventional; description - "The candidate configuration datastore."; + "The candidate configuration datastore."; } identity startup { base conventional; description - "The startup configuration datastore."; + "The startup configuration datastore."; } identity intended { base conventional; description - "The intended configuration datastore."; + "The intended configuration datastore."; } identity dynamic { base datastore; description - "Abstract base identity for dynamic configuration datastores."; + "Abstract base identity for dynamic configuration datastores."; } identity operational { base datastore; description - "The operational state datastore."; + "The operational state datastore."; } /* @@ -115,5 +114,4 @@ module ietf-datastores { description "A datastore identity reference."; } - } diff --git a/src/context.c b/src/context.c index 926874d10..ace20b285 100644 --- a/src/context.c +++ b/src/context.c @@ -41,7 +41,7 @@ extern unsigned int ext_plugins_ref; #define YANG_PATH "../models/yang@2017-02-20.h" #define IETF_INET_TYPES_PATH "../models/ietf-inet-types@2013-07-15.h" #define IETF_YANG_TYPES_PATH "../models/ietf-yang-types@2013-07-15.h" -#define IETF_DATASTORES "../models/ietf-datastores@2017-08-17.h" +#define IETF_DATASTORES "../models/ietf-datastores@2018-02-14.h" #define IETF_YANG_LIB_PATH "../models/ietf-yang-library@2019-01-04.h" #define IETF_YANG_LIB_REV "2019-01-04" @@ -65,7 +65,7 @@ static struct internal_modules_s { {"ietf-inet-types", "2013-07-15", (const char*)ietf_inet_types_2013_07_15_yin, 0, LYS_IN_YIN}, {"ietf-yang-types", "2013-07-15", (const char*)ietf_yang_types_2013_07_15_yin, 0, LYS_IN_YIN}, /* ietf-datastores and ietf-yang-library must be right here at the end of the list! */ - {"ietf-datastores", "2017-08-17", (const char*)ietf_datastores_2017_08_17_yin, 0, LYS_IN_YIN}, + {"ietf-datastores", "2018-02-14", (const char*)ietf_datastores_2018_02_14_yin, 0, LYS_IN_YIN}, {"ietf-yang-library", IETF_YANG_LIB_REV, (const char*)ietf_yang_library_2019_01_04_yin, 1, LYS_IN_YIN} }; diff --git a/tests/schema/test_conformance.c b/tests/schema/test_conformance.c index 9528bbc40..0b350ae18 100644 --- a/tests/schema/test_conformance.c +++ b/tests/schema/test_conformance.c @@ -185,7 +185,7 @@ test_implemented_info_yin(void **state) " \n" " \n" " ietf-datastores\n" -" 2017-08-17\n" +" 2018-02-14\n" " urn:ietf:params:xml:ns:yang:ietf-datastores\n" " \n" " \n" @@ -246,7 +246,7 @@ test_implemented_info_yin(void **state) " \n" " \n" " ietf-datastores\n" -" 2017-08-17\n" +" 2018-02-14\n" " urn:ietf:params:xml:ns:yang:ietf-datastores\n" " import\n" " \n" @@ -329,7 +329,7 @@ test_implemented_info_yang(void **state) " \n" " \n" " ietf-datastores\n" -" 2017-08-17\n" +" 2018-02-14\n" " urn:ietf:params:xml:ns:yang:ietf-datastores\n" " \n" " \n" @@ -390,7 +390,7 @@ test_implemented_info_yang(void **state) " \n" " \n" " ietf-datastores\n" -" 2017-08-17\n" +" 2018-02-14\n" " urn:ietf:params:xml:ns:yang:ietf-datastores\n" " import\n" " \n" From 9af0fa3e245e3f3482eee141b522f3593b0966cd Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 8 Apr 2020 13:53:40 +0200 Subject: [PATCH 096/134] SOVERSION bump to version 1.7.1 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c133b3a0..91cf84ffd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 7) -set(LIBYANG_MICRO_SOVERSION 0) +set(LIBYANG_MICRO_SOVERSION 1) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 06507f65ffe48ac8cc795c8aa999ada6f25f2b3e Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 8 Apr 2020 13:53:51 +0200 Subject: [PATCH 097/134] VERSION bump to version 1.0.157 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91cf84ffd..b70935cc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 156) +set(LIBYANG_MICRO_VERSION 157) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 871fd2b8748b40e5ea1987de84bb232dbb0c9fae Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 14 Apr 2020 13:13:49 +0200 Subject: [PATCH 098/134] build BUGFIX link objects to executables with sources Refs #1062 --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b70935cc7..5652cf5a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -335,14 +335,14 @@ endif() configure_file(${PROJECT_SOURCE_DIR}/src/plugin_config.h.in ${PROJECT_BINARY_DIR}/src/plugin_config.h) # yanglint -add_executable(yanglint ${lintsrc}) -target_link_libraries(yanglint yang $) +add_executable(yanglint ${lintsrc} $) +target_link_libraries(yanglint yang) install(TARGETS yanglint DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES ${PROJECT_SOURCE_DIR}/tools/lint/yanglint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) #yangre -add_executable(yangre ${resrc}) -target_link_libraries(yangre yang $) +add_executable(yangre ${resrc} $) +target_link_libraries(yangre yang) install(TARGETS yangre DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES ${PROJECT_SOURCE_DIR}/tools/re/yangre.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) From b6d1ba16f7dfb399c3f227c6a7e7aac0ce19992c Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 14 Apr 2020 13:51:33 +0200 Subject: [PATCH 099/134] fixup! build BUGFIX link objects to executables with sources --- src/user_types/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/user_types/CMakeLists.txt b/src/user_types/CMakeLists.txt index 187937392..801563762 100644 --- a/src/user_types/CMakeLists.txt +++ b/src/user_types/CMakeLists.txt @@ -1,7 +1,7 @@ macro(USER_TYPE_PLUGIN PLUGIN_NAME SRCS) - add_library(${PLUGIN_NAME} SHARED ${SRCS}) + add_library(${PLUGIN_NAME} SHARED ${SRCS} $) set_target_properties(${PLUGIN_NAME} PROPERTIES PREFIX "") - target_link_libraries(${PLUGIN_NAME} yang $) + target_link_libraries(${PLUGIN_NAME} yang) install(TARGETS ${PLUGIN_NAME} DESTINATION ${USER_TYPES_PLUGINS_DIR_MACRO}) endmacro(USER_TYPE_PLUGIN) From 61bf6feb7be3e6d27a479c9cb4c66c360377f5ac Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 17 Apr 2020 09:47:49 +0200 Subject: [PATCH 100/134] data tree BUGFIX memory leak/invalid free Fixes #1063 --- src/tree_data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tree_data.c b/src/tree_data.c index 345c36a28..a58980299 100644 --- a/src/tree_data.c +++ b/src/tree_data.c @@ -1353,7 +1353,7 @@ lyd_change_leaf(struct lyd_node_leaf_list *leaf, const char *val_str) /* parse the type correctly, makes the value canonical if needed */ if (!lyp_parse_value(&((struct lys_node_leaf *)leaf->schema)->type, &new_val, NULL, leaf, NULL, NULL, 1, 0)) { - lydict_remove(leaf->schema->module->ctx, backup); + lydict_remove(leaf->schema->module->ctx, new_val); return -1; } From f9f5eaa36925a67b8c97098fdf5ea81ca540b9c3 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 17 Apr 2020 09:48:56 +0200 Subject: [PATCH 101/134] SOVERSION bump to version 1.7.2 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5652cf5a4..6700f7b37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 7) -set(LIBYANG_MICRO_SOVERSION 1) +set(LIBYANG_MICRO_SOVERSION 2) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From aa177daa503b9e15aaae32e06c7311ebdac93a0b Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 17 Apr 2020 09:49:08 +0200 Subject: [PATCH 102/134] VERSION bump to version 1.0.158 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6700f7b37..7c97a03e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 157) +set(LIBYANG_MICRO_VERSION 158) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From f6ec2760b4c1cd40e0f63292758ea279af01f7da Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 21 Apr 2020 09:38:29 +0200 Subject: [PATCH 103/134] xpath BUGFIX overflow check Fixes #1066 --- src/xpath.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/xpath.c b/src/xpath.c index dc7c2aa5c..c7c47cdc0 100644 --- a/src/xpath.c +++ b/src/xpath.c @@ -2651,6 +2651,10 @@ parse_ncname(struct ly_ctx *ctx, const char *ncname) } do { + if ((unsigned)UINT16_MAX - parsed < size) { + LOGERR(ctx, LY_EINVAL, "XPath name cannot be longer than %ud characters.", UINT16_MAX); + return 0; + } parsed += size; if (!ncname[parsed]) { break; From 973444e66fe21f7148799c0b2743d2adea3f4449 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 21 Apr 2020 09:39:01 +0200 Subject: [PATCH 104/134] SOVERSION bump to version 1.7.3 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c97a03e9..3a11e9818 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 7) -set(LIBYANG_MICRO_SOVERSION 2) +set(LIBYANG_MICRO_SOVERSION 3) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 9f8b13bf0a1d5d32fdc000b63c8105b8722726ab Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 21 Apr 2020 09:39:16 +0200 Subject: [PATCH 105/134] VERSION bump to version 1.0.159 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a11e9818..89a327aaf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 158) +set(LIBYANG_MICRO_VERSION 159) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From fdaf0311ccc5cb29a517dfcd03ef873ed0aea1d9 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 21 Apr 2020 14:06:38 +0200 Subject: [PATCH 106/134] compat BUGFIX avoid define collision Fixes sysrepo/sysrepo#1932 --- CMakeModules/UseCompat.cmake | 2 +- compat/compat.h.in | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeModules/UseCompat.cmake b/CMakeModules/UseCompat.cmake index 358271c18..34374bba2 100644 --- a/CMakeModules/UseCompat.cmake +++ b/CMakeModules/UseCompat.cmake @@ -17,7 +17,7 @@ macro(USE_COMPAT) check_symbol_exists(strndup "string.h" HAVE_STRNDUP) check_symbol_exists(getline "stdio.h" HAVE_GETLINE) - TEST_BIG_ENDIAN(BIG_ENDIAN) + TEST_BIG_ENDIAN(IS_BIG_ENDIAN) # header and object file configure_file(${PROJECT_SOURCE_DIR}/compat/compat.h.in ${PROJECT_BINARY_DIR}/compat.h @ONLY) diff --git a/compat/compat.h.in b/compat/compat.h.in index 947b0aae2..73024f463 100644 --- a/compat/compat.h.in +++ b/compat/compat.h.in @@ -53,14 +53,14 @@ #undef le64toh #undef htole64 -#cmakedefine BIG_ENDIAN +#cmakedefine IS_BIG_ENDIAN -#ifdef BIG_ENDIAN -# define le64toh(x) (x) -# define htole64(x) (x) -#else +#ifdef IS_BIG_ENDIAN # define le64toh(x) bswap64(x) # define htole64(x) bswap64(x) +#else +# define le64toh(x) (x) +# define htole64(x) (x) #endif #ifndef MAP_ANONYMOUS From 231dd15ac8af4a588573706a6d18ac8ba31115d1 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 21 Apr 2020 14:07:22 +0200 Subject: [PATCH 107/134] SOVERSION bump to version 1.7.4 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 89a327aaf..fef6b4afb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 7) -set(LIBYANG_MICRO_SOVERSION 3) +set(LIBYANG_MICRO_SOVERSION 4) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From c675104630489829422d4083fa17537d75f99633 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 21 Apr 2020 14:07:34 +0200 Subject: [PATCH 108/134] VERSION bump to version 1.0.160 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fef6b4afb..680e8ebfc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 159) +set(LIBYANG_MICRO_VERSION 160) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From e7a15d1a3cd4148a0c8ed970ada81b476d5d46d2 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 22 Apr 2020 10:35:52 +0200 Subject: [PATCH 109/134] compat MAINTENANCE remove duplicate definition --- CMakeModules/UseCompat.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeModules/UseCompat.cmake b/CMakeModules/UseCompat.cmake index 34374bba2..339415e15 100644 --- a/CMakeModules/UseCompat.cmake +++ b/CMakeModules/UseCompat.cmake @@ -13,7 +13,6 @@ macro(USE_COMPAT) check_symbol_exists(get_current_dir_name "unistd.h" HAVE_GET_CURRENT_DIR_NAME) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200809L) check_symbol_exists(strndup "string.h" HAVE_STRNDUP) check_symbol_exists(getline "stdio.h" HAVE_GETLINE) From b0d653307f6db6d5330c9fab997ad8219bf32007 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 23 Apr 2020 09:39:42 +0200 Subject: [PATCH 110/134] parser BUGFIX out-of-bounds access for short patterns Fixes #1067 --- src/parser.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/parser.c b/src/parser.c index 2c3a3afdf..6320fb19a 100644 --- a/src/parser.c +++ b/src/parser.c @@ -833,7 +833,7 @@ lyp_check_length_range(struct ly_ctx *ctx, const char *expr, struct lys_type *ty int lyp_check_pattern(struct ly_ctx *ctx, const char *pattern, pcre **pcre_precomp) { - int idx, idx2, start, end, err_offset, count; + int idx, idx2, start, end, err_offset, count, end_anchor = 0; char *perl_regex, *ptr; const char *err_msg, *orig_ptr; pcre *precomp; @@ -853,8 +853,10 @@ lyp_check_pattern(struct ly_ctx *ctx, const char *pattern, pcre **pcre_precomp) ptr = perl_regex; - if (strncmp(pattern + strlen(pattern) - 2, ".*", 2)) { + if ((strlen(pattern) > 1) && strncmp(pattern + strlen(pattern) - 2, ".*", 2)) { /* we wil add line-end anchoring */ + end_anchor = 1; + ptr[0] = '('; ++ptr; } @@ -868,7 +870,7 @@ lyp_check_pattern(struct ly_ctx *ctx, const char *pattern, pcre **pcre_precomp) } } - if (strncmp(pattern + strlen(pattern) - 2, ".*", 2)) { + if (end_anchor) { ptr += sprintf(ptr, ")$"); } else { ptr[0] = '\0'; From b3d26ae1b5e6f4dcede06bc048a4cffb91ed2165 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 23 Apr 2020 09:40:27 +0200 Subject: [PATCH 111/134] SOVERSION bump to version 1.7.5 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 680e8ebfc..ee6805f18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 7) -set(LIBYANG_MICRO_SOVERSION 4) +set(LIBYANG_MICRO_SOVERSION 5) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From e69ffd938873f7399efe86d6e2f63741199a84d3 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 23 Apr 2020 09:40:39 +0200 Subject: [PATCH 112/134] VERSION bump to version 1.0.161 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee6805f18..016af3613 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 160) +set(LIBYANG_MICRO_VERSION 161) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 03904be846ad40dace25274ed3d1ae99797bac7a Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 24 Apr 2020 08:08:36 +0200 Subject: [PATCH 113/134] xpath BUGFIX "//" should select all top-level nodes And not just the first one. Refs sysrepo/sysrepo#1940 --- src/xpath.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/xpath.c b/src/xpath.c index c7c47cdc0..a56b63cae 100644 --- a/src/xpath.c +++ b/src/xpath.c @@ -6325,22 +6325,28 @@ moveto_self_add_children_r(const struct lyd_node *parent, uint32_t parent_pos, e struct lyxp_set *to_set, const struct lyxp_set *dup_check_set, enum lyxp_node_type root_type, int options) { - struct lyd_node *sub; + const struct lyd_node *sub; int ret; switch (parent_type) { case LYXP_NODE_ROOT: case LYXP_NODE_ROOT_CONFIG: - /* add the same node but as an element */ - if (!set_dup_node_check(dup_check_set, parent, LYXP_NODE_ELEM, -1)) { - set_insert_node(to_set, parent, 0, LYXP_NODE_ELEM, to_set->used); - - /* skip anydata/anyxml and dummy nodes */ - if (!(parent->schema->nodetype & LYS_ANYDATA) && !(parent->validity & LYD_VAL_INUSE)) { - /* also add all the children of this node, recursively */ - ret = moveto_self_add_children_r(parent, 0, LYXP_NODE_ELEM, to_set, dup_check_set, root_type, options); - if (ret) { - return ret; + /* add all top-level nodes as elements */ + LY_TREE_FOR(parent, sub) { + if ((parent_type == LYXP_NODE_ROOT_CONFIG) && (sub->schema->flags & LYS_CONFIG_R)) { + continue; + } + + if (!set_dup_node_check(dup_check_set, sub, LYXP_NODE_ELEM, -1)) { + set_insert_node(to_set, sub, 0, LYXP_NODE_ELEM, to_set->used); + + /* skip anydata/anyxml and dummy nodes */ + if (!(sub->schema->nodetype & LYS_ANYDATA) && !(sub->validity & LYD_VAL_INUSE)) { + /* also add all the children of this node, recursively */ + ret = moveto_self_add_children_r(sub, 0, LYXP_NODE_ELEM, to_set, dup_check_set, root_type, options); + if (ret) { + return ret; + } } } } From 552993e0bda5422d08194782cb2cac68aab6a737 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 24 Apr 2020 08:41:56 +0200 Subject: [PATCH 114/134] SOVERSION bump to version 1.7.6 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 016af3613..5645bb6aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 7) -set(LIBYANG_MICRO_SOVERSION 5) +set(LIBYANG_MICRO_SOVERSION 6) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 16c6b170374a0cdb5d97d8a38327d523b9602df7 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Fri, 24 Apr 2020 08:42:06 +0200 Subject: [PATCH 115/134] VERSION bump to version 1.0.162 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5645bb6aa..82e6d7aa3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 161) +set(LIBYANG_MICRO_VERSION 162) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 50f475aa6256f1b13eda93571b947f739749d753 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 27 Apr 2020 12:50:42 +0200 Subject: [PATCH 116/134] xpath BUGFIX empty set evaluation ... cannot simply be skipped. Refs sysrepo/sysrepo#1945 --- src/xpath.c | 121 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 94 insertions(+), 27 deletions(-) diff --git a/src/xpath.c b/src/xpath.c index a56b63cae..baac89103 100644 --- a/src/xpath.c +++ b/src/xpath.c @@ -1797,7 +1797,12 @@ set_canonize(struct lyxp_set *set, const struct lyxp_set *set2) struct lys_node *schema; enum int_log_opts prev_ilo; - assert(set2->type == LYXP_SET_NODE_SET); + assert((set2->type == LYXP_SET_NODE_SET) || (set2->type == LYXP_SET_EMPTY)); + + if (set2->type == LYXP_SET_EMPTY) { + /* nothing to do */ + return 0; + } if ((set2->val.nodes[0].type == LYXP_NODE_ELEM) && (set2->val.nodes[0].node->schema->nodetype & (LYS_LEAF | LYS_LEAFLIST))) { schema = set2->val.nodes[0].node->schema; @@ -6743,6 +6748,8 @@ static int moveto_op_comp(struct lyxp_set *set1, struct lyxp_set *set2, const char *op, struct lyd_node *cur_node, struct lys_module *local_mod, int options) { +#define LYXP_IS_NODE_SET_OR_EMPTY(type) (((type) == LYXP_SET_NODE_SET) || ((type) == LYXP_SET_EMPTY)) + /* * NODE SET + NODE SET = NODE SET + STRING /(1 NODE SET) 2 STRING * NODE SET + STRING = STRING + STRING /1 STRING (2 STRING) @@ -6780,35 +6787,29 @@ moveto_op_comp(struct lyxp_set *set1, struct lyxp_set *set2, const char *op, str iter1.type = LYXP_SET_EMPTY; - /* empty node-sets are always false */ - if ((set1->type == LYXP_SET_EMPTY) || (set2->type == LYXP_SET_EMPTY)) { - set_fill_boolean(set1, 0); - return EXIT_SUCCESS; - } - /* iterative evaluation with node-sets */ - if ((set1->type == LYXP_SET_NODE_SET) || (set2->type == LYXP_SET_NODE_SET)) { - if (set1->type == LYXP_SET_NODE_SET) { - if (set2->type != LYXP_SET_NODE_SET) { + if (LYXP_IS_NODE_SET_OR_EMPTY(set1->type) || LYXP_IS_NODE_SET_OR_EMPTY(set2->type)) { + if (LYXP_IS_NODE_SET_OR_EMPTY(set1->type)) { + if (!LYXP_IS_NODE_SET_OR_EMPTY(set2->type)) { /* canonize the value (wait until set1 is not node set if both are) */ if (set_canonize(set2, set1)) { return -1; } } - for (i = 0; i < set1->used; ++i) { + if (set1->type == LYXP_SET_EMPTY) { switch (set2->type) { case LYXP_SET_NUMBER: - if (set_comp_cast(&iter1, set1, LYXP_SET_NUMBER, cur_node, local_mod, i, options)) { + if (lyxp_set_cast(&iter1, LYXP_SET_NUMBER, cur_node, local_mod, options)) { return -1; } break; case LYXP_SET_BOOLEAN: - if (set_comp_cast(&iter1, set1, LYXP_SET_BOOLEAN, cur_node, local_mod, i, options)) { + if (lyxp_set_cast(&iter1, LYXP_SET_BOOLEAN, cur_node, local_mod, options)) { return -1; } break; default: - if (set_comp_cast(&iter1, set1, LYXP_SET_STRING, cur_node, local_mod, i, options)) { + if (lyxp_set_cast(&iter1, LYXP_SET_STRING, cur_node, local_mod, options)) { return -1; } break; @@ -6819,34 +6820,64 @@ moveto_op_comp(struct lyxp_set *set1, struct lyxp_set *set2, const char *op, str return -1; } - /* lazy evaluation until true */ if (iter1.val.bool) { set_fill_boolean(set1, 1); return EXIT_SUCCESS; } - } - } else { - /* canonize the value */ - if (set_canonize(set1, set2)) { - return -1; - } - for (i = 0; i < set2->used; ++i) { - switch (set1->type) { + } else { + for (i = 0; i < set1->used; ++i) { + switch (set2->type) { case LYXP_SET_NUMBER: - if (set_comp_cast(&iter2, set2, LYXP_SET_NUMBER, cur_node, local_mod, i, options)) { + if (set_comp_cast(&iter1, set1, LYXP_SET_NUMBER, cur_node, local_mod, i, options)) { return -1; } break; case LYXP_SET_BOOLEAN: - if (set_comp_cast(&iter2, set2, LYXP_SET_BOOLEAN, cur_node, local_mod, i, options)) { + if (set_comp_cast(&iter1, set1, LYXP_SET_BOOLEAN, cur_node, local_mod, i, options)) { return -1; } break; default: - if (set_comp_cast(&iter2, set2, LYXP_SET_STRING, cur_node, local_mod, i, options)) { + if (set_comp_cast(&iter1, set1, LYXP_SET_STRING, cur_node, local_mod, i, options)) { return -1; } break; + } + + if (moveto_op_comp(&iter1, set2, op, cur_node, local_mod, options)) { + set_free_content(&iter1); + return -1; + } + + /* lazy evaluation until true */ + if (iter1.val.bool) { + set_fill_boolean(set1, 1); + return EXIT_SUCCESS; + } + } + } + } else { + /* canonize the value */ + if (set_canonize(set1, set2)) { + return -1; + } + if (set2->type == LYXP_SET_EMPTY) { + switch (set1->type) { + case LYXP_SET_NUMBER: + if (lyxp_set_cast(&iter2, LYXP_SET_NUMBER, cur_node, local_mod, options)) { + return -1; + } + break; + case LYXP_SET_BOOLEAN: + if (lyxp_set_cast(&iter2, LYXP_SET_BOOLEAN, cur_node, local_mod, options)) { + return -1; + } + break; + default: + if (lyxp_set_cast(&iter2, LYXP_SET_STRING, cur_node, local_mod, options)) { + return -1; + } + break; } set_fill_set(&iter1, set1); @@ -6858,11 +6889,45 @@ moveto_op_comp(struct lyxp_set *set1, struct lyxp_set *set2, const char *op, str } set_free_content(&iter2); - /* lazy evaluation until true */ if (iter1.val.bool) { set_fill_boolean(set1, 1); return EXIT_SUCCESS; } + } else { + for (i = 0; i < set2->used; ++i) { + switch (set1->type) { + case LYXP_SET_NUMBER: + if (set_comp_cast(&iter2, set2, LYXP_SET_NUMBER, cur_node, local_mod, i, options)) { + return -1; + } + break; + case LYXP_SET_BOOLEAN: + if (set_comp_cast(&iter2, set2, LYXP_SET_BOOLEAN, cur_node, local_mod, i, options)) { + return -1; + } + break; + default: + if (set_comp_cast(&iter2, set2, LYXP_SET_STRING, cur_node, local_mod, i, options)) { + return -1; + } + break; + } + + set_fill_set(&iter1, set1); + + if (moveto_op_comp(&iter1, &iter2, op, cur_node, local_mod, options)) { + set_free_content(&iter1); + set_free_content(&iter2); + return -1; + } + set_free_content(&iter2); + + /* lazy evaluation until true */ + if (iter1.val.bool) { + set_fill_boolean(set1, 1); + return EXIT_SUCCESS; + } + } } } @@ -6939,6 +7004,8 @@ moveto_op_comp(struct lyxp_set *set1, struct lyxp_set *set2, const char *op, str } return EXIT_SUCCESS; + +#undef LYXP_IS_NODE_SET_OR_EMPTY } /** From dd1cd66572831bd949b9967953982628cabb6459 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 27 Apr 2020 12:51:55 +0200 Subject: [PATCH 117/134] SOVERSION bump to version 1.7.7 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 82e6d7aa3..379b6afbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 7) -set(LIBYANG_MICRO_SOVERSION 6) +set(LIBYANG_MICRO_SOVERSION 7) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From c10e9507afdc855bd217cd2ad82e2bb61d425df1 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 27 Apr 2020 12:52:05 +0200 Subject: [PATCH 118/134] VERSION bump to version 1.0.163 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 379b6afbb..a7bf4cd60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 162) +set(LIBYANG_MICRO_VERSION 163) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From 3463b4065f4646d137c667f6ae74aa4d06866c03 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 27 Apr 2020 15:01:40 +0200 Subject: [PATCH 119/134] xpath BUGFIX uninitialized variable --- src/xpath.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/xpath.c b/src/xpath.c index baac89103..938d2d490 100644 --- a/src/xpath.c +++ b/src/xpath.c @@ -6786,6 +6786,7 @@ moveto_op_comp(struct lyxp_set *set1, struct lyxp_set *set2, const char *op, str int64_t i; iter1.type = LYXP_SET_EMPTY; + iter2.type = LYXP_SET_EMPTY; /* iterative evaluation with node-sets */ if (LYXP_IS_NODE_SET_OR_EMPTY(set1->type) || LYXP_IS_NODE_SET_OR_EMPTY(set2->type)) { From fd11740627f8177a2c23194bd07faa760bd0e6e7 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 27 Apr 2020 15:02:12 +0200 Subject: [PATCH 120/134] SOVERSION bump to version 1.7.8 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7bf4cd60..5c48dd3b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 7) -set(LIBYANG_MICRO_SOVERSION 7) +set(LIBYANG_MICRO_SOVERSION 8) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 1c0e2761fcbabd7a346ea7b42e064f6fe0463752 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 27 Apr 2020 15:02:24 +0200 Subject: [PATCH 121/134] VERSION bump to version 1.0.164 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c48dd3b5..40e33fc89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 163) +set(LIBYANG_MICRO_VERSION 164) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From c7eabaca9e938a28f1bab75630ac938bf2ba17d7 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 30 Apr 2020 14:42:57 +0200 Subject: [PATCH 122/134] data tree BUGFIX zero new attr in all cases Refs #1075 --- src/tree_data.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tree_data.c b/src/tree_data.c index a58980299..0bf452d48 100644 --- a/src/tree_data.c +++ b/src/tree_data.c @@ -5304,7 +5304,7 @@ lyd_dup_attr(struct ly_ctx *ctx, struct lyd_node *parent, struct lyd_attr *attr) /* allocate new attr */ if (!parent->attr) { - parent->attr = malloc(sizeof *parent->attr); + parent->attr = calloc(1, sizeof *ret); ret = parent->attr; } else { for (ret = parent->attr; ret->next; ret = ret->next); @@ -5315,7 +5315,6 @@ lyd_dup_attr(struct ly_ctx *ctx, struct lyd_node *parent, struct lyd_attr *attr) /* fill new attr except */ ret->parent = parent; - ret->next = NULL; ret->annotation = attr->annotation; ret->name = lydict_insert(ctx, attr->name, 0); ret->value_str = lydict_insert(ctx, attr->value_str, 0); From 159d5e61ea8e8b7bc8fe49971b5659b061064dc1 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 30 Apr 2020 16:38:06 +0200 Subject: [PATCH 123/134] common BUGFIX do not free generated ns/prefixes on recursive fail Fixes #1077 --- src/common.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/common.c b/src/common.c index 3f5ccf6f1..52f06884e 100644 --- a/src/common.c +++ b/src/common.c @@ -254,8 +254,8 @@ transform_module_name2import_prefix(const struct lys_module *module, const char } static int -_transform_json2xml_subexp(const struct lys_module *module, const char *expr, char **out, size_t *out_used, size_t *out_size, int schema, int inst_id, const char ***prefixes, - const char ***namespaces, uint32_t *ns_count) +_transform_json2xml_subexp(const struct lys_module *module, const char *expr, char **out, size_t *out_used, size_t *out_size, + int schema, int inst_id, const char ***prefixes, const char ***namespaces, uint32_t *ns_count) { const char *cur_expr, *end, *prefix, *literal; char *name; @@ -393,10 +393,6 @@ _transform_json2xml_subexp(const struct lys_module *module, const char *expr, ch return 0; error: - if (!schema && ns_count) { - free(*prefixes); - free(*namespaces); - } lyxp_expr_free(exp); return 1; } @@ -433,6 +429,14 @@ _transform_json2xml(const struct lys_module *module, const char *expr, int schem return lydict_insert_zc(module->ctx, out); } + /* fail */ + if (ns_count) { + *ns_count = 0; + free(*prefixes); + *prefixes = NULL; + free(*namespaces); + *namespaces = NULL; + } free(out); return NULL; } From e56004a39c7a4b4a4251d42031eaeeeb1998c184 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 30 Apr 2020 16:38:52 +0200 Subject: [PATCH 124/134] SOVERSION bump to version 1.7.9 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 40e33fc89..e6b830a37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 7) -set(LIBYANG_MICRO_SOVERSION 8) +set(LIBYANG_MICRO_SOVERSION 9) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From d3ee2140730f09ec5ee944db2e9398321ad36cb6 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 30 Apr 2020 16:39:01 +0200 Subject: [PATCH 125/134] VERSION bump to version 1.0.165 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6b830a37..3927593be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 164) +set(LIBYANG_MICRO_VERSION 165) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From d439b2a1951ad5b1ccfc56f9bbed64f7f7874350 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 4 May 2020 17:45:14 +0200 Subject: [PATCH 126/134] parser CHANGE allow require-instance property change in derived types ... but print a warning. Based on the conclusion of the discussion in the mailing list. Fixes #1049 --- src/parser_yang.c | 22 +++++++++++----------- src/parser_yin.c | 12 +++++++++--- src/resolve.c | 18 ++++++++++++++++++ 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/parser_yang.c b/src/parser_yang.c index 07bba0bc0..ca95590ff 100644 --- a/src/parser_yang.c +++ b/src/parser_yang.c @@ -639,7 +639,6 @@ yang_check_type(struct lys_module *module, struct lys_node *parent, struct yang_ struct ly_ctx *ctx = module->ctx; int rc, ret = -1; unsigned int i, j; - int8_t req; const char *name, *value, *module_name = NULL; LY_DATA_TYPE base = 0, base_tmp; struct lys_node *siter; @@ -896,13 +895,16 @@ yang_check_type(struct lys_module *module, struct lys_node *parent, struct yang_ } break; case LY_TYPE_LEAFREF: + case LY_TYPE_INST: if (type->base == LY_TYPE_INST) { if (type->info.lref.path) { LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, "path"); goto error; } - if ((req = type->info.lref.req)) { - type->info.inst.req = req; + if (type->info.lref.req) { + type->info.inst.req = type->info.lref.req; + } else if (type->der->type.der) { + type->info.inst.req = type->der->type.info.inst.req; } } else if (type->base == LY_TYPE_LEAFREF) { /* require-instance only YANG 1.1 */ @@ -916,17 +918,12 @@ yang_check_type(struct lys_module *module, struct lys_node *parent, struct yang_ tpdftype = 1; } - if (type->der->type.der) { - if (type->info.lref.path) { + if (type->info.lref.path) { + if (type->der->type.der) { LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, "path"); goto error; - } else if (type->info.lref.req) { - LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, "require-instance"); - goto error; } - } - if (type->info.lref.path) { value = type->info.lref.path; /* store in the JSON format */ type->info.lref.path = transform_schema2json(module, value); @@ -950,7 +947,10 @@ yang_check_type(struct lys_module *module, struct lys_node *parent, struct yang_ } else { /* copy leafref definition into the derived type */ type->info.lref.path = lydict_insert(ctx, type->der->type.info.lref.path, 0); - type->info.lref.req = type->der->type.info.lref.req; + if (!type->info.lref.req) { + /* inherit require-instance only if not overwritten */ + type->info.lref.req = type->der->type.info.lref.req; + } /* and resolve the path at the place we are (if not in grouping/typedef) */ if (!tpdftype && unres_schema_add_node(module, unres, type, UNRES_TYPE_LEAFREF, parent) == -1) { goto error; diff --git a/src/parser_yin.c b/src/parser_yin.c index 69822684b..130ba3f82 100644 --- a/src/parser_yin.c +++ b/src/parser_yin.c @@ -1205,7 +1205,6 @@ fill_yin_type(struct lys_module *module, struct lys_node *parent, struct lyxml_e case LY_TYPE_INST: /* RFC 6020 9.13.2 - require-instance */ LY_TREE_FOR(yin->child, node) { - if (!strcmp(node->name, "require-instance")) { if (type->info.inst.req) { LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, node->name, yin->name); @@ -1231,6 +1230,11 @@ fill_yin_type(struct lys_module *module, struct lys_node *parent, struct lyxml_e } } + if (type->der->type.der && !type->info.inst.req) { + /* inherit require-instance property */ + type->info.inst.req = type->der->type.info.inst.req; + } + break; case LY_TYPE_BINARY: @@ -1304,7 +1308,7 @@ fill_yin_type(struct lys_module *module, struct lys_node *parent, struct lyxml_e LY_TREE_FOR(yin->child, node) { if (!strcmp(node->name, "path") && !type->der->type.der) { /* keep path for later */ - } else if (module->version >= 2 && !strcmp(node->name, "require-instance") && !type->der->type.der) { + } else if (module->version >= 2 && !strcmp(node->name, "require-instance")) { if (type->info.lref.req) { LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, node->name, yin->name); goto error; @@ -1371,7 +1375,9 @@ fill_yin_type(struct lys_module *module, struct lys_node *parent, struct lyxml_e } else { /* copy leafref definition into the derived type */ type->info.lref.path = lydict_insert(ctx, type->der->type.info.lref.path, 0); - type->info.lref.req = type->der->type.info.lref.req; + if (!type->info.lref.req) { + type->info.lref.req = type->der->type.info.lref.req; + } /* and resolve the path at the place we are (if not in grouping/typedef) */ if (!parenttype && unres_schema_add_node(module, unres, type, UNRES_TYPE_LEAFREF, parent) == -1) { goto error; diff --git a/src/resolve.c b/src/resolve.c index 492ae88be..009b2b9a1 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -7573,6 +7573,7 @@ unres_schema_add_node(struct lys_module *mod, struct unres_schema *unres, void * struct ly_err_item *prev_eitem; LY_ERR prev_ly_errno; struct lyxml_elem *yin; + struct lys_type *stype; struct ly_ctx *ctx = mod->ctx; assert(unres && (item || (type == UNRES_MOD_IMPLEMENT)) && ((type != UNRES_LEAFREF) && (type != UNRES_INSTID) @@ -7603,6 +7604,23 @@ unres_schema_add_node(struct lys_module *mod, struct unres_schema *unres, void * if (rc != EXIT_FAILURE) { ly_ilo_restore(ctx, prev_ilo, prev_eitem, rc == -1 ? 1 : 0); if (rc != -1) { + /* print warnings here so that they are actually printed */ + if ((type == UNRES_TYPE_DER_TPDF) || (type == UNRES_TYPE_DER)) { + stype = item; + if (stype->der->module && (((stype->base == LY_TYPE_LEAFREF) + && (stype->info.lref.req != stype->der->type.info.lref.req)) || ((stype->base == LY_TYPE_INST) + && (stype->info.inst.req != stype->der->type.info.inst.req)))) { + if (type == UNRES_TYPE_DER_TPDF) { + /* typedef */ + LOGWRN(ctx, "Derived typedef \"%s\" is changing the \"require-instance\" property, " + "which is discouraged.", stype->parent->name); + } else { + /* leaf */ + LOGWRN(ctx, "Node \"%s\" type is changing the \"require-instance\" property, " + "which is discouraged.", snode->name); + } + } + } ly_errno = prev_ly_errno; } From fa75b39d6dce09b7fc7448995022ec389e07eae7 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 4 May 2020 17:46:19 +0200 Subject: [PATCH 127/134] SOVERSION bump to version 1.7.10 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3927593be..0e46ee07c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 7) -set(LIBYANG_MICRO_SOVERSION 9) +set(LIBYANG_MICRO_SOVERSION 10) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 090989d68270659e116457404fb41b0a12459889 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Mon, 4 May 2020 17:46:31 +0200 Subject: [PATCH 128/134] VERSION bump to version 1.0.166 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e46ee07c..f4e624494 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 165) +set(LIBYANG_MICRO_VERSION 166) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library From b11c70c5246da3be3e153e5919a54e9c84bd8647 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Tue, 5 May 2020 11:58:13 +0200 Subject: [PATCH 129/134] build CHANGE update FindLibYANG cmake module --- FindLibYANG.cmake | 84 +++++++++++++++++++++++++++++ FindYANG.cmake | 132 ---------------------------------------------- 2 files changed, 84 insertions(+), 132 deletions(-) create mode 100644 FindLibYANG.cmake delete mode 100644 FindYANG.cmake diff --git a/FindLibYANG.cmake b/FindLibYANG.cmake new file mode 100644 index 000000000..91897e12c --- /dev/null +++ b/FindLibYANG.cmake @@ -0,0 +1,84 @@ +# - Try to find LibYANG +# Once done this will define +# +# LIBYANG_FOUND - system has LibYANG +# LIBYANG_INCLUDE_DIRS - the LibYANG include directory +# LIBYANG_LIBRARIES - Link these to use LibYANG +# LIBYANG_VERSION - SO version of the found libyang library +# +# Author Radek Krejci +# Copyright (c) 2015 CESNET, z.s.p.o. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +include(FindPackageHandleStandardArgs) + +if(LIBYANG_LIBRARIES AND LIBYANG_INCLUDE_DIRS) + # in cache already + set(LIBYANG_FOUND TRUE) +else() + find_path(LIBYANG_INCLUDE_DIR + NAMES + libyang/libyang.h + PATHS + /usr/include + /usr/local/include + /opt/local/include + /sw/include + ${CMAKE_INCLUDE_PATH} + ${CMAKE_INSTALL_PREFIX}/include + ) + + find_library(LIBYANG_LIBRARY + NAMES + yang + libyang + PATHS + /usr/lib + /usr/lib64 + /usr/local/lib + /usr/local/lib64 + /opt/local/lib + /sw/lib + ${CMAKE_LIBRARY_PATH} + ${CMAKE_INSTALL_PREFIX}/lib + ) + + if(LIBYANG_INCLUDE_DIR) + find_path(LY_HEADER_PATH "libyang/libyang.h" HINTS ${LIBYANG_INCLUDE_DIR}) + file(READ "${LY_HEADER_PATH}/libyang/libyang.h" LY_HEADER) + string(REGEX MATCH "#define LY_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\"" LY_VERSION_MACRO "${LY_HEADER}") + string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" LIBYANG_VERSION "${LY_VERSION_MACRO}") + endif() + + set(LIBYANG_INCLUDE_DIRS ${LIBYANG_INCLUDE_DIR}) + set(LIBYANG_LIBRARIES ${LIBYANG_LIBRARY}) + mark_as_advanced(LIBYANG_INCLUDE_DIRS LIBYANG_LIBRARIES) + + # handle the QUIETLY, REQUIRED and VERSION arguments and set LIBYANG_FOUND to TRUE + # if all listed variables are TRUE + find_package_handle_standard_args(LibYANG FOUND_VAR LIBYANG_FOUND + REQUIRED_VARS LIBYANG_LIBRARY LIBYANG_INCLUDE_DIR + VERSION_VAR LIBYANG_VERSION) +endif() diff --git a/FindYANG.cmake b/FindYANG.cmake deleted file mode 100644 index 4ae3864ba..000000000 --- a/FindYANG.cmake +++ /dev/null @@ -1,132 +0,0 @@ -# - Try to find LibYANG and its C++ bindings -# Once done this will define -# -# LIBYANG_FOUND - system has LibYANG -# LIBYANG_INCLUDE_DIRS - the LibYANG include directory -# LIBYANG_LIBRARIES - Link these to use LibYANG -# -# LIBYANG_CPP_FOUND - system has LibYANG C++ bindings -# LIBYANG_CPP_INCLUDE_DIRS - the LibYANG C++ include directory -# LIBYANG_CPP_LIBRARIES - Link these to use LibYANG C++ bindings -# -# Author Radek Krejci -# Author Michal Vasko -# Copyright (c) 2015 - 2019 CESNET, z.s.p.o. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -# C library -if (LIBYANG_LIBRARIES AND LIBYANG_INCLUDE_DIRS) - # in cache already - set(LIBYANG_FOUND TRUE) -else () - - find_path(LIBYANG_INCLUDE_DIR - NAMES - libyang/libyang.h - PATHS - /usr/include - /usr/local/include - /opt/local/include - /sw/include - ${CMAKE_INCLUDE_PATH} - ${CMAKE_INSTALL_PREFIX}/include - ) - - find_library(LIBYANG_LIBRARY - NAMES - yang - libyang - PATHS - /usr/lib - /usr/lib64 - /usr/local/lib - /usr/local/lib64 - /opt/local/lib - /sw/lib - ${CMAKE_LIBRARY_PATH} - ${CMAKE_INSTALL_PREFIX}/lib - ) - - if (LIBYANG_INCLUDE_DIR AND LIBYANG_LIBRARY) - set(LIBYANG_FOUND TRUE) - else () - set(LIBYANG_FOUND FALSE) - endif () - - set(LIBYANG_INCLUDE_DIRS ${LIBYANG_INCLUDE_DIR}) - set(LIBYANG_LIBRARIES ${LIBYANG_LIBRARY}) - - # show the LIBYANG_INCLUDE_DIRS and LIBYANG_LIBRARIES variables only in the advanced view - mark_as_advanced(LIBYANG_INCLUDE_DIRS LIBYANG_LIBRARIES) - -endif () - -#C++ bindings -if (LIBYANG_CPP_LIBRARIES AND LIBYANG_CPP_INCLUDE_DIRS) - # in cache already - set(LIBYANG_CPP_FOUND TRUE) -else () - - find_path(LIBYANG_CPP_INCLUDE_DIR - NAMES - libyang/Libyang.hpp - PATHS - /usr/include - /usr/local/include - /opt/local/include - /sw/include - ${CMAKE_INCLUDE_PATH} - ${CMAKE_INSTALL_PREFIX}/include - ) - - find_library(LIBYANG_CPP_LIBRARY - NAMES - yang-cpp - libyang-cpp - PATHS - /usr/lib - /usr/lib64 - /usr/local/lib - /usr/local/lib64 - /opt/local/lib - /sw/lib - ${CMAKE_LIBRARY_PATH} - ${CMAKE_INSTALL_PREFIX}/lib - ) - - if (LIBYANG_CPP_INCLUDE_DIR AND LIBYANG_CPP_LIBRARY) - set(LIBYANG_CPP_FOUND TRUE) - else () - set(LIBYANG_CPP_FOUND FALSE) - endif () - - set(LIBYANG_CPP_INCLUDE_DIRS ${LIBYANG_CPP_INCLUDE_DIR}) - set(LIBYANG_CPP_LIBRARIES ${LIBYANG_CPP_LIBRARY}) - - # show the LIBYANG_CPP_INCLUDE_DIRS and LIBYANG_CPP_LIBRARIES variables only in the advanced view - mark_as_advanced(LIBYANG_CPP_INCLUDE_DIRS LIBYANG_CPP_LIBRARIES) - -endif() From 09aa184d77466758c9a139c2f62463a2e3b4cd1b Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Wed, 6 May 2020 15:33:36 +0300 Subject: [PATCH 130/134] c++ BUGFIX value_type() return value type (#1078) --- swig/cpp/src/Tree_Data.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swig/cpp/src/Tree_Data.hpp b/swig/cpp/src/Tree_Data.hpp index 0dd60d762..03042f65f 100644 --- a/swig/cpp/src/Tree_Data.hpp +++ b/swig/cpp/src/Tree_Data.hpp @@ -243,7 +243,7 @@ class Data_Node_Leaf_List : public Data_Node /** get value variable from [lyd_node_leaf_list](@ref lyd_node_leaf_list)*/ S_Value value(); /** get value_type variable from [lyd_node_leaf_list](@ref lyd_node_leaf_list)*/ - uint16_t value_type() {return ((struct lyd_node_leaf_list *) node)->value_type;}; + LY_DATA_TYPE value_type() {return ((struct lyd_node_leaf_list *) node)->value_type;}; /** get child variable from [lyd_node_leaf_list](@ref lyd_node_leaf_list)*/ S_Data_Node child() {return nullptr;}; @@ -306,7 +306,7 @@ class Attr /** get value variable from [lyd_attr](@ref lyd_attr)*/ S_Value value(); /** get value_type variable from [lyd_attr](@ref lyd_attr)*/ - uint16_t value_type() {return attr->value_type;}; + LY_DATA_TYPE value_type() {return attr->value_type;}; private: struct lyd_attr *attr; S_Deleter deleter; From 0599d13c142854215139580ba778ff2cbd23eb53 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Wed, 6 May 2020 16:25:22 +0200 Subject: [PATCH 131/134] cmake CHANGE find module C++ bindings search --- FindLibYANG.cmake | 51 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/FindLibYANG.cmake b/FindLibYANG.cmake index 91897e12c..5655db34c 100644 --- a/FindLibYANG.cmake +++ b/FindLibYANG.cmake @@ -6,6 +6,10 @@ # LIBYANG_LIBRARIES - Link these to use LibYANG # LIBYANG_VERSION - SO version of the found libyang library # +# LIBYANG_CPP_FOUND - system has LibYANG C++ bindings +# LIBYANG_CPP_INCLUDE_DIRS - the LibYANG C++ include directory +# LIBYANG_CPP_LIBRARIES - Link these to use LibYANG C++ bindings +# # Author Radek Krejci # Copyright (c) 2015 CESNET, z.s.p.o. # @@ -76,9 +80,54 @@ else() set(LIBYANG_LIBRARIES ${LIBYANG_LIBRARY}) mark_as_advanced(LIBYANG_INCLUDE_DIRS LIBYANG_LIBRARIES) - # handle the QUIETLY, REQUIRED and VERSION arguments and set LIBYANG_FOUND to TRUE + # handle the QUIETLY and REQUIRED arguments and set SYSREPO_FOUND to TRUE # if all listed variables are TRUE find_package_handle_standard_args(LibYANG FOUND_VAR LIBYANG_FOUND REQUIRED_VARS LIBYANG_LIBRARY LIBYANG_INCLUDE_DIR VERSION_VAR LIBYANG_VERSION) endif() + +#C++ bindings +if (LIBYANG_CPP_LIBRARIES AND LIBYANG_CPP_INCLUDE_DIRS) + # in cache already + set(LIBYANG_CPP_FOUND TRUE) +else () + find_path(LIBYANG_CPP_INCLUDE_DIR + NAMES + libyang/Libyang.hpp + PATHS + /usr/include + /usr/local/include + /opt/local/include + /sw/include + ${CMAKE_INCLUDE_PATH} + ${CMAKE_INSTALL_PREFIX}/include + ) + + find_library(LIBYANG_CPP_LIBRARY + NAMES + yang-cpp + libyang-cpp + PATHS + /usr/lib + /usr/lib64 + /usr/local/lib + /usr/local/lib64 + /opt/local/lib + /sw/lib + ${CMAKE_LIBRARY_PATH} + ${CMAKE_INSTALL_PREFIX}/lib + ) + + if (LIBYANG_CPP_INCLUDE_DIR AND LIBYANG_CPP_LIBRARY) + set(LIBYANG_CPP_FOUND TRUE) + else () + set(LIBYANG_CPP_FOUND FALSE) + endif () + + set(LIBYANG_CPP_INCLUDE_DIRS ${LIBYANG_CPP_INCLUDE_DIR}) + set(LIBYANG_CPP_LIBRARIES ${LIBYANG_CPP_LIBRARY}) + + # show the LIBYANG_CPP_INCLUDE_DIRS and LIBYANG_CPP_LIBRARIES variables only in the advanced view + mark_as_advanced(LIBYANG_CPP_INCLUDE_DIRS LIBYANG_CPP_LIBRARIES) +endif() From 2a33c2108402093ee387c9e5bfbbf95324ab2130 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 7 May 2020 09:08:13 +0200 Subject: [PATCH 132/134] resolve BUGFIX local module for leafrefs in typedefs ... must be that of the typedef instead of the node where the typedef was used. Fixes #1082 --- src/resolve.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/resolve.c b/src/resolve.c index 009b2b9a1..fe0927c6f 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -4235,7 +4235,12 @@ resolve_schema_leafref(struct lys_type *type, struct lys_node *parent, struct un op_node && !(op_node->nodetype & (LYS_ACTION | LYS_NOTIF | LYS_RPC)); op_node = lys_parent(op_node)); - cur_module = lys_node_module(parent); + if (type->der->module) { + /* typedef, take its local module */ + cur_module = type->der->module; + } else { + cur_module = lys_node_module(parent); + } do { if ((i = parse_path_arg(cur_module, id, &prefix, &pref_len, &name, &nam_len, &parent_times, &has_predicate)) < 1) { LOGVAL(ctx, LYE_INCHAR, LY_VLOG_LYS, parent, id[-i], &id[-i]); From 47b886d5ae5952ccd68a6604bb6a7c5c4d54b2f3 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 7 May 2020 09:09:15 +0200 Subject: [PATCH 133/134] SOVERSION bump to version 1.7.11 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4e624494..46e923803 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_ # with backward compatible change and micro version is connected with any internal change of the library. set(LIBYANG_MAJOR_SOVERSION 1) set(LIBYANG_MINOR_SOVERSION 7) -set(LIBYANG_MICRO_SOVERSION 10) +set(LIBYANG_MICRO_SOVERSION 11) set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION}) set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION}) From 357fd2080b14b554bef19e0b7f44848b50e55dce Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 7 May 2020 09:09:29 +0200 Subject: [PATCH 134/134] VERSION bump to version 1.0.167 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46e923803..71aa4781c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ set(CMAKE_MACOSX_RPATH TRUE) # micro version is changed with a set of small changes or bugfixes anywhere in the project. set(LIBYANG_MAJOR_VERSION 1) set(LIBYANG_MINOR_VERSION 0) -set(LIBYANG_MICRO_VERSION 166) +set(LIBYANG_MICRO_VERSION 167) set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) # Version of the library