about summary refs log tree commit diff stats
path: root/src/xmpp
Commit message (Collapse)AuthorAgeFilesLines
* Set mucuser in carbon caseMichael Vetter2019-10-291-0/+8
| | | | | | | | | | | Also we initialize mucuser properly. Now in case of a carbon of a MUC PM we sv_ev_incoming_carbon() which calls _sv_ev_incoming_plain() and then we log it via chat_log_msg_in() in there. But we also get the sv_ev_incoming_private_message() and call chat_log_msg_in() in there too. So the incoming message get's logged twice.
* Make prof_identifier constMichael Vetter2019-10-221-1/+1
|
* Display ownership of connection_get_profanity_identifierMichael Vetter2019-10-222-2/+2
|
* Use UUID in origin-id and idMichael Vetter2019-10-222-11/+11
| | | | | Let's use UUID to have a more random string then just 10 alphanumeric values.
* Remove old commentMichael Vetter2019-10-211-1/+0
| | | | | It's not up to date. Some time ago we changed from individual handlers to general ones.
* Set prof_ident to NULL after freeMichael Vetter2019-10-211-1/+2
| | | | | | | | | | | | | | | | | | This caused the bug mentioned in the PR comment: ``` It seems with the changes done here we get a crash in: src/xmpp/message.c message_handlers_init() when looking up handlers: ProfMessageHandler *handler = g_hash_table_lookup(pubsub_event_handlers, curr->data);. Steps to reproduce: open Profanity and connect /autoping set 10 /autoping timeout 10 stop WiFi/connection wait for Lost connection restart wifi /connect ```
* Rename _calculate_identifier to _compute_identifierMichael Vetter2019-10-201-3/+3
|
* Rename random_bytes to profanity_instance_idMichael Vetter2019-10-191-6/+6
|
* Free hmac and msgidMichael Vetter2019-10-192-3/+7
|
* Free prof_identifier in case of reconnectMichael Vetter2019-10-191-0/+3
| | | | Bedore we assign it new.
* Move ProfMessage and message_is_sent_by_us to xmppMichael Vetter2019-10-192-23/+24
| | | | Not meant for internal usage only.
* Change origin-id/id algoMichael Vetter2019-10-182-14/+29
| | | | | Hash twice. Use HMAC SHA256 from glib.
* Move message sent by us logic in own functionMichael Vetter2019-10-182-0/+17
|
* Add connection_get_profanity_identifier stubMichael Vetter2019-10-182-2/+2
| | | | And move defintion to xmpp.h
* Add XEP-0359 to capabilitiesMichael Vetter2019-10-181-0/+1
| | | | | | | | | | | | | We implement </origin-id> from [XEP-0359](https://xmpp.org/extensions/xep-0359.html). We already had this implemented for OMEMO. And now use it to check whether MUC messages were sent from us (https://github.com/profanity-im/profanity/issues/1201). We don't implement </stanza-id> yet, but probably need to do so for MAM. Anyways let's flag this as implementing the XEP. Fix https://github.com/profanity-im/profanity/issues/1207
* Log incoming MUC messages if origin-id sais they dont come from usMichael Vetter2019-10-182-10/+9
| | | | Regards https://github.com/profanity-im/profanity/issues/1201
* Remove prefix from stanza idMichael Vetter2019-10-1710-64/+64
| | | | | We sent `prof_prefix_uuid` as id. Where the prefix was also optional. We don't need this at all.
* Change algo for connection_create_stanza_id()Michael Vetter2019-10-171-7/+11
|
* Change connection_create_stanza_id()Michael Vetter2019-10-171-11/+11
| | | | | To return identifier and uuid together. We can remove the prefix later on.
* Calculate identifier upon connectMichael Vetter2019-10-161-5/+28
| | | | | | | This will be needed so that we can later detect if messages (origin-in) was sent by us. Regards https://github.com/profanity-im/profanity/issues/1207
* Rename identification fileMichael Vetter2019-10-161-1/+2
|
* Use random string for random-bytes identifierMichael Vetter2019-10-161-4/+5
| | | | | | And rename `instance` to `identifier`. Regards https://github.com/profanity-im/profanity/issues/1207
* Move code from jid_random_resource() into own functionMichael Vetter2019-10-161-12/+4
| | | | | Move the code that creates a random string into it's own function +get_random_string().
* Create random-bytes fileMichael Vetter2019-10-161-0/+53
| | | | | | | | | | So far only with dummy value. We will need an identifier that we can hash together with a message ID and put in as the origin-id. So when we receive message we can unsplit it and see if it was sent from this client. Regards https://github.com/profanity-im/profanity/issues/1207
* Improve MUC 1:1 loggingMichael Vetter2019-10-072-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we get a private message from a user in a MUC profanity shows this like: `profanity@roomsASDF.dismail.de/Martin: Hi` This was so far logged at: `~/.local/share/profanity/chatlogs/my-account-at-server/profanity_at_rooms.dismail.de/2019_09_04.log` as: ``` 10:48:13 - profanity@rooms.dismail.de: Hi ``` So the nickname was not saved anywhere. This is due to us not knowing whether we got a regular message from user@server.org/resource or a MUC PM from room@server.org/user. We now check for `<x xmlns='http://jabber.org/protocol/muc#user' />` and add the resourcepart to the logging if we get it. The file will be created at `~/.local/share/profanity/chatlogs/my-account-at-server/profanity_at_rooms.dismail.de_nick` and look like: ``` 23:59:43 - nick: Hi ``` Fix https://github.com/profanity-im/profanity/issues/1184
* 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