summaryrefslogtreecommitdiff
path: root/ubus.c
AgeCommit message (Collapse)Author
2020-08-05ubus: use BLOBMSG_TYPE_UNSPEC for "params" JSON attributeRafał Miłecki
According to the JSON-RPC 2.0 specification "params" value can be either an Array or Object. This change makes parse_json_rpc() accept both. Type validation should be handled by a function that actually reads "params" depending on expected format. This doesn't change existing behaviour but allows adding more methods (that expect Object) in the future. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2020-08-05ubus: drop unused "obj" argumentsRafał Miłecki
Both: uh_ubus_send_request() and uh_ubus_send_list() don't use it. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2020-07-25ubus: parse "call" method params only for relevant callRafał Miłecki
There is no point in parsing "call" specific params for other ("list") method calls. This is a minor cleanup that doesn't change uhttpd ubus behaviour. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: Jo-Philipp Wich <jo@mein.io>
2019-08-17ubus: increase maximum ubus request size to 64KBJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-06-16uhttpd: Fix multiple format string problemsHauke Mehrtens
After format string checks were activated in libubox the compiler started to complain about multiple missuses in uhttpd. This fixes the format strings without changing the behavior. blobmsg_get_string() just checks if the parameter is not NULL and then calls blobmsg_data() and casts the result. I think non of these problem is security relevant. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2015-03-11fixes for json 0.12John Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-01-25ubus: don't make uhttpd_plugin symbol constantJo-Philipp Wich
uhttpd modifies the list_head member of the uhttpd_plugin struct when loading a plugin, therefore we cannot make it const, otherwise we trigger a security violation if uhttpd is built with RelRO support. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-06-10ubus: add CORS header supportJo-Philipp Wich
In order to support cross-domain AJAX requests to the /ubus endpoint we need to implement the Cross-Origin Resource Sharing (CORS) spec in the ubus plugin. - Implement a new option "-X" to enable CORS support in ubus - Implement rudimentary support for "OPTIONS" HTTP requests - Implement essential CORS headers the ubus plugin The current CORS response headers merely reflect the request headers sent by the client, this way any requesting origin is automatically allowed. Cross-domain cookies (Access-Control-Allow-Credentials) are unconditionally enabled. Restricting permitted origins and toggle the credential accepting can be made configurable in a future commit to allow more fine grained control over permitted AJAX clients. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2013-11-27ubus: remove indentation and whitespace from JSON responses to conserve a ↵Jo-Philipp Wich
bit of bandwidth
2013-11-21uhttpd: fix crashes in the ubus pluginFelix Fietkau
The ubus plugin calls blocking ubus functions that loop back into uloop_run. Protect the client data structure with refcounting to ensure that the outer uloop_run call does not clean up the data that the inner uloop_run call is still processing. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-09-13ubus: use "ubus_rpc_session" instead of "sid" attribute name when querying ↵Jo-Philipp Wich
session.access
2013-09-13ubus: deny requests with a "ubus_rpc_session" toplevel attribute to prevent ↵Jo-Philipp Wich
injecting different SIDs
2013-08-08ubus: pass current session id as ubus_rpc_session attribute to any called ↵Jo-Philipp Wich
procedure
2013-08-07ubus: move sid into the params array of the json-rpc request to avoid ↵Jo-Philipp Wich
information leakage via the post url
2013-08-07ubus: use per-request blob buffer to fetch list results, fixes global buffer ↵Jo-Philipp Wich
corruption with concurrent requests
2013-06-21ubus: fix handling of empty JSON-RPC batchesFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-08ubus: duplicate request buffer to avoid memory corruption with multiple requestsJo-Philipp Wich
2013-06-08ubus: use half of the script timeout as timeout for acl lookup callJo-Philipp Wich
2013-06-05ubus: implement list method to enumerate objects and signaturesJo-Philipp Wich
2013-05-30ubus: clear the right timeout on rpc connection teardownsFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-30ubus: fix script timeout unit (seconds, not milliseconds)Felix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-26ubus: use a default sid if authentication is disabledJo-Philipp Wich
2013-01-25ubus: pass json rpc arguments to called ubus functionsJo-Philipp Wich
2013-01-25ubus: add option to not authenticate ubus requestsJo-Philipp Wich
2013-01-25ubus: remove session api from plugin and check access via ubus call to let ↵Jo-Philipp Wich
other services provide the session api
2013-01-13relicense to ISCFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-13rework the ubus plugin to support JSON-RPC 2.0Felix Fietkau
2013-01-07ubus: split out session handling code into ubus-session.cFelix Fietkau
2013-01-07fix typoFelix Fietkau
2013-01-07fix prefix lookupFelix Fietkau
2013-01-07add ubus supportFelix Fietkau