Dedicated xml,json,yang and xsl parser utility programs added
Sanity check of stdarg (...) added Cleanup of error messages.
This commit is contained in:
parent
1306174071
commit
85c4782e36
56 changed files with 1004 additions and 379 deletions
|
|
@ -79,8 +79,8 @@
|
|||
* string regexp checked.
|
||||
* See also db_lv_set() where defaults are also filled in. The case here for defaults
|
||||
* are if code comes via XML/NETCONF.
|
||||
* @param yspec Yang spec
|
||||
* @param td Transaction data
|
||||
* @param[in] yspec Yang spec
|
||||
* @param[in] td Transaction data
|
||||
*/
|
||||
static int
|
||||
generic_validate(yang_spec *yspec,
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ clixon_plugin_statedata(clicon_handle h,
|
|||
}
|
||||
}
|
||||
/* Code complex to filter out anything that is outside of xpath */
|
||||
if (xpath_vec(*xtop, xpath?xpath:"/", &xvec, &xlen) < 0)
|
||||
if (xpath_vec(*xtop, "%s", &xvec, &xlen, xpath?xpath:"/") < 0)
|
||||
goto done;
|
||||
|
||||
/* If vectors are specified then mark the nodes found and
|
||||
|
|
|
|||
|
|
@ -96,12 +96,12 @@ config_socket_init_ipv4(clicon_handle h, char *dst)
|
|||
goto err; /* Could check getaddrinfo */
|
||||
}
|
||||
if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0){
|
||||
clicon_err(OE_UNIX, errno, "%s: bind", __FUNCTION__);
|
||||
clicon_err(OE_UNIX, errno, "bind");
|
||||
goto err;
|
||||
}
|
||||
clicon_debug(1, "Listen on server socket at %s:%hu", dst, port);
|
||||
if (listen(s, 5) < 0){
|
||||
clicon_err(OE_UNIX, errno, "%s: listen", __FUNCTION__);
|
||||
clicon_err(OE_UNIX, errno, "listen");
|
||||
goto err;
|
||||
}
|
||||
return s;
|
||||
|
|
@ -126,7 +126,7 @@ config_socket_init_unix(clicon_handle h, char *sock)
|
|||
struct stat st;
|
||||
|
||||
if (lstat(sock, &st) == 0 && unlink(sock) < 0){
|
||||
clicon_err(OE_UNIX, errno, "%s: unlink(%s)", __FUNCTION__, sock);
|
||||
clicon_err(OE_UNIX, errno, "unlink(%s)", sock);
|
||||
return -1;
|
||||
}
|
||||
/* then find configuration group (for clients) and find its groupid */
|
||||
|
|
@ -142,7 +142,7 @@ config_socket_init_unix(clicon_handle h, char *sock)
|
|||
#endif
|
||||
/* create unix socket */
|
||||
if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
|
||||
clicon_err(OE_UNIX, errno, "%s: socket", __FUNCTION__);
|
||||
clicon_err(OE_UNIX, errno, "socket");
|
||||
return -1;
|
||||
}
|
||||
// setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (void*)&one, sizeof(one));
|
||||
|
|
@ -151,20 +151,19 @@ config_socket_init_unix(clicon_handle h, char *sock)
|
|||
strncpy(addr.sun_path, sock, sizeof(addr.sun_path)-1);
|
||||
old_mask = umask(S_IRWXO | S_IXGRP | S_IXUSR);
|
||||
if (bind(s, (struct sockaddr *)&addr, SUN_LEN(&addr)) < 0){
|
||||
clicon_err(OE_UNIX, errno, "%s: bind", __FUNCTION__);
|
||||
clicon_err(OE_UNIX, errno, "bind");
|
||||
umask(old_mask);
|
||||
goto err;
|
||||
}
|
||||
umask(old_mask);
|
||||
/* change socket path file group */
|
||||
if (lchown(sock, -1, gid) < 0){
|
||||
clicon_err(OE_UNIX, errno, "%s: lchown(%s, %s)", __FUNCTION__,
|
||||
sock, config_group);
|
||||
clicon_err(OE_UNIX, errno, "lchown(%s, %s)", sock, config_group);
|
||||
goto err;
|
||||
}
|
||||
clicon_debug(1, "Listen on server socket at %s", addr.sun_path);
|
||||
if (listen(s, 5) < 0){
|
||||
clicon_err(OE_UNIX, errno, "%s: listen", __FUNCTION__);
|
||||
clicon_err(OE_UNIX, errno, "listen");
|
||||
goto err;
|
||||
}
|
||||
return s;
|
||||
|
|
@ -221,14 +220,14 @@ backend_accept_client(int fd,
|
|||
clicon_debug(2, "%s", __FUNCTION__);
|
||||
len = sizeof(from);
|
||||
if ((s = accept(fd, (struct sockaddr*)&from, &len)) < 0){
|
||||
clicon_err(OE_UNIX, errno, "%s: accept", __FUNCTION__);
|
||||
clicon_err(OE_UNIX, errno, "accept");
|
||||
goto done;
|
||||
}
|
||||
#if defined(SO_PEERCRED)
|
||||
/* fill in the user data structure */
|
||||
clen = sizeof(credentials);
|
||||
if(getsockopt(s, SOL_SOCKET, SO_PEERCRED/* XXX finns ej i freebsd*/, &credentials, &clen)){
|
||||
clicon_err(OE_UNIX, errno, "%s: getsockopt", __FUNCTION__);
|
||||
clicon_err(OE_UNIX, errno, "getsockopt");
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ backend_notify_xml(clicon_handle h,
|
|||
ce_next = ce->ce_next;
|
||||
for (su = ce->ce_subscription; su; su = su->su_next)
|
||||
if (strcmp(su->su_stream, stream) == 0){
|
||||
if (strlen(su->su_filter)==0 || xpath_first(x, su->su_filter) != NULL){
|
||||
if (strlen(su->su_filter)==0 || xpath_first(x, "%s", su->su_filter) != NULL){
|
||||
if (cb==NULL){
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
clicon_err(OE_PLUGIN, errno, "cbuf_new");
|
||||
|
|
@ -255,7 +255,7 @@ backend_notify_xml(clicon_handle h,
|
|||
continue;
|
||||
if (strcmp(hs->hs_stream, stream))
|
||||
continue;
|
||||
if (strlen(hs->hs_filter)==0 || xpath_first(x, hs->hs_filter) != NULL){
|
||||
if (strlen(hs->hs_filter)==0 || xpath_first(x, "%s", hs->hs_filter) != NULL){
|
||||
if ((*hs->hs_fn)(h, x, hs->hs_arg) < 0)
|
||||
goto done;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ cli_dbxml(clicon_handle h,
|
|||
cxobj *xb; /* body */
|
||||
|
||||
if (cvec_len(argv) != 1){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Requires one element to be xml key format string", __FUNCTION__);
|
||||
clicon_err(OE_PLUGIN, 0, "Requires one element to be xml key format string");
|
||||
goto done;
|
||||
}
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
|
|
@ -396,7 +396,7 @@ cli_debug_cli(clicon_handle h,
|
|||
|
||||
if ((cv = cvec_find(vars, "level")) == NULL){
|
||||
if (cvec_len(argv) != 1){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Requires either label var or single arg: 0|1", __FUNCTION__);
|
||||
clicon_err(OE_PLUGIN, 0, "Requires either label var or single arg: 0|1");
|
||||
goto done;
|
||||
}
|
||||
cv = cvec_i(argv, 0);
|
||||
|
|
@ -427,7 +427,7 @@ cli_debug_backend(clicon_handle h,
|
|||
|
||||
if ((cv = cvec_find(vars, "level")) == NULL){
|
||||
if (cvec_len(argv) != 1){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Requires either label var or single arg: 0|1", __FUNCTION__);
|
||||
clicon_err(OE_PLUGIN, 0, "Requires either label var or single arg: 0|1");
|
||||
goto done;
|
||||
}
|
||||
cv = cvec_i(argv, 0);
|
||||
|
|
@ -457,7 +457,7 @@ cli_debug_restconf(clicon_handle h,
|
|||
|
||||
if ((cv = cvec_find(vars, "level")) == NULL){
|
||||
if (cvec_len(argv) != 1){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Requires either label var or single arg: 0|1", __FUNCTION__);
|
||||
clicon_err(OE_PLUGIN, 0, "Requires either label var or single arg: 0|1");
|
||||
goto done;
|
||||
}
|
||||
cv = cvec_i(argv, 0);
|
||||
|
|
@ -482,7 +482,7 @@ cli_set_mode(clicon_handle h,
|
|||
char *str = NULL;
|
||||
|
||||
if (cvec_len(argv) != 1){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Requires one element to be cli mode", __FUNCTION__);
|
||||
clicon_err(OE_PLUGIN, 0, "Requires one element to be cli mode");
|
||||
goto done;
|
||||
}
|
||||
str = cv_string_get(cvec_i(argv, 0));
|
||||
|
|
@ -494,6 +494,7 @@ cli_set_mode(clicon_handle h,
|
|||
|
||||
/*! Start bash from cli callback
|
||||
* XXX Application specific??
|
||||
* XXX replace fprintf with clicon_err?
|
||||
*/
|
||||
int
|
||||
cli_start_shell(clicon_handle h,
|
||||
|
|
@ -510,10 +511,10 @@ cli_start_shell(clicon_handle h,
|
|||
|
||||
if ((pw = getpwuid(getuid())) == NULL){
|
||||
fprintf(stderr, "%s: getpwuid: %s\n",
|
||||
__FUNCTION__, strerror(errno));
|
||||
__FUNCTION__, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (chdir(pw->pw_dir) < 0){
|
||||
if (chdir(pw->pw_dir) < 0){
|
||||
fprintf(stderr, "%s: chdir(%s): %s\n",
|
||||
__FUNCTION__, pw->pw_dir, strerror(errno));
|
||||
endpwent();
|
||||
|
|
@ -671,7 +672,7 @@ compare_dbs(clicon_handle h,
|
|||
int astext;
|
||||
|
||||
if (cvec_len(argv) > 1){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Requires 0 or 1 element. If given: astext flag 0|1", __FUNCTION__);
|
||||
clicon_err(OE_PLUGIN, 0, "Requires 0 or 1 element. If given: astext flag 0|1");
|
||||
goto done;
|
||||
}
|
||||
if (cvec_len(argv))
|
||||
|
|
@ -762,7 +763,7 @@ load_config_file(clicon_handle h,
|
|||
}
|
||||
/* Open and parse local file into xml */
|
||||
if ((fd = open(filename, O_RDONLY)) < 0){
|
||||
clicon_err(OE_UNIX, errno, "%s: open(%s)", __FUNCTION__, filename);
|
||||
clicon_err(OE_UNIX, errno, "open(%s)", filename);
|
||||
goto done;
|
||||
}
|
||||
if (xml_parse_file(fd, "</clicon>", NULL, &xt) < 0)
|
||||
|
|
@ -824,9 +825,11 @@ save_config_file(clicon_handle h,
|
|||
|
||||
if (cvec_len(argv) != 2){
|
||||
if (cvec_len(argv)==1)
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Got single argument:\"%s\". Expected \"<dbname>,<varname>\"", cv_string_get(cvec_i(argv,0)));
|
||||
clicon_err(OE_PLUGIN, 0, "Got single argument:\"%s\". Expected \"<dbname>,<varname>\"",
|
||||
cv_string_get(cvec_i(argv,0)));
|
||||
else
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Got %d arguments. Expected: <dbname>,<varname>", cvec_len(argv));
|
||||
clicon_err(OE_PLUGIN, 0, " Got %d arguments. Expected: <dbname>,<varname>",
|
||||
cvec_len(argv));
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -886,7 +889,7 @@ delete_all(clicon_handle h,
|
|||
int retval = -1;
|
||||
|
||||
if (cvec_len(argv) != 1){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Requires one element: dbname", __FUNCTION__);
|
||||
clicon_err(OE_PLUGIN, 0, "Requires one element: dbname");
|
||||
goto done;
|
||||
}
|
||||
dbstr = cv_string_get(cvec_i(argv, 0));
|
||||
|
|
@ -949,7 +952,7 @@ cli_notification_cb(int s,
|
|||
if (clicon_msg_rcv(s, &reply, &eof) < 0)
|
||||
goto done;
|
||||
if (eof){
|
||||
clicon_err(OE_PROTO, ESHUTDOWN, "%s: Socket unexpected close", __FUNCTION__);
|
||||
clicon_err(OE_PROTO, ESHUTDOWN, "Socket unexpected close");
|
||||
close(s);
|
||||
errno = ESHUTDOWN;
|
||||
event_unreg_fd(s, cli_notification_cb);
|
||||
|
|
@ -1012,7 +1015,7 @@ cli_notify(clicon_handle h,
|
|||
enum format_enum format = FORMAT_TEXT;
|
||||
|
||||
if (cvec_len(argv) != 2 && cvec_len(argv) != 3){
|
||||
clicon_err(OE_PLUGIN, 0, "%s Requires arguments: <logstream> <status> [<format>]", __FUNCTION__);
|
||||
clicon_err(OE_PLUGIN, 0, "Requires arguments: <logstream> <status> [<format>]");
|
||||
goto done;
|
||||
}
|
||||
stream = cv_string_get(cvec_i(argv, 0));
|
||||
|
|
@ -1215,7 +1218,7 @@ cli_copy_config(clicon_handle h,
|
|||
cxobj *xerr;
|
||||
|
||||
if (cvec_len(argv) != 5){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Requires four elements: <db> <xpath> <keyname> <from> <to>", __FUNCTION__);
|
||||
clicon_err(OE_PLUGIN, 0, "Requires four elements: <db> <xpath> <keyname> <from> <to>");
|
||||
goto done;
|
||||
}
|
||||
/* First argv argument: Database */
|
||||
|
|
@ -1247,7 +1250,7 @@ cli_copy_config(clicon_handle h,
|
|||
if (xpath[i] == '%')
|
||||
j++;
|
||||
if (j != 2){
|
||||
clicon_err(OE_PLUGIN, 0, "xpath '%s' does not have two '%%'");
|
||||
clicon_err(OE_PLUGIN, 0, "xpath '%s' does not have two '%%'", xpath);
|
||||
goto done;
|
||||
}
|
||||
cprintf(cb, xpath, keyname, fromname);
|
||||
|
|
@ -1273,7 +1276,7 @@ cli_copy_config(clicon_handle h,
|
|||
goto done;
|
||||
xml_name_set(x2, "config");
|
||||
cprintf(cb, "/%s", keyname);
|
||||
if ((x = xpath_first(x2, cbuf_get(cb))) == NULL){
|
||||
if ((x = xpath_first(x2, "%s", cbuf_get(cb))) == NULL){
|
||||
clicon_err(OE_PLUGIN, 0, "Field %s not found in copy tree", keyname);
|
||||
goto done;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -783,7 +783,7 @@ yang2cli(clicon_handle h,
|
|||
cvec *globals; /* global variables from syntax */
|
||||
|
||||
if ((cbuf = cbuf_new()) == NULL){
|
||||
clicon_err(OE_XML, errno, "%s: cbuf_new", __FUNCTION__);
|
||||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
/* Traverse YANG specification: loop through statements */
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ dump_configfile_xml_fn(FILE *fout,
|
|||
clicon_err(OE_UNIX, errno, "configure file: %s", filename);
|
||||
return -1;
|
||||
}
|
||||
clicon_debug(2, "Reading config file %s", __FUNCTION__, filename);
|
||||
clicon_debug(2, "%s: Reading config file %s", __FUNCTION__, filename);
|
||||
fprintf(fout, "<config>\n");
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
if ((cp = strchr(line, '\n')) != NULL) /* strip last \n */
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ cli_load_syntax(clicon_handle h,
|
|||
if ((cp = clixon_plugin_find(h, plgnam)) != NULL)
|
||||
handle = cp->cp_handle;
|
||||
if (handle == NULL){
|
||||
clicon_err(OE_PLUGIN, 0, "CLICON_PLUGIN set to '%s' in %s but plugin %s.so not found in %s\n",
|
||||
clicon_err(OE_PLUGIN, 0, "CLICON_PLUGIN set to '%s' in %s but plugin %s.so not found in %s",
|
||||
plgnam, filename, plgnam,
|
||||
clicon_cli_dir(h));
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -123,8 +123,7 @@ expand_dbvar(void *h,
|
|||
char *reason = NULL;
|
||||
|
||||
if (argv == NULL || cvec_len(argv) != 2){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: requires arguments: <db> <xmlkeyfmt>",
|
||||
__FUNCTION__);
|
||||
clicon_err(OE_PLUGIN, 0, "requires arguments: <db> <xmlkeyfmt>");
|
||||
goto done;
|
||||
}
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
|
|
@ -132,7 +131,7 @@ expand_dbvar(void *h,
|
|||
goto done;
|
||||
}
|
||||
if ((cv = cvec_i(argv, 0)) == NULL){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Error when accessing argument <db>");
|
||||
clicon_err(OE_PLUGIN, 0, "Error when accessing argument <db>");
|
||||
goto done;
|
||||
}
|
||||
dbstr = cv_string_get(cv);
|
||||
|
|
@ -143,7 +142,7 @@ expand_dbvar(void *h,
|
|||
goto done;
|
||||
}
|
||||
if ((cv = cvec_i(argv, 1)) == NULL){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Error when accessing argument <api_path>");
|
||||
clicon_err(OE_PLUGIN, 0, "Error when accessing argument <api_path>");
|
||||
goto done;
|
||||
}
|
||||
api_path_fmt = cv_string_get(cv);
|
||||
|
|
@ -197,7 +196,7 @@ expand_dbvar(void *h,
|
|||
cli_output(stderr, "%s\n", reason);
|
||||
goto done;
|
||||
}
|
||||
if ((xcur = xpath_first(xt, xpath)) == NULL){
|
||||
if ((xcur = xpath_first(xt, "%s", xpath)) == NULL){
|
||||
clicon_err(OE_DB, 0, "xpath %s should return merged content", xpath);
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -205,7 +204,7 @@ expand_dbvar(void *h,
|
|||
/* One round to detect duplicates
|
||||
*/
|
||||
j = 0;
|
||||
if (xpath_vec(xcur, xpathcur, &xvec, &xlen) < 0)
|
||||
if (xpath_vec(xcur, "%s", &xvec, &xlen, xpathcur) < 0)
|
||||
goto done;
|
||||
for (i = 0; i < xlen; i++) {
|
||||
char *str;
|
||||
|
|
@ -474,7 +473,8 @@ cli_show_config(clicon_handle h,
|
|||
if (xpath[i] == '%')
|
||||
j++;
|
||||
if (j != 1){
|
||||
clicon_err(OE_PLUGIN, 0, "xpath '%s' does not have a single '%%'");
|
||||
clicon_err(OE_PLUGIN, 0, "xpath '%s' does not have a single '%%'",
|
||||
xpath);
|
||||
goto done;
|
||||
}
|
||||
if ((cvattr = cvec_find(cvv, attr)) == NULL){
|
||||
|
|
@ -561,7 +561,7 @@ show_conf_xpath(clicon_handle h,
|
|||
int i;
|
||||
|
||||
if (cvec_len(argv) != 1){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Requires one element to be <dbname>", __FUNCTION__);
|
||||
clicon_err(OE_PLUGIN, 0, "Requires one element to be <dbname>");
|
||||
goto done;
|
||||
}
|
||||
str = cv_string_get(cvec_i(argv, 0));
|
||||
|
|
@ -580,7 +580,7 @@ show_conf_xpath(clicon_handle h,
|
|||
clicon_rpc_generate_error("Get configuration", xerr);
|
||||
goto done;
|
||||
}
|
||||
if (xpath_vec(xt, xpath, &xv, &xlen) < 0)
|
||||
if (xpath_vec(xt, "%s", &xv, &xlen, xpath) < 0)
|
||||
goto done;
|
||||
for (i=0; i<xlen; i++)
|
||||
xml_print(stdout, xv[i]);
|
||||
|
|
@ -625,7 +625,7 @@ cli_show_auto(clicon_handle h,
|
|||
enum genmodel_type gt;
|
||||
|
||||
if (cvec_len(argv) != 3){
|
||||
clicon_err(OE_PLUGIN, 0, "%s: Usage: <api-path-fmt>* <database> <format>. (*) generated.", __FUNCTION__);
|
||||
clicon_err(OE_PLUGIN, 0, "Usage: <api-path-fmt>* <database> <format>. (*) generated.");
|
||||
goto done;
|
||||
}
|
||||
/* First argv argument: API_path format */
|
||||
|
|
@ -654,7 +654,7 @@ cli_show_auto(clicon_handle h,
|
|||
clicon_rpc_generate_error("Get configuration", xerr);
|
||||
goto done;
|
||||
}
|
||||
if ((xp = xpath_first(xt, xpath)) != NULL)
|
||||
if ((xp = xpath_first(xt, "%s", xpath)) != NULL)
|
||||
/* Print configuration according to format */
|
||||
switch (format){
|
||||
case FORMAT_XML:
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ netconf_get_target(cxobj *xn,
|
|||
cxobj *x;
|
||||
char *target = NULL;
|
||||
|
||||
if ((x = xpath_first(xn, path)) != NULL){
|
||||
if ((x = xpath_first(xn, "%s", path)) != NULL){
|
||||
if (xpath_first(x, "candidate") != NULL)
|
||||
target = "candidate";
|
||||
else
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ netconf_input_cb(int s,
|
|||
int poll;
|
||||
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
clicon_err(OE_XML, errno, "%s: cbuf_new", __FUNCTION__);
|
||||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
return retval;
|
||||
}
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
|
|
|||
|
|
@ -752,7 +752,7 @@ netconf_notification_cb(int s,
|
|||
goto done;
|
||||
/* handle close from remote end: this will exit the client */
|
||||
if (eof){
|
||||
clicon_err(OE_PROTO, ESHUTDOWN, "%s: Socket unexpected close", __FUNCTION__);
|
||||
clicon_err(OE_PROTO, ESHUTDOWN, "Socket unexpected close");
|
||||
close(s);
|
||||
errno = ESHUTDOWN;
|
||||
event_unreg_fd(s, netconf_notification_cb);
|
||||
|
|
@ -770,13 +770,13 @@ netconf_notification_cb(int s,
|
|||
/* find and apply filter */
|
||||
if ((selector = xml_find_value(xfilter, "select")) == NULL)
|
||||
goto done;
|
||||
if (xpath_first(xe, selector) == NULL) {
|
||||
if (xpath_first(xe, "%s", selector) == NULL) {
|
||||
fprintf(stderr, "%s no match\n", __FUNCTION__); /* debug */
|
||||
}
|
||||
}
|
||||
/* create netconf message */
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
clicon_err(OE_PLUGIN, errno, "%s: cbuf_new", __FUNCTION__);
|
||||
clicon_err(OE_PLUGIN, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
add_preamble(cb); /* Make it well-formed netconf xml */
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ api_data_get2(clicon_handle h,
|
|||
}
|
||||
}
|
||||
else{
|
||||
if (xpath_vec(xret, path, &xvec, &xlen) < 0)
|
||||
if (xpath_vec(xret, "%s", &xvec, &xlen, path) < 0)
|
||||
goto done;
|
||||
clicon_debug(1, "%s: xpath:%s xlen:%d", __FUNCTION__, path, xlen);
|
||||
if (use_xml){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue