From 5d511acf0891b1cacf9ceeffd9863f7f889265a8 Mon Sep 17 00:00:00 2001 From: wahidw Date: Mon, 14 Jun 2021 07:46:29 +0000 Subject: [PATCH] Alignment to libyang prototype changes and security fixes Signed-off-by: wahidw Change-Id: Ic6401dc0918bb2c7f674ddf2eb3081dfb4fc3e43 --- Dockerfile | 9 ++++++--- agent/pkg/nbi/helper.c | 16 +++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 52df771..96c782d 100755 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ RUN apt-get update -y && apt-get install -y jq \ build-essential \ vim \ supervisor \ - libpcre3-dev \ + libpcre2-dev \ pkg-config \ libavl-dev \ libev-dev \ @@ -64,7 +64,6 @@ RUN \ make -j2 && \ make install && \ ldconfig - # sysrepo RUN \ cd /opt/dev && \ @@ -167,7 +166,7 @@ RUN apt-get update -y && apt-get install -y jq \ supervisor \ openssl \ python-pip \ - libpcre3-dev \ + libpcre2-dev \ pkg-config \ libavl-dev \ libev-dev \ @@ -183,6 +182,10 @@ RUN apt-get update -y && apt-get install -y jq \ RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +# update password policy +RUN \ + sed -i 's/pam_unix.so obscure sha512/pam_unix.so obscure sha512 rounds=12000/' /etc/pam.d/common-password + # add netconf user RUN \ adduser --system netconf && \ diff --git a/agent/pkg/nbi/helper.c b/agent/pkg/nbi/helper.c index b06e732..1ad907b 100755 --- a/agent/pkg/nbi/helper.c +++ b/agent/pkg/nbi/helper.c @@ -37,6 +37,7 @@ char * yang_data_sr2json(sr_session_ctx_t *session, const char *module_name, sr_ sr_val_t *val = NULL; char *json_str = NULL; struct lyd_node *root = NULL; + struct lyd_node *node = NULL; rc = sr_get_changes_iter(session, "//." , &it); if (rc != SR_ERR_OK) { @@ -48,9 +49,9 @@ char * yang_data_sr2json(sr_session_ctx_t *session, const char *module_name, sr_ val = oper == SR_OP_CREATED ? new_value : old_value; char *leaf = sr_val_to_str(val); if (root) { - lyd_new_path(root, NULL, val->xpath, (void *) leaf, 0, 1); + lyd_new_path(root, NULL, val->xpath, (void *) leaf, LYD_NEW_PATH_UPDATE, &node); } else { - root = lyd_new_path(NULL, sr_get_context(sr_session_get_connection(session)), val->xpath, (void *) leaf, 0, 1); + lyd_new_path(NULL, sr_get_context(sr_session_get_connection(session)), val->xpath, (void *) leaf, LYD_NEW_PATH_UPDATE, &root); } sr_free_val(old_value); @@ -61,7 +62,7 @@ char * yang_data_sr2json(sr_session_ctx_t *session, const char *module_name, sr_ } if (root) { - lyd_print_mem(&json_str, root, LYD_JSON, LYP_WITHSIBLINGS | LYP_FORMAT); + lyd_print_mem(&json_str, root, LYD_JSON, LYD_PRINT_WITHSIBLINGS); printf("\n%s\n", json_str); } @@ -85,7 +86,7 @@ char * get_data_json(sr_session_ctx_t *session, const char *module_name) { } if (data) { - lyd_print_mem(&json_str, data, LYD_JSON, LYP_WITHSIBLINGS | LYP_FORMAT); + lyd_print_mem(&json_str, data, LYD_JSON, LYD_PRINT_WITHSIBLINGS); } return json_str; } @@ -100,10 +101,11 @@ int gnb_status_cb(sr_session_ctx_t *session, const char *module_name, const char void create_new_path(sr_session_ctx_t *session, char **parent, char *key, char *value) { struct lyd_node **p = (struct lyd_node **)parent; + struct lyd_node *node; if (*parent == NULL) { - *p = lyd_new_path(NULL, sr_get_context(sr_session_get_connection(session)), key, value, 0, 0); + lyd_new_path(NULL, sr_get_context(sr_session_get_connection(session)), key, value, LYD_NEW_PATH_UPDATE, &node); } else { - lyd_new_path(*p, sr_get_context(sr_session_get_connection(session)), key, value, 0, 0); + lyd_new_path(*p, sr_get_context(sr_session_get_connection(session)), key, value, LYD_NEW_PATH_UPDATE, &node); } -} \ No newline at end of file +} -- 2.16.6