Skip to content

Fix broken restoring of sessions after rpcd reload

It is necessary to call rpc_uci_granular_init for every new session that is created. Failure to do so leaves the granular_configs AVL tree uninitialised and results in NULL pointer dereference if any uci_granular function is called on the session. Call to rpc_uci_granular_init is therefore moved to rpc_session_new so it will always happen. This resolves issues with NULL pointer dereference when sessions are accessed after rpcd has been reloaded and the session has been restored from /var/run/rpcd/sessions/ by rpc_session_thaw.

When the rpc_session_thaw function is restoring saved sessions, rpc_login_test_login is called multiple times on the same UCI context. It needs to use uci_lookup_package in case configuration is already loaded. Otherwise, if there is more than one session to restore, only the first one will succeed and the remaining ones end up with the ACLs missing.

Merge request reports