From ffecebf32ad5c2883b8d49daf254544a28069f69 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Sun, 27 Jan 2019 13:26:15 +0100 Subject: [PATCH] * NACM Data node READ access module support (RFC8341 3.4.5) * Access control points added for `get` and `get-config` in addition to incoming rpc. * RFC 8341 Example A.2 implemented, see: [test/test_nacm_module.sh] * Added `username` argument on `xmldb_put()` datastore function for NACM data-node write checks * Added `xml_rootchild_node()` lib function as variant of `xml_rootchild()` --- CHANGELOG.md | 10 +- apps/backend/backend_client.c | 87 ++++-- apps/backend/backend_commit.c | 6 +- apps/backend/backend_main.c | 9 +- apps/restconf/restconf_methods.c | 14 +- datastore/datastore_client.c | 2 +- datastore/text/clixon_xmldb_text.c | 63 ++++- datastore/text/clixon_xmldb_text.h | 2 +- example/example_backend.c | 2 +- lib/clixon/clixon_nacm.h | 5 +- lib/clixon/clixon_xml.h | 1 + lib/clixon/clixon_xml_db.h | 4 +- lib/src/clixon_nacm.c | 419 ++++++++++++++++++++++++----- lib/src/clixon_xml.c | 41 ++- lib/src/clixon_xml_db.c | 6 +- lib/src/clixon_xml_map.c | 2 +- test/lib.sh | 5 +- test/test_nacm.sh | 2 +- test/test_nacm_ext.sh | 2 +- test/test_nacm_module.sh | 119 ++++++-- 20 files changed, 656 insertions(+), 145 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 088d8a70..8f5079e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,12 +77,17 @@ * CLICON_YANG_MAIN_FILE Provides a filename with a single module filename. * CLICON_YANG_MAIN_DIR Provides a directory where all yang modules should be loaded. * NACM extension (RFC8341) - * NACM module support (RFC8341 A1+A2) + * NACM Data node READ access module support (RFC8341 3.4.5) + * Access control points added for `get` and `get-config` in addition to incoming rpc. + * RFC 8341 Example A.2 implemented, see: [test/test_nacm_module.sh] + * Remaining work: + * data-node module write/create/delete/update + * data-node path * Recovery user "_nacm_recovery" added. * Example use is restconf PUT when NACM edit-config is permitted, then automatic commit and discard are permitted using recovery user. - * Example user changed adm1 to andy to comply with RFC8341 example ### API changes on existing features (you may need to change your code) +* Added `username` argument on `xmldb_put()` datastore function for NACM data-node write checks * Rearranged yang files * Moved and updated all standard ietf and iana yang files from example and yang/ to `yang/standard`. * Moved clixon yang files from yang to `yang/clixon` @@ -112,6 +117,7 @@ * For backward compatibility, define CLICON_CLI_MODEL_TREENAME_PATCH in clixon_custom.h ### Minor changes +* Added `xml_rootchild_node()` lib function as variant of `xml_rootchild()` * Added -o "