summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* uci: add rpc_uci_replace_savedir() helperJo-Philipp Wich2018-04-191-7/+19
| | | | | | | The rpc_uci_replace_savedir() function removes all configured save directories from the uci cursor instance and adds the given path argument as sole item. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* session: ignore non-string username attribute upon restoreJo-Philipp Wich2018-03-151-0/+3
| | | | | | | | | | When restoring session information from blob data, only consider the embedded username attribute if it is a string value. Other types may cause invalid memory accesses when attempting to strcmp() the attribute value. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* session: support reclaiming pending apply sessionJo-Philipp Wich2018-03-153-2/+38
| | | | | | | | | | | Reclaim the pending apply session upon login when the username matches the current login. This is required to support apply-confirm-rollback workflow for ubus browser clients, since changing IPs requires re-login to the device due to cross domain restrictions. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* session: remove redundant key attribute to rpc_session_set()Jo-Philipp Wich2018-03-151-5/+5
| | | | | | | | | | The given const char *key was used to look up the blob attribute, while the blob attributes internal name was used to store it in the avl tree. This leads to confusion and potential memory leaks when the given key name does not match the blob attributes internal name. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* uci: fix session delta isolationJo-Philipp Wich2018-03-151-0/+7
| | | | | | | | | | | The libuci `uci_set_savedir()` function does not replace, but appends the requested delta directory to the search path, this causes information leaks between sessions. Due to a lack of an official api for this, clear the uci contexts private delta path before setting the save directory. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* sys: packagelist: allow listing all packagesDaniel Golle2017-12-061-2/+19
| | | | | | | Introduce optional boolean attribute 'all' to allow listing all installed packages instead of only the user-selected ones. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* sys: fix passwd pathRoman Yeryomin2017-11-281-2/+3
| | | | Signed-off-by: Roman Yeryomin <roman@advem.lv>
* sys: fix memory leak in packagelistDaniel Golle2017-11-121-0/+1
| | | | | | Fixes commit 4e483312b0. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* sys: add packagelist methodDaniel Golle2017-11-121-0/+79
| | | | | | | | | Add method to list installed software packages directly from /usr/lib/opkg/status (ie. no need to have opkg installed). ubus call rpc-sys packagelist Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* plugin: use RTLD_LOCAL instead of RTLD_GLOBAL when loading libraryRafał Miłecki2017-11-091-1/+1
| | | | | | | | | | | | | | | RTLD_GLOBAL was used to allow plugins use each other symbols but this facility was (most likely) never used and is a bad design anyway. If there is a common code it should just go to a library. Using RTLD_LOCAL on the other hand saves us from conflicting symbols used by different plugins. An example can be iwinfo plugin using libnl. If there appears to be another plugin using incompatible netlink implementation this will result in a problem. Both plugins will start using the same libnl which will break one of them. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: Jo-Philipp Wich <jo@mein.io>
* cmake: Find libubox/blobmsg_json.hFlorian Fainelli2016-12-111-0/+3
| | | | | | | | Add a CMake FIND_PATH and INCLUDE_DIRECTORIES searching for blobmsg_json.h. Some external toolchains which do not include standard locations would fail to find the header otherwise. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
* sys: Check return values of chdir and writeFlorian Fainelli2016-12-111-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | Fixes the following warnings: rpcd/sys.c: In function 'rpc_cgi_password_set': rpcd/sys.c:116:8: error: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Werror=unused-result] chdir("/"); ^ rpcd/sys.c:125:8: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result] write(fds[1], blobmsg_data(tb[RPC_P_PASSWORD]), ^ rpcd/sys.c:127:8: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result] write(fds[1], "\n", 1); ^ rpcd/sys.c:131:8: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result] write(fds[1], blobmsg_data(tb[RPC_P_PASSWORD]), ^ rpcd/sys.c:133:8: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result] write(fds[1], "\n", 1); ^ cc1: all warnings being treated as errors Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
* cmake: Find libubus.hFlorian Fainelli2016-07-271-0/+3
| | | | | | | | Add a CMake FIND_PATH and INCLUDE_DIRECTORIES searching for libubus.h. Some external toolchains which do not include standard locations would fail to find the header otherwise. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
* iwinfo: expose available HT ratesJo-Philipp Wich2016-06-301-0/+36
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* iwinfo: zero out ccode buffer since library doesn'tDenis Osvald2016-06-051-1/+1
| | | | | | | | | | | Making an ubus call iwinfo countrylist '{"device":"radio0"}' will result in some entries having garbage uninitialized stack bytes in the "code" fields. With this patch we zero-initialize the buffer that libiwinfo writes to, making it NUL-terminated so that behavior doesn't happen anymore. Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
* file: add myself in Copyright headerLuka Perkov2016-04-121-0/+1
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* file: handle return output of b64_decodeLuka Perkov2016-04-121-1/+1
| | | | | | | | | Solve this compile warning: file.c:300:16: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare] if (data_len < 0) Signed-off-by: Luka Perkov <luka@openwrt.org>
* file: add append write supportLuka Perkov2016-04-121-1/+7
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* uci: allow setting zero-length values (to delete an option)Jo-Philipp Wich2015-11-231-2/+1
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* paths: substitute literal with macroJavier Domingo Cansino2015-11-201-2/+2
| | | | Signed-off-by: Javier Domingo Cansino <javierdo1@gmail.com>
* add a reload_config method to the uci objectJohn Crispin2015-08-251-0/+17
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* add a system object that allows us to set passwords and trigger sysupgradeJohn Crispin2015-08-252-0/+258
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* file: be consistent with string termination characterLuka Perkov2015-07-151-1/+1
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* file: add support for setting mode when writing filesLuka Perkov2015-07-151-1/+10
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* file: add support for base64Luka Perkov2015-07-151-11/+79
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* uci: unload package on revertJo-Philipp Wich2015-05-171-0/+3
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* file: add md5sum supportLuka Perkov2015-04-121-0/+35
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* properly handle return codesJohn Crispin2015-03-283-6/+15
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* file: free memory after opendir()Luka Perkov2015-03-111-0/+2
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* file: use blob_buf_free()Luka Perkov2015-03-111-0/+4
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* file: show "data" ubus parameter only when usedLuka Perkov2015-03-111-19/+28
| | | | | | | The ubus calls for file read, list and stat do not use data parameter, so lets remove them to avoid confusion. Signed-off-by: Luka Perkov <luka@openwrt.org>
* fix for json 0.12John Crispin2015-03-081-1/+1
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* cmake: fix libcrypt testJo-Philipp Wich2015-02-261-1/+1
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* iwinfo: add phyname procedureJo-Philipp Wich2015-02-111-0/+59
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* session: fix method signatures for create, list and destroyJo-Philipp Wich2015-02-091-10/+18
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* iwinfo: add support for requesting assoc info for a specific mac addressFelix Fietkau2014-11-291-13/+54
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* iwinfo: add 802.11ac hw modeFelix Fietkau2014-10-201-0/+3
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* iwinfo: use UBUS_METHOD_NOARGFelix Fietkau2014-10-041-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* plugin.h: explicitly include json.hFelix Fietkau2014-10-041-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* plugin: fix parsing libexec plugin outputJo-Philipp Wich2014-07-041-5/+2
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* session: add missing includeFelix Fietkau2014-06-291-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* uci: rework variable usageLuka Perkov2014-05-291-4/+1
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* fix segmentation fault when plugins are loadedLuka Perkov2014-01-292-2/+2
| | | | | | | | Function rpc_plugin_register_library() is modifying the struct's contents in list_add() call. That said, the rpc_plugin struct should not be defined as const. This caused segmentation fault when built on up-to-date Arch Linux. Signed-off-by: Luka Perkov <luka@openwrt.org>
* file: when writing a file make sure it's contents are storedLuka Perkov2014-01-291-1/+7
| | | | | | Fixes problems with ubi(fs). Signed-off-by: Luka Perkov <luka@openwrt.org>
* file: create a file on write if it does not existLuka Perkov2014-01-291-7/+5
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* fix whitespacesLuka Perkov2014-01-293-7/+7
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* session: make object and function arguments of session.access optional, dump ↵Jo-Philipp Wich2014-01-191-8/+17
| | | | effective acls in this case
* uci: fix same buffer reuse introduced by previous commitJo-Philipp Wich2014-01-121-2/+0
|
* debugJo-Philipp Wich2014-01-121-1/+6
|
* uci: grant access to confirm and rollback methods only to initiating sessionJo-Philipp Wich2014-01-121-16/+26
| | | | | | | | | Previously any session with access permissions for the corresponding method was able to confirm or rollback commits initiated by another session. Change those methods to only grant access to the initiating session. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>