Commit graph

233 commits

Author SHA1 Message Date
Florian Fainelli
26c98ec94d sys: Check return values of chdir and write
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>
2016-12-11 09:15:27 +01:00
Florian Fainelli
f4089654a3 cmake: Find libubus.h
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>
2016-07-27 17:28:46 +02:00
Jo-Philipp Wich
23417e94d2 iwinfo: expose available HT rates
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2016-06-30 00:36:01 +02:00
Denis Osvald
f8174eacef iwinfo: zero out ccode buffer since library doesn't
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>
2016-06-05 16:05:23 +02:00
Luka Perkov
73aea9b8b6 file: add myself in Copyright header
Signed-off-by: Luka Perkov <luka@openwrt.org>
2016-04-12 17:15:27 +02:00
Luka Perkov
2350c6fa91 file: handle return output of b64_decode
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>
2016-04-12 17:15:08 +02:00
Luka Perkov
c8c8f7d014 file: add append write support
Signed-off-by: Luka Perkov <luka@openwrt.org>
2016-04-12 17:14:42 +02:00
Jo-Philipp Wich
e64cbdd9b4 uci: allow setting zero-length values (to delete an option)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-11-23 19:11:44 +01:00
Javier Domingo Cansino
fb6e4604fb paths: substitute literal with macro
Signed-off-by: Javier Domingo Cansino <javierdo1@gmail.com>
2015-11-20 18:00:28 +01:00
John Crispin
f00890cd6e add a reload_config method to the uci object
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-08-25 23:56:32 +02:00
John Crispin
032346f479 add a system object that allows us to set passwords and trigger sysupgrade
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-08-25 23:56:32 +02:00
Luka Perkov
410802e106 file: be consistent with string termination character
Signed-off-by: Luka Perkov <luka@openwrt.org>
2015-07-15 00:21:39 +02:00
Luka Perkov
4db5df8a96 file: add support for setting mode when writing files
Signed-off-by: Luka Perkov <luka@openwrt.org>
2015-07-15 00:21:28 +02:00
Luka Perkov
fc895bb1e2 file: add support for base64
Signed-off-by: Luka Perkov <luka@openwrt.org>
2015-07-15 00:20:17 +02:00
Jo-Philipp Wich
3d655417ab uci: unload package on revert
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-05-17 14:13:02 +02:00
Luka Perkov
9a6bfa110a file: add md5sum support
Signed-off-by: Luka Perkov <luka@openwrt.org>
2015-04-12 21:24:39 +02:00
John Crispin
311c85e7d9 properly handle return codes
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-03-28 18:36:40 +01:00
Luka Perkov
361b823e8d file: free memory after opendir()
Signed-off-by: Luka Perkov <luka@openwrt.org>
2015-03-11 16:25:41 +01:00
Luka Perkov
b65f6a844f file: use blob_buf_free()
Signed-off-by: Luka Perkov <luka@openwrt.org>
2015-03-11 16:25:36 +01:00
Luka Perkov
e2d37b7e40 file: show "data" ubus parameter only when used
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>
2015-03-11 16:25:29 +01:00
John Crispin
b71df5b75f fix for json 0.12
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-03-08 15:04:13 +01:00
Jo-Philipp Wich
805e8ce891 cmake: fix libcrypt test
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-02-26 16:34:31 +01:00
Jo-Philipp Wich
a75c310e7c iwinfo: add phyname procedure
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-02-11 14:07:31 +01:00
Jo-Philipp Wich
7b7f254682 session: fix method signatures for create, list and destroy
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-02-09 12:51:44 +01:00
Felix Fietkau
1ceab6196f iwinfo: add support for requesting assoc info for a specific mac address
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-11-29 19:43:00 +01:00
Felix Fietkau
d99e8adc4f iwinfo: add 802.11ac hw mode
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-10-20 15:49:24 +02:00
Felix Fietkau
ed7d16a3e0 iwinfo: use UBUS_METHOD_NOARG
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-10-04 19:55:58 +02:00
Felix Fietkau
c1ed6d7856 plugin.h: explicitly include json.h
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-10-04 19:54:58 +02:00
Jo-Philipp Wich
7fd4564b8a plugin: fix parsing libexec plugin output
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-07-04 00:06:43 +02:00
Felix Fietkau
3c55504336 session: add missing include
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-06-29 23:22:50 +02:00
Luka Perkov
7c789622a6 uci: rework variable usage
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-05-29 13:04:21 +02:00
Luka Perkov
4cc6a9deb8 fix segmentation fault when plugins are loaded
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>
2014-01-29 13:29:57 +00:00
Luka Perkov
835b8b768d file: when writing a file make sure it's contents are stored
Fixes problems with ubi(fs).

Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-01-29 13:29:48 +00:00
Luka Perkov
11f5072bb1 file: create a file on write if it does not exist
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-01-29 13:29:40 +00:00
Luka Perkov
ec21f653b9 fix whitespaces
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-01-29 13:29:32 +00:00
Jo-Philipp Wich
967d815022 session: make object and function arguments of session.access optional, dump effective acls in this case 2014-01-19 19:45:25 +00:00
Jo-Philipp Wich
49f6e218a4 uci: fix same buffer reuse introduced by previous commit 2014-01-12 17:43:48 +00:00
Jo-Philipp Wich
b0254d1203 debug 2014-01-12 17:42:05 +00:00
Jo-Philipp Wich
7cac6af5ed uci: grant access to confirm and rollback methods only to initiating session
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>
2014-01-12 17:23:27 +00:00
Jo-Philipp Wich
0239c345ca uci: introduce confirm method to cancel pending rollbacks without side effects
Calling commit with rollback=false to cancel a pending rollback timer can
potentially trigger another commit if no rollback is actually pending.

This introduces a new method "confirm" which cancels the rollback timer
without any other possible side effects.

While being at it, change the return code when trying to commit during
a pending rollback or when trying to rollback without a pending timeout to
UBUS_STATUS_NO_DATA. This is needed to be able to differentiate between a
denied request and an inappropriate state.

Also change the error return code for glob() failures to the more
appropriate UBUS_STATUS_NOT_FOUND.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-01-12 17:02:43 +00:00
Jo-Philipp Wich
0c4e97b4e7 Extend copyright 2014-01-12 12:48:58 +00:00
Jo-Philipp Wich
64633f3136 uci: rename uci.apply "commit" attribute to "roolback" and invert its logic 2014-01-12 12:45:11 +00:00
John Crispin
bbaaa41f8c config.change triggers should only run if the config is valid
Signed-off-by: John Crispin <blogic@openwrt.org>
2013-12-18 14:01:33 +01:00
John Crispin
326f5bcaf6 fix inverted apply_running check
Signed-off-by: John Crispin <blogic@openwrt.org>
2013-12-18 13:56:54 +01:00
Jo-Philipp Wich
065d8f47fc uci: make config argument of changes call optional to allow listing all changes in all files 2013-11-23 20:38:09 +00:00
Jo-Philipp Wich
2f5a613718 uci: add state call to retrieve uci state variables 2013-11-23 19:30:29 +00:00
Jo-Philipp Wich
a7ef5ca736 session: fix file descriptor leak in rpc_blob_from_file() 2013-10-26 14:16:29 +00:00
Alexander Couzens
a511e620c8 rpcd: CMake: fix out of tree builds
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
2013-10-10 12:19:01 +00:00
Jo-Philipp Wich
095b1058c8 uci: clear ptr.value in rpc_uci_merge_set(), this fixes missing delete deltas if multiple options are merged 2013-09-29 13:11:37 +00:00
Jo-Philipp Wich
a23010d407 session: change "sid" attribute to "ubus_rpc_session", this ensures that exposed session calls are confined to the calling session context 2013-09-13 14:52:35 +02:00