revert xsl for . and ..
This commit is contained in:
parent
25d535703e
commit
18093441a8
9 changed files with 47 additions and 21 deletions
|
|
@ -870,6 +870,7 @@ from_client_msg(clicon_handle h,
|
||||||
}
|
}
|
||||||
reply:
|
reply:
|
||||||
assert(cbuf_len(cbret));
|
assert(cbuf_len(cbret));
|
||||||
|
clicon_debug(1, "%s %s", __FUNCTION__, cbuf_get(cbret));
|
||||||
if (send_msg_reply(ce->ce_s, cbuf_get(cbret), cbuf_len(cbret)+1) < 0){
|
if (send_msg_reply(ce->ce_s, cbuf_get(cbret), cbuf_len(cbret)+1) < 0){
|
||||||
if (errno == ECONNRESET)
|
if (errno == ECONNRESET)
|
||||||
clicon_log(LOG_WARNING, "client rpc reset");
|
clicon_log(LOG_WARNING, "client rpc reset");
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ validate_common(clicon_handle h,
|
||||||
&td->td_tcvec, /* changed: wanted values */
|
&td->td_tcvec, /* changed: wanted values */
|
||||||
&td->td_clen) < 0)
|
&td->td_clen) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (debug)
|
if (debug>1)
|
||||||
transaction_print(stderr, td);
|
transaction_print(stderr, td);
|
||||||
/* Mark as changed in tree */
|
/* Mark as changed in tree */
|
||||||
for (i=0; i<td->td_dlen; i++){ /* Also down */
|
for (i=0; i<td->td_dlen; i++){ /* Also down */
|
||||||
|
|
|
||||||
|
|
@ -193,12 +193,12 @@ config_socket_init(clicon_handle h)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*! Accept new socket client
|
||||||
* config_accept_client
|
|
||||||
* XXX: credentials not properly implemented
|
* XXX: credentials not properly implemented
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
config_accept_client(int fd, void *arg)
|
config_accept_client(int fd,
|
||||||
|
void *arg)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
clicon_handle h = (clicon_handle)arg;
|
clicon_handle h = (clicon_handle)arg;
|
||||||
|
|
@ -218,7 +218,7 @@ config_accept_client(int fd, void *arg)
|
||||||
char *mem;
|
char *mem;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
clicon_debug(1, "%s", __FUNCTION__);
|
clicon_debug(2, "%s", __FUNCTION__);
|
||||||
len = sizeof(from);
|
len = sizeof(from);
|
||||||
if ((s = accept(fd, (struct sockaddr*)&from, &len)) < 0){
|
if ((s = accept(fd, (struct sockaddr*)&from, &len)) < 0){
|
||||||
clicon_err(OE_UNIX, errno, "%s: accept", __FUNCTION__);
|
clicon_err(OE_UNIX, errno, "%s: accept", __FUNCTION__);
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ backend_notify(clicon_handle h,
|
||||||
struct handle_subscription *hs;
|
struct handle_subscription *hs;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
clicon_debug(1, "%s %s", __FUNCTION__, stream);
|
clicon_debug(2, "%s %s", __FUNCTION__, stream);
|
||||||
/* First thru all clients(sessions), and all subscriptions and find matches */
|
/* First thru all clients(sessions), and all subscriptions and find matches */
|
||||||
for (ce = backend_client_list(h); ce; ce = ce_next){
|
for (ce = backend_client_list(h); ce; ce = ce_next){
|
||||||
ce_next = ce->ce_next;
|
ce_next = ce->ce_next;
|
||||||
|
|
|
||||||
|
|
@ -646,16 +646,18 @@ load_config_filev(clicon_handle h,
|
||||||
goto done;
|
goto done;
|
||||||
if (xt == NULL)
|
if (xt == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
/* Ensure top-level is "config", maybe this is too rough? */
|
|
||||||
xml_name_set(xt, "config");
|
|
||||||
// if ((xn = xml_child_i(xt, 0)) != NULL){
|
// if ((xn = xml_child_i(xt, 0)) != NULL){
|
||||||
|
|
||||||
if ((cbxml = cbuf_new()) == NULL)
|
if ((cbxml = cbuf_new()) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
x = NULL;
|
x = NULL;
|
||||||
while ((x = xml_child_each(xt, x, -1)) != NULL)
|
while ((x = xml_child_each(xt, x, -1)) != NULL) {
|
||||||
|
/* Ensure top-level is "config", maybe this is too rough? */
|
||||||
|
xml_name_set(x, "config");
|
||||||
if (clicon_xml2cbuf(cbxml, x, 0, 0) < 0)
|
if (clicon_xml2cbuf(cbxml, x, 0, 0) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
if (clicon_rpc_edit_config(h, "candidate",
|
if (clicon_rpc_edit_config(h, "candidate",
|
||||||
replace?OP_REPLACE:OP_MERGE,
|
replace?OP_REPLACE:OP_MERGE,
|
||||||
"",
|
"",
|
||||||
|
|
@ -802,10 +804,12 @@ db_copy(clicon_handle h,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These are strings that can be used as 3rd argument to cli_setlog */
|
/* These are strings that can be used as 3rd argument to cli_setlog */
|
||||||
|
#ifdef notused // broke in new version
|
||||||
static const char *SHOWAS_TXT = "txt";
|
static const char *SHOWAS_TXT = "txt";
|
||||||
static const char *SHOWAS_XML = "xml";
|
static const char *SHOWAS_XML = "xml";
|
||||||
static const char *SHOWAS_XML2TXT = "xml2txt";
|
static const char *SHOWAS_XML2TXT = "xml2txt";
|
||||||
static const char *SHOWAS_XML2JSON = "xml2json";
|
static const char *SHOWAS_XML2JSON = "xml2json";
|
||||||
|
#endif
|
||||||
|
|
||||||
/*! This is the callback used by cli_setlog to print log message in CLI
|
/*! This is the callback used by cli_setlog to print log message in CLI
|
||||||
* param[in] s UNIX socket from backend where message should be read
|
* param[in] s UNIX socket from backend where message should be read
|
||||||
|
|
@ -818,12 +822,14 @@ cli_notification_cb(int s,
|
||||||
struct clicon_msg *reply = NULL;
|
struct clicon_msg *reply = NULL;
|
||||||
int eof;
|
int eof;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
char *eventstr = NULL;
|
|
||||||
cxobj *xt = NULL;
|
cxobj *xt = NULL;
|
||||||
cxobj *xn;
|
|
||||||
cxobj *xe;
|
cxobj *xe;
|
||||||
char *format = (char*)arg;
|
char *format = (char*)arg;
|
||||||
|
#if 0
|
||||||
|
char *eventstr = NULL;
|
||||||
|
cxobj *xn;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* get msg (this is the reason this function is called) */
|
/* get msg (this is the reason this function is called) */
|
||||||
if (clicon_msg_rcv(s, &reply, &eof) < 0)
|
if (clicon_msg_rcv(s, &reply, &eof) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -838,8 +844,11 @@ cli_notification_cb(int s,
|
||||||
goto done;
|
goto done;
|
||||||
if (clicon_msg_decode(reply, &xt) < 0)
|
if (clicon_msg_decode(reply, &xt) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if ((xe = xpath_first(xt, "//event")) != NULL)
|
if ((xe = xpath_first(xt, "//event")) != NULL){
|
||||||
eventstr = xml_body(xe);
|
if (xml_print(stdout, xe) < 0)
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
#ifdef notyet /* Broke in new version */
|
||||||
if (strcmp(format, SHOWAS_TXT) == 0){
|
if (strcmp(format, SHOWAS_TXT) == 0){
|
||||||
fprintf(stdout, "%s\n", eventstr);
|
fprintf(stdout, "%s\n", eventstr);
|
||||||
}
|
}
|
||||||
|
|
@ -864,7 +873,7 @@ cli_notification_cb(int s,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
if (xt)
|
if (xt)
|
||||||
|
|
@ -908,6 +917,10 @@ cli_notifyv(clicon_handle h,
|
||||||
formatstr = cv_string_get(cvec_i(argv, 2));
|
formatstr = cv_string_get(cvec_i(argv, 2));
|
||||||
if (strcmp(formatstr, "SHOWAS_TXT") != 0)
|
if (strcmp(formatstr, "SHOWAS_TXT") != 0)
|
||||||
format = MSG_NOTIFY_XML;
|
format = MSG_NOTIFY_XML;
|
||||||
|
if ((formatstr = strdup(formatstr)) == NULL){ /* XXX */
|
||||||
|
clicon_err(OE_PLUGIN, 0, "%s Requires arguments: <logstream> <status> [<format>]", __FUNCTION__);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (cli_notification_register(h,
|
if (cli_notification_register(h,
|
||||||
stream,
|
stream,
|
||||||
|
|
@ -915,7 +928,7 @@ cli_notifyv(clicon_handle h,
|
||||||
"",
|
"",
|
||||||
status,
|
status,
|
||||||
cli_notification_cb,
|
cli_notification_cb,
|
||||||
(void*)strdup(formatstr)) < 0)
|
formatstr) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ clicon_msg_decode(struct clicon_msg *msg,
|
||||||
|
|
||||||
/* body */
|
/* body */
|
||||||
xmlstr = msg->op_body;
|
xmlstr = msg->op_body;
|
||||||
|
clicon_debug(1, "%s %s", __FUNCTION__, xmlstr);
|
||||||
if (clicon_xml_parse_str(xmlstr, xml) < 0)
|
if (clicon_xml_parse_str(xmlstr, xml) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
|
||||||
|
|
@ -606,7 +606,7 @@ clicon_rpc_discard_changes(clicon_handle h)
|
||||||
cxobj *xret = NULL;
|
cxobj *xret = NULL;
|
||||||
cxobj *xerr;
|
cxobj *xerr;
|
||||||
|
|
||||||
if ((msg = clicon_msg_encode("<rpc><discard_changes/></rpc>")) == NULL)
|
if ((msg = clicon_msg_encode("<rpc><discard-changes/></rpc>")) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
if (clicon_rpc_msg(h, msg, &xret, NULL) < 0)
|
if (clicon_rpc_msg(h, msg, &xret, NULL) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
|
|
@ -1011,7 +1011,7 @@ xmldb_get(clicon_handle h,
|
||||||
struct db_pair *pairs;
|
struct db_pair *pairs;
|
||||||
cxobj *xt = NULL;
|
cxobj *xt = NULL;
|
||||||
|
|
||||||
clicon_debug(1, "%s", __FUNCTION__);
|
clicon_debug(2, "%s", __FUNCTION__);
|
||||||
if (db2file(h, db, &dbname) < 0)
|
if (db2file(h, db, &dbname) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (dbname==NULL){
|
if (dbname==NULL){
|
||||||
|
|
@ -1065,8 +1065,8 @@ xmldb_get(clicon_handle h,
|
||||||
goto done;
|
goto done;
|
||||||
if (xml_apply(xt, CX_ELMNT, xml_sanity, NULL) < 0)
|
if (xml_apply(xt, CX_ELMNT, xml_sanity, NULL) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (debug)
|
if (debug>1)
|
||||||
clicon_xml2file(stdout, xt, 0, 1);
|
clicon_xml2file(stderr, xt, 0, 1);
|
||||||
*xtop = xt;
|
*xtop = xt;
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ xpath_parse_predicate(struct xpath_element *xe,
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
len = strlen(pred);
|
len = strlen(pred);
|
||||||
for (i=len-1; i>=0; i--){ /* -2 since we search for ][ */
|
for (i=len-1; i>=0; i--){ /* -1 since we search for ][ */
|
||||||
s = &pred[i];
|
s = &pred[i];
|
||||||
if (i==0 ||
|
if (i==0 ||
|
||||||
(*(s)==']' && *(s+1)=='[')){
|
(*(s)==']' && *(s+1)=='[')){
|
||||||
|
|
@ -358,12 +358,23 @@ xpath_parse(char *xpath,
|
||||||
else if (strncmp(s,"descendant-or-self::", strlen("descendant-or-self::"))==0){
|
else if (strncmp(s,"descendant-or-self::", strlen("descendant-or-self::"))==0){
|
||||||
xpath_element_new(A_DESCENDANT_OR_SELF, s+strlen("descendant-or-self::"), &xpnext);
|
xpath_element_new(A_DESCENDANT_OR_SELF, s+strlen("descendant-or-self::"), &xpnext);
|
||||||
}
|
}
|
||||||
|
#if 1 /* Problems with .[userid=1321] */
|
||||||
|
else if (strncmp(s,".", strlen("."))==0)
|
||||||
|
xpath_element_new(A_SELF, s+strlen("."), &xpnext);
|
||||||
|
#else
|
||||||
else if (strncmp(s,".", strlen(s))==0) /* abbreviatedstep */
|
else if (strncmp(s,".", strlen(s))==0) /* abbreviatedstep */
|
||||||
xpath_element_new(A_SELF, NULL, &xpnext);
|
xpath_element_new(A_SELF, NULL, &xpnext);
|
||||||
|
#endif
|
||||||
|
|
||||||
else if (strncmp(s,"self::", strlen("self::"))==0)
|
else if (strncmp(s,"self::", strlen("self::"))==0)
|
||||||
xpath_element_new(A_SELF, s+strlen("self::"), &xpnext);
|
xpath_element_new(A_SELF, s+strlen("self::"), &xpnext);
|
||||||
|
#if 1
|
||||||
|
else if (strncmp(s,"..", strlen(".."))==0) /* abbreviatedstep */
|
||||||
|
xpath_element_new(A_PARENT, s+strlen(".."), &xpnext);
|
||||||
|
#else
|
||||||
else if (strncmp(s,"..", strlen(s))==0) /* abbreviatedstep */
|
else if (strncmp(s,"..", strlen(s))==0) /* abbreviatedstep */
|
||||||
xpath_element_new(A_PARENT, NULL, &xpnext);
|
xpath_element_new(A_PARENT, NULL, &xpnext);
|
||||||
|
#endif
|
||||||
else if (strncmp(s,"parent::", strlen("parent::"))==0)
|
else if (strncmp(s,"parent::", strlen("parent::"))==0)
|
||||||
xpath_element_new(A_PARENT, s+strlen("parent::"), &xpnext);
|
xpath_element_new(A_PARENT, s+strlen("parent::"), &xpnext);
|
||||||
else if (strncmp(s,"ancestor::", strlen("ancestor::"))==0)
|
else if (strncmp(s,"ancestor::", strlen("ancestor::"))==0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue