Repository navigation
Polish Lua Plugin system - #2261
Merged
Merged
Conversation
We unconditionally sent an omemo_bundle_request() for every device ID in the device list, regardless of whether an active session already existed. According to XEP-0384 Section 4, clients MUST NOT fetch a new bundle if an active session already exists. This consumes one-time prekeys from peer servers on every chat opening or startup event, and risks corrupting active ratchet states. Also skip requesting bundles for our own current device ID. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
On login omemo_start_sessions() iterated over all contacts in the roster and initiated device list and bundle requests. According to XEP-0384 Section 4, sessions should be established lazily only when sending an encrypted message or upon receiving an incoming prekey message. Requesting crypto materials for the entire roster causes massive startup IQ traffic and drains remote servers one-time prekeys for contacts that may never be messaged. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
When a peer or our own account publishes an updated device list via PEP, omemo_set_device_list() detected new device IDs and displayed a notice. But did not fetch the bundle for the new device. In blind trust mode, subsequent outgoing messages failed to encrypt to the new device. If trustmode is set to `blind`, automatically request the bundle for any new device ID announced via PEP for existing contacts or own devices. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
…t mode Upgrade 'blind' trust mode to follow Blind Trust Before Verification (XEP-0454). Device keys are trusted automatically until at least one of a contacts fingerprint is manually verified via '/omemo trust'. Once verified, the contact is marked as verified in a dedicated [verified_contacts] section in trust.txt. Blind trust is disabled for that contact. Any subsequent devices announced by that contact will require manual verification rather than being blindly accepted. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
We return a pointer directly into the internal roster->name_to_barejid hash table. The documentation explicitly notes that the returned pointer should not be freed explicitly. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
…r hooks Memory is allocated via glib. Then later in _lua_prof_settings_get(), it was freed using free(). Same for hooks. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
Duplicate the string with auto_gchar before passing it to cmd_process_input(). Because we should not corrupt Luas string pool. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
If we use g_path_buf_init_from_path() it allocated heap memory in glib >= 2.76. We need to use g_path_buf_clear() to free it. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
When a plugin registered custom autocompleters, entries were inserted into plugin_to_acs and plugin_to_filepath_acs. On plugin unload, autocompleters were never cleaned up. So stale autocompletions remained active. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
When a plugin was unloaded, its registered disco features were never removed from the features table. And disco_remove_features() decremented refs in features but did not remove the plugin from the list. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
Restructure _plugins_shutdown() to trigger prof_on_shutdown hooks, close callbacks and subsystem state while lua_States are still alive, and destroy plugin structs afterwards. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
Inspect table elements with lua_tostring() and free items before calling luaL_error() if an invalid element is encountered. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
Ensure callbacks_remove(), autocompleters_remove_plugin(), and disco_remove_features() are invoked before closing the Lua state on load failure. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Polish the Lua plugin sytem by fixing mem leaks and weird results during shutdown and input completion fallthrough.