Netconf: remove operations attribute from edit-config operations

Added `ISO/IEC 10646` encodings to XML parser: `&#[0-9]+;` and `&#[0-9a-fA-F]+;`
This commit is contained in:
Olof Hagsand 2022-12-20 09:35:07 +01:00
parent 0d41d49fa9
commit f46d675370
3 changed files with 15 additions and 3 deletions

View file

@ -56,6 +56,7 @@ Developers may need to change their code
### Minor features ### Minor features
* Added `ISO/IEC 10646` encodings to XML parser: `&#[0-9]+;` and `&#[0-9a-fA-F]+;`
* Added `CLIXON_CLIENT_SSH` to client API to communicate remotely via SSH netconf sub-system * Added `CLIXON_CLIENT_SSH` to client API to communicate remotely via SSH netconf sub-system
### Corrected Bugs ### Corrected Bugs

View file

@ -92,7 +92,7 @@
* @param[in] name Attribute name * @param[in] name Attribute name
* @param[in] ns (Expected)Namespace of attribute * @param[in] ns (Expected)Namespace of attribute
* @param[out] cbret Error message (if retval=0) * @param[out] cbret Error message (if retval=0)
* @param[out] valp Pointer to value (if retval=1) * @param[out] valp Malloced value (if retval=1)
* @retval -1 Error * @retval -1 Error
* @retval 0 Failed (cbret set) * @retval 0 Failed (cbret set)
* @retval 1 OK * @retval 1 OK
@ -120,8 +120,13 @@ attr_ns_value(cxobj *x,
} }
/* the attribute exists, but not w expected namespace */ /* the attribute exists, but not w expected namespace */
if (ns == NULL || if (ns == NULL ||
strcmp(ans, ns) == 0) strcmp(ans, ns) == 0){
val = xml_value(xa); if ((val = strdup(xml_value(xa))) == NULL){
clicon_err(OE_UNIX, errno, "malloc");
goto done;
}
xml_purge(xa);
}
} }
*valp = val; *valp = val;
retval = 1; retval = 1;
@ -963,6 +968,8 @@ text_modify(clicon_handle h,
} /* else Y_CONTAINER */ } /* else Y_CONTAINER */
retval = 1; retval = 1;
done: done:
if (opstr)
free(opstr);
if (nscx1) if (nscx1)
xml_nsctx_free(nscx1); xml_nsctx_free(nscx1);
/* Remove dangling added objects */ /* Remove dangling added objects */
@ -1135,6 +1142,8 @@ text_modify_top(clicon_handle h,
// ok: // ok:
retval = 1; retval = 1;
done: done:
if (opstr)
free(opstr);
return retval; return retval;
fail: /* cbret set */ fail: /* cbret set */
retval = 0; retval = 0;

View file

@ -146,6 +146,8 @@ ncname {namestart}{namechar}*
<AMPERSAND>"gt;" { BEGIN(_XY->xy_lex_state); clixon_xml_parselval.string = ">"; return CHARDATA;} <AMPERSAND>"gt;" { BEGIN(_XY->xy_lex_state); clixon_xml_parselval.string = ">"; return CHARDATA;}
<AMPERSAND>"apos;" { BEGIN(_XY->xy_lex_state); clixon_xml_parselval.string = "'"; return CHARDATA;} <AMPERSAND>"apos;" { BEGIN(_XY->xy_lex_state); clixon_xml_parselval.string = "'"; return CHARDATA;}
<AMPERSAND>"quot;" { BEGIN(_XY->xy_lex_state); clixon_xml_parselval.string = "\""; return CHARDATA;} <AMPERSAND>"quot;" { BEGIN(_XY->xy_lex_state); clixon_xml_parselval.string = "\""; return CHARDATA;}
<AMPERSAND>"#"[0-9]+";" { BEGIN(_XY->xy_lex_state); clixon_xml_parselval.string = "\""; return CHARDATA; /* ISO/IEC 10646 */ }
<AMPERSAND>"#x"[0-9a-fA-F]+";" { BEGIN(_XY->xy_lex_state); clixon_xml_parselval.string = "\""; return CHARDATA;}
<CDATA>\n { clixon_xml_parselval.string = yytext;_XY->xy_linenum++; return (CHARDATA);} <CDATA>\n { clixon_xml_parselval.string = yytext;_XY->xy_linenum++; return (CHARDATA);}
<CDATA>"]]>" { BEGIN(_XY->xy_lex_state); clixon_xml_parselval.string = yytext; return CHARDATA;} <CDATA>"]]>" { BEGIN(_XY->xy_lex_state); clixon_xml_parselval.string = yytext; return CHARDATA;}