diff --git a/apps/backend/backend_main.c b/apps/backend/backend_main.c index f0309132..fd4e6170 100644 --- a/apps/backend/backend_main.c +++ b/apps/backend/backend_main.c @@ -399,7 +399,7 @@ ret2status(int ret, return retval; } - +#if 0 /* DEBUG */ /* Debug timer */ int backend_timer_setup(int fd, @@ -429,6 +429,7 @@ backend_timer_setup(int fd, done: return retval; } +#endif /* DEBUG */ /*! usage */ @@ -1024,10 +1025,12 @@ main(int argc, /* Start session-id for clients */ clicon_session_id_set(h, 0); +#if 0 /* debug */ /* Enable this to get prints of datastore and session status */ if (0 && clicon_debug_get() && backend_timer_setup(0, h) < 0) goto done; +#endif if (stream_timer_setup(0, h) < 0) goto done; if (clixon_event_loop(h) < 0) diff --git a/apps/restconf/restconf_main_native.c b/apps/restconf/restconf_main_native.c index ab68516e5..fadef7c9 100644 --- a/apps/restconf/restconf_main_native.c +++ b/apps/restconf/restconf_main_native.c @@ -1705,7 +1705,7 @@ restconf_sig_term(int arg) } else exit(-1); - clicon_exit_set(); /* XXX should rather signal event_base_loop */ + clicon_exit_set(); } /*! Usage help routine diff --git a/lib/src/clixon_path.c b/lib/src/clixon_path.c index 33101948..b90194d9 100644 --- a/lib/src/clixon_path.c +++ b/lib/src/clixon_path.c @@ -1074,6 +1074,15 @@ api_path2xml_vec(char **vec, } break; default: /* eg Y_CONTAINER, Y_LEAF */ + if (restval != NULL){ + if (strict){ + cprintf(cberr, "malformed api-path, =%s not expected", restval); + if (xerr && + netconf_malformed_message_xml(xerr, cbuf_get(cberr)) < 0) + goto done; + goto fail; + } + } if (x0 && (x = xml_find_type(x0, NULL, name, CX_ELMNT)) == NULL){ /* eg key of list */ if ((x = xml_new(name, x0, CX_ELMNT)) == NULL) diff --git a/test/test_restconf_err.sh b/test/test_restconf_err.sh index 78466aaa..27e6a2e9 100755 --- a/test/test_restconf_err.sh +++ b/test/test_restconf_err.sh @@ -195,6 +195,8 @@ expectpart "$(curl $CURLOPTS -X GET -H 'Accept: application/yang-data+xml' $RCPR # XXX cannot get this to work for all combinations of nc/netcat fcgi/native # But leave it here for debugging where netcat works properly +# Alt try something like: +# printf "Hello World!" | (exec 3<>/dev/tcp/127.0.0.1/80; cat >&3; cat <&3; exec 3<&-) if false; then # Look for netcat or nc for direct socket http calls if [ -n "$(type netcat 2> /dev/null)" ]; then @@ -245,6 +247,9 @@ fi new "restconf GET non-qualified list" expectpart "$(curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:a)" 0 'HTTP/1.1 400 Bad Request' "{\"ietf-restconf:errors\":{\"error\":{\"error-type\":\"rpc\",\"error-tag\":\"malformed-message\",\"error-severity\":\"error\",\"error-message\":\"malformed key =example:a, expected '=restval'\"}}}" +new "restconf GET container with rest-api" +expectpart "$(curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:table=x)" 0 'HTTP/1.1 400 Bad Request' "{\"ietf-restconf:errors\":{\"error\":{\"error-type\":\"rpc\",\"error-tag\":\"malformed-message\",\"error-severity\":\"error\",\"error-message\":\"malformed api-path, =x not expected\"}}}" + new "restconf GET non-qualified list subelements" expectpart "$(curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:a/k)" 0 'HTTP/1.1 400 Bad Request' "^{\"ietf-restconf:errors\":{\"error\":{\"error-type\":\"rpc\",\"error-tag\":\"malformed-message\",\"error-severity\":\"error\",\"error-message\":\"malformed key =example:a, expected '=restval'\"}}}"