Commit graph

146 commits

Author SHA1 Message Date
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
Jo-Philipp Wich
6b189b2201 plugin: use blobmsg_type() instead of blob_id() 2013-09-12 13:36:49 +02:00
Jo-Philipp Wich
22c7c2675d session.c: use blobmsg_type() instead of blob_id() 2013-09-12 13:31:21 +02:00
Jo-Philipp Wich
296c9d9ceb session: support negative group expressions
This change allows excluding specific groups after a wildcard expression.
The following example would grant read access to any acl group except the
group named "example".

  list read '*'
  list read '!example'
2013-09-12 13:10:30 +02:00
Jo-Philipp Wich
b76addec87 session: restore ACL dumping for session get and session list calls 2013-09-12 12:13:05 +02:00
Jo-Philipp Wich
4c9f178ad6 session: fix enum mismatch in rpc_handle_get() and rpc_handle_set() 2013-09-12 12:04:14 +02:00
Jo-Philipp Wich
6128bf647c session: remove unused ctx argument from rpc_session_grant() and rpc_session_destroy() 2013-09-12 12:04:14 +02:00
Jo-Philipp Wich
d0d1a92432 session: do not dump and restore session ACLs but recalculate them when restoring the session 2013-09-12 12:04:06 +02:00
Jo-Philipp Wich
00a3ec2e52 session: disallow destroying the null session 2013-09-12 10:35:55 +02:00
Jo-Philipp Wich
ae63188069 uci: properly deal with uci_load() failures 2013-09-11 13:16:27 +02:00
Jo-Philipp Wich
4d618b2e3b session: fix argument order of crypt() and prevent segfault if /etc/config/rpcd does not exist 2013-09-10 20:12:39 +02:00
Jo-Philipp Wich
4bf5d60f65 session: use correct policy for rpc_handle_login() 2013-09-10 20:01:05 +02:00
Jo-Philipp Wich
5a101fcc08 session: setup a persistent NULL section and implement login procedure 2013-09-10 19:56:36 +02:00
Jo-Philipp Wich
22fbf13086 Drop LuCI2 backend, it will move to its own repository 2013-09-09 16:32:53 +02:00
John Crispin
6f78bfbbdf add config transaction support
Signed-off-by: John Crispin <blogic@openwrt.org>
2013-09-06 01:42:02 +02:00
John Crispin
7abfa9bc05 make uci commit calls trigger config.change events
Signed-off-by: John Crispin <blogic@openwrt.org>
2013-09-06 01:31:23 +02:00
John Crispin
f1882ac5bd rename rpc_uci_purge_savedir to rpc_uci_purge_dir
Signed-off-by: John Crispin <blogic@openwrt.org>
2013-09-06 01:31:16 +02:00
Jo-Philipp Wich
334a067a74 Fix rpcd includes in plugin.h 2013-09-05 17:00:23 +02:00
Jo-Philipp Wich
b86774de65 Set umask to 0077 on daemon startup to prevent libuci from making world-readable directories 2013-09-05 16:14:30 +02:00
Jo-Philipp Wich
fa53571f2b Use common /var/run/rpcd base directory to store runtime information 2013-09-05 15:14:00 +02:00
Jo-Philipp Wich
b4649c9fda main: only purge uci savedirs if not reloading 2013-09-05 14:38:01 +02:00
Jo-Philipp Wich
fc1b008e08 uci: expose rpc_uci_purge_savedirs() helper 2013-09-05 14:38:01 +02:00
Jo-Philipp Wich
524032c291 main: store session data to disk on receipt of SIGUSR1 or SIGHUP. On HUP terminate self and re-exec 2013-09-05 14:37:56 +02:00
Jo-Philipp Wich
aa2afdb739 session: add support for saving and restoring session data to disk 2013-09-04 17:08:56 +02:00
Jo-Philipp Wich
e0afdb10ae Move includes into subdirectory 2013-09-04 12:46:11 +02:00
Jo-Philipp Wich
b3a5c08e08 uci: use per-session save directory and register session destroy callback to purge leftover deltas 2013-09-03 13:40:47 +02:00
Jo-Philipp Wich
ad8e937f97 luci2: change ops->access to ops->session_access to accomodate for changed plugin api 2013-09-03 12:47:06 +02:00
Jo-Philipp Wich
059a6df1fd plugin: expose rpc_session_create_cb() and rpc_session_destroy_cb() in plugin ops; rename access to session_access 2013-09-03 12:47:06 +02:00
Jo-Philipp Wich
60b9c9d919 session: introduce api to register session create and destroy callbacks 2013-09-03 12:47:04 +02:00
Jo-Philipp Wich
11f37e2889 Fold plugin specific headers files into the plugins .c file 2013-09-02 17:29:06 +02:00
Jo-Philipp Wich
07c2f0a9b1 Rename from "luci-rpcd" to "rpcd" 2013-09-02 17:23:30 +02:00
Jo-Philipp Wich
84642137f0 Add CMake definitions for plugins 2013-09-02 15:24:00 +02:00
Jo-Philipp Wich
7434b2bf6c luci2: convert to plugin library 2013-09-02 15:23:09 +02:00
Jo-Philipp Wich
c849d04fc8 file: convert to plugin library 2013-09-02 15:23:09 +02:00
Jo-Philipp Wich
bc100538d3 iwinfo: convert to plugin library 2013-09-02 15:23:09 +02:00
Jo-Philipp Wich
3d358bb3a1 Introduce shared object plugin api 2013-09-02 15:23:04 +02:00
Jo-Philipp Wich
0b4d4aeeac Register dummy stderr callback when ivoking plugins calls to avoid filling the ustream with unread data. 2013-09-01 22:42:17 +02:00
Jo-Philipp Wich
3cac366777 Link json-c 2013-09-01 22:22:42 +02:00