about summary refs log tree commit diff stats
path: root/src/xmpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix typo handel -> handleMichael Vetter2019-10-061-3/+3
|
* Fix invalid read in muc codeMichael Vetter2019-10-061-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We didn't set the variables to NULL, but the rest of the code depends on this check. ``` ==22201== Invalid read of size 8 ==22201== at 0x44E560: autocomplete_clear (autocomplete.c:69) ==22201== by 0x427B2C: muc_invites_clear (muc.c:190) ==22201== by 0x461328: ev_disconnect_cleanup (common.c:59) ==22201== by 0x463FB5: cl_ev_disconnect (client_events.c:91) ==22201== by 0x431252: cmd_disconnect (cmd_funcs.c:1234) ==22201== by 0x47E883: clears_chat_sessions (test_cmd_disconnect.c:28) ==22201== by 0x487E9E1: _run_test (in /usr/lib64/libcmocka.so.0.7.0) ==22201== by 0x487ECCC: _run_tests (in /usr/lib64/libcmocka.so.0.7.0) ==22201== by 0x47F1BE: main (unittests.c:629) ==22201== Address 0x814b690 is 0 bytes inside a block of size 24 free'd ==22201== at 0x48379AB: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==22201== by 0x44E5F7: autocomplete_free (autocomplete.c:90) ==22201== by 0x4278A0: muc_close (muc.c:97) ==22201== by 0x47DBAA: cmd_join_uses_password_when_supplied (test_cmd_join.c:169) ==22201== by 0x487E9E1: _run_test (in /usr/lib64/libcmocka.so.0.7.0) ==22201== by 0x487ECCC: _run_tests (in /usr/lib64/libcmocka.so.0.7.0) ==22201== by 0x47F1BE: main (unittests.c:629) ==22201== Block was alloc'd at ==22201== at 0x483677F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==22201== by 0x44E51B: autocomplete_new (autocomplete.c:57) ==22201== by 0x427837: muc_init (muc.c:88) ==22201== by 0x47DA77: cmd_join_uses_password_when_supplied (test_cmd_join.c:154) ==22201== by 0x487E9E1: _run_test (in /usr/lib64/libcmocka.so.0.7.0) ==22201== by 0x487ECCC: _run_tests (in /usr/lib64/libcmocka.so.0.7.0) ==22201== by 0x47F1BE: main (unittests.c:629) ```
* Detect MUC history correctly with some Prosody versionsMichael Vetter2019-09-301-1/+3
| | | | | | | | | | Some versions of prosody send the domainpart. See https://issues.prosody.im/1416 Workaround to handle those cases. Thanks to Holger Weiss for helping with this! Fix https://github.com/profanity-im/profanity/issues/1190
* Log alleged roster push to fileMichael Vetter2019-09-121-0/+1
| | | | | | | | | | https://gultsch.de/dino_multiple.html mentions CVE-2019-16235, CVE-2019-16236 and CVE-2019-16237. CVE-2019-16235: Is checking the from in carbon messages. We do that. CVE-2019-16236: Is checking the from in roster pushes. We do that but didn't log it yet. CVE-2019-16237: Is checking the form in MAM messages. We don't support them yet.
* Set message->plain in carbon caseMichael Vetter2019-09-041-1/+8
| | | | | message->plain should always contain something. In the case of the carbons we forgot to set if rom the body in case it's empy.
* Remove duplicate code in roster_updateMichael Vetter2019-08-231-9/+1
| | | | | Part of what `roster_update()` does manually is actually done in `roster_change_name()`.
* Don't render (all) delayed messages as MUC historyHolger Weiß2019-08-203-2/+20
| | | | | | | | Double-check that a <delay/> tag on a groupchat message was actually added by the MUC service (rather than the sending client) before assuming it was received from the MUC history. Fixes #1173.
* Fix memleak in /cmd execPaul Fariello2019-07-301-0/+7
|
* Fix command form submitPaul Fariello2019-07-301-1/+1
| | | | | Command form userdata were freed by iq_id_handler. We should now free the command ourself.
* Merge pull request #1160 from profanity-im/fix/1159-groupaddsegfaultMichael Vetter2019-07-221-4/+0
|\ | | | | Fix segfault in group add/remove command
| * Fix segfault in group add/remove commandMichael Vetter2019-07-221-4/+0
| | | | | | | | | | Also regarding destructor. Fix https://github.com/profanity-im/profanity/issues/1159
* | Fix memleak in roster_change_name()Michael Vetter2019-07-221-2/+2
| |
* | Fix memleak in roster_removeMichael Vetter2019-07-221-1/+1
| | | | | | | | strdup() is not needed here but will actually lead to a memleak.
* | Fix memory leak in roster_update()Michael Vetter2019-07-221-1/+2
|/ | | | current_name should not be const and should be freed.
* Fix segfault in block commandMichael Vetter2019-07-191-6/+0
| | | | | | Another case of double free() due to new destructor. Fixes https://github.com/profanity-im/profanity/issues/1156
* Fixup for last commitMichael Vetter2019-07-121-1/+0
|
* Fix segfault in iq_{submit,cancel}_command_configMichael Vetter2019-07-121-6/+0
| | | | Taken care of by the destructor.
* Merge pull request #1150 from paulfariello/hotfix/omemo-memleaksMichael Vetter2019-07-112-2/+13
|\ | | | | | | | | Hotfix/omemo memleaks Regards https://github.com/profanity-im/profanity/issues/1131
| * Fix various OMEMO memleaksPaul Fariello2019-07-102-2/+13
| |
* | Fix some more potential double freesMichael Vetter2019-07-111-34/+0
|/ | | | Regards https://github.com/profanity-im/profanity/issues/1148
* Reduce codelines in form.cMichael Vetter2019-07-101-16/+2
| | | | | Let's use calloc instead of malloc and then setting almost all fields to NULL.
* Fix double free in roster_process_pending_presenceMichael Vetter2019-07-101-1/+0
| | | | This is taken care of now in the destructor _pendingPresence_free().
* Add destructor for roster_pending_presenceMichael Vetter2019-07-091-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | Fix: ``` ==18682== 408 bytes in 17 blocks are definitely lost in loss record 3,279 of 3,632 ==18682== at 0x483677F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==18682== by 0x42F602: roster_update_presence (roster_list.c:129) ==18682== by 0x448AA3: sv_ev_contact_online (server_events.c:906) ==18682== by 0x43D2BA: _available_handler (presence.c:674) ==18682== by 0x43C81B: _presence_handler (presence.c:398) ==18682== by 0x5AF118E: handler_fire_stanza (handler.c:124) ==18682== by 0x5AEDBDA: _handle_stream_stanza (conn.c:1253) ==18682== by 0x5AFA43E: _end_element (parser_expat.c:190) ==18682== by 0x6818AA4: doContent (xmlparse.c:2977) ==18682== by 0x681A3AB: contentProcessor (xmlparse.c:2552) ==18682== by 0x681D7EB: XML_ParseBuffer (xmlparse.c:1988) ==18682== by 0x681D7EB: XML_ParseBuffer (xmlparse.c:1957) ==18682== by 0x5AF0A63: xmpp_run_once (event.c:255) ==18682== by 0x432E5D: connection_check_events (connection.c:104) ==18682== by 0x4323B3: session_process_events (session.c:255) ==18682== by 0x42C097: prof_run (profanity.c:128) ==18682== by 0x4B25B9: main (main.c:172) ```
* Fix double free in room id handlerMichael Vetter2019-07-091-6/+1
| | | | | Free is done in destructor now. Regards https://github.com/profanity-im/profanity/issues/1148
* Fix double free in omemo_start_device_session_handle_bundle()Michael Vetter2019-07-081-0/+1
| | | | | | | | | omemo_key_free() was called to free the key. It free the key->data too. But in same cases this was not set yet. So we need to set the data to NULL (or use calloc) at initialization so that omemo_key_free() only frees it if it was actually allocated. Regards https://github.com/profanity-im/profanity/issues/1148
* Fix double free regarding iq handlersMichael Vetter2019-07-081-14/+4
|
* Merge pull request #1146 from profanity-im/fix/omemoleaks-autocomplMichael Vetter2019-07-042-25/+58
|\ | | | | Fix several OMEMO related leaks
| * Free iq_id_handlers correctlyMichael Vetter2019-07-041-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | so far only the key part was freed. We also need to free the actual handler. Fix: ``` ==21171== 1,128 bytes in 47 blocks are definitely lost in loss record 3,476 of 3,670 ==21171== at 0x483677F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==21171== by 0x434248: iq_id_handler_add (iq.c:265) ==21171== by 0x4B122E: omemo_devicelist_request (omemo.c:46) ==21171== by 0x4AC411: omemo_start_session (omemo.c:409) ==21171== by 0x4AC37C: omemo_start_sessions (omemo.c:396) ==21171== by 0x447881: sv_ev_roster_received (server_events.c:189) ==21171== by 0x444019: roster_result_handler (roster.c:312) ==21171== by 0x433FC2: _iq_handler (iq.c:202) ==21171== by 0x5AF118E: ??? (in /usr/lib64/libmesode.so.0.0.0) ==21171== by 0x5AEDBDA: ??? (in /usr/lib64/libmesode.so.0.0.0) ==21171== by 0x5AFA43E: ??? (in /usr/lib64/libmesode.so.0.0.0) ==21171== by 0x6818AA4: ??? (in /usr/lib64/libexpat.so.1.6.8) ==21171== by 0x681A3AB: ??? (in /usr/lib64/libexpat.so.1.6.8) ==21171== by 0x681D7EB: XML_ParseBuffer (in /usr/lib64/libexpat.so.1.6.8) ==21171== by 0x5AF0A63: xmpp_run_once (in /usr/lib64/libmesode.so.0.0.0) ==21171== by 0x432E5D: connection_check_events (connection.c:104) ==21171== by 0x4323B3: session_process_events (session.c:255) ==21171== by 0x42C097: prof_run (profanity.c:128) ==21171== by 0x4B2627: main (main.c:172) ```
| * Free key on error in omemo_start_device_session_handle_bundle()Michael Vetter2019-07-041-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix: ``` ==20561== 32 bytes in 1 blocks are definitely lost in loss record 1,467 of 3,678 ==20561== at 0x483677F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==20561== by 0x4B16C9: omemo_start_device_session_handle_bundle (omemo.c:167) ==20561== by 0x43405E: _iq_handler (iq.c:214) ==20561== by 0x5AF118E: ??? (in /usr/lib64/libmesode.so.0.0.0) ==20561== by 0x5AEDBDA: ??? (in /usr/lib64/libmesode.so.0.0.0) ==20561== by 0x5AFA43E: ??? (in /usr/lib64/libmesode.so.0.0.0) ==20561== by 0x6818AA4: ??? (in /usr/lib64/libexpat.so.1.6.8) ==20561== by 0x681A3AB: ??? (in /usr/lib64/libexpat.so.1.6.8) ==20561== by 0x681D7EB: XML_ParseBuffer (in /usr/lib64/libexpat.so.1.6.8) ==20561== by 0x5AF0A63: xmpp_run_once (in /usr/lib64/libmesode.so.0.0.0) ==20561== by 0x432E5D: connection_check_events (connection.c:104) ==20561== by 0x4323B3: session_process_events (session.c:255) ==20561== by 0x42C097: prof_run (profanity.c:128) ==20561== by 0x4B260D: main (main.c:172) ```
| * Rework omemo_start_device_session_handle_bundle exitMichael Vetter2019-07-041-24/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some conditions we just returned without freeing allocated variables. Should fix following valgrind reported leak: ``` ==17941== 19 bytes in 1 blocks are definitely lost in loss record 613 of 3,674 ==17941== at 0x483677F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==17941== by 0x5BB0DAA: strdup (strdup.c:42) ==17941== by 0x4B1592: omemo_start_device_session_handle_bundle (omemo.c:126) ==17941== by 0x43405E: _iq_handler (iq.c:214) ==17941== by 0x5AF118E: ??? (in /usr/lib64/libmesode.so.0.0.0) ==17941== by 0x5AEDBDA: ??? (in /usr/lib64/libmesode.so.0.0.0) ==17941== by 0x5AFA43E: ??? (in /usr/lib64/libmesode.so.0.0.0) ==17941== by 0x6818AA4: ??? (in /usr/lib64/libexpat.so.1.6.8) ==17941== by 0x681A3AB: ??? (in /usr/lib64/libexpat.so.1.6.8) ==17941== by 0x681D7EB: XML_ParseBuffer (in /usr/lib64/libexpat.so.1.6.8) ==17941== by 0x5AF0A63: xmpp_run_once (in /usr/lib64/libmesode.so.0.0.0) ==17941== by 0x432E5D: connection_check_events (connection.c:104) ==17941== by 0x4323B3: session_process_events (session.c:255) ==17941== by 0x42C097: prof_run (profanity.c:128) ==17941== by 0x4B2610: main (main.c:172) ```
* | Fix plaintext private message handlingPaul Fariello2019-07-041-3/+3
|/
* Use correct jid variableMichael Vetter2019-07-031-1/+1
|
* Define goto out in _private_chat_handler()Michael Vetter2019-07-031-0/+1
|
* Set plain message in _private_chat_handlerMichael Vetter2019-07-031-0/+7
| | | | | | In case that plain is NULL we need to copy over from body. Fix https://github.com/profanity-im/profanity/issues/1144
* Fix a segfault when carbon has no bodyPaul Fariello2019-06-211-11/+13
|
* Don't highlight cleartext message as untrustedPaul Fariello2019-06-211-0/+1
|
* Fix segfault when receiving messages without IDPaul Fariello2019-06-211-1/+3
|
* Fix NULL pointer when handling non encrypted message in MUCPaul Fariello2019-06-211-1/+9
|
* Rename prof_message_t into ProfMessagePaul Fariello2019-06-202-11/+11
|
* Add prof_message_t to wrap all message attributesPaul Fariello2019-06-202-114/+164
| | | | | | | Probably missing copy of body to plain in carbon and privmessage. Only covers the incoming message path because goal is OMEMO decryption of untrusted message. Cover some of the log functions but not all.
* Use flags in xmmp/message.c for encryption and trustPaul Fariello2019-06-202-10/+25
|
* Add trusted state after OMEMO decryptionPaul Fariello2019-06-203-11/+14
| | | | Use it to print message on red background if not trusted.
* _bookmark_destroy: follow normal logicMichael Vetter2019-06-201-7/+5
|
* Call message_handlers_clear() upon disconnectMichael Vetter2019-06-203-0/+10
| | | | Free pubsub_event_handlers. Fix memory leaks.
* Call iq_handlers_clear() upon disconnectMichael Vetter2019-06-203-0/+10
| | | | Free id_handlers. Fix memory leaks.
* statusbar: check if roster existsMichael Vetter2019-06-042-0/+9
| | | | | | | | | | | | We destory the roster in ev_disconnect_cleanup(). Adding a function to test if the roster has been destroyed and testing for it in the statusbar. So now when the connection is lost 'Lost connection' is printed in all open windows. We can then reconnect with `/connect accountname`. Should fix https://github.com/profanity-im/profanity/issues/1083
* Merge pull request #1106 from profanity-im/saved-accountMichael Vetter2019-06-031-28/+7
|\ | | | | Don't clear saved account data in session_disconnect()
| * Don't clear saved account data in session_disconnect()Dmitry Podgorny2019-06-031-28/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If connection loss occurs, it calls session_disconnect() eventually. This function clears saved account data which is required for reconnection. Therefore, when reconnect timer expires, we get errors: 02/06/2019 04:53:42: stderr: ERR: (profanity:17115): GLib-CRITICAL **: 04:53:42.305: g_key_file_has_group: assertion 'group_name != NULL' failed 02/06/2019 04:53:43: prof: ERR: Unable to reconnect, account no longer exists: (null) To solve it, don't clear the saved data in session_disconnect(). It will be cleared properly on connection loss if reconnect timer is not configured. But won't be cleared with /disconnect command. So, after /disconnect the data will live in memory until the next /connect. Also, remove some copy-paste in connection loss path.
* | Cancel autoping timer on disconnect or connection lossDmitry Podgorny2019-06-032-8/+13
|/ | | | | | | | | If Profanity is disconnected in any way before ping response is received, the autoping timer will expire after the next connection is established. As result, user will be disconnected immediately. Cancel autoping timer in ev_disconnect_cleanup(), so it is done for all kind of disconnections.
* xmpp/connection: fix #1103Dmitry Podgorny2019-06-011-11/+28
| | | | | | | | | | | | When connection is lost, profanity tries to disconnect what leads to an infinite loop. The loop occurs, because connection_disconnet() runs xmpp_run_once() separately and waits for XMPP_CONN_DISCONNECT event. But it doesn't happen, because the connection object is disconnected. As solution, don't disconnect after XMPP_CONN_DISCONNECT is received. Also, don't free libstrophe objects while the event loops executes, because the event loop continues using objects after callbacks quit.