1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00
Commit Graph

70 Commits

Author SHA1 Message Date
Michael Vetter
d0047c8376 Dont initialize omemo autocompleter twice
We already do this in omemo_init() no need to do it again in
omemo_on_connect().
2019-07-04 10:38:24 +02:00
Michael Vetter
199162b11a Add omemo_close function
We call omemo_init() when starting profanity and should have an
omemo_close() at exit.

For now we free the fingerprint autocompleter in there.

Fixes valgrind:
```
==13226== 24 bytes in 1 blocks are definitely lost in loss record 2,855
of 6,958
==13226==    at 0x483677F: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==13226==    by 0x48AD39: autocomplete_new (autocomplete.c:57)
==13226==    by 0x4AB89F: omemo_init (omemo.c:127)
==13226==    by 0x42C283: _init (profanity.c:206)
==13226==    by 0x42BFF3: prof_run (profanity.c:98)
==13226==    by 0x4B25E6: main (main.c:172)
```

Regards https://github.com/profanity-im/profanity/issues/1131
2019-07-04 10:30:56 +02:00
Paul Fariello
f081766913 Mark messages received from a session as trusted 2019-06-25 18:43:15 +02:00
Paul Fariello
a650ecc67d Add trusted state after OMEMO decryption
Use it to print message on red background if not trusted.
2019-06-20 14:29:55 +02:00
Paul Fariello
2604786cb6 Decrypt all incoming OMEMO msg
Trust all key as long as it's for reading. This code isn't multithread
safe.
2019-06-20 14:29:55 +02:00
Michael Vetter
29e2d16e14 Free contacts in omemo_start_sessions() 2019-06-19 23:18:45 +02:00
Michael Vetter
0d698d4898 Free OMEMO session store upon disconnect 2019-06-19 23:15:24 +02:00
Michael Vetter
e4b007c9da Add copyright to omemo code 2019-06-17 10:47:56 +02:00
Paul Fariello
5731a7c472 Remove OMEMO session when untrusting a fingerprint
We have to store known_devices in a long term fashion otherwise we might
not be able to delete session if it is remove from device list server
side.
2019-06-07 23:43:40 +02:00
Paul Fariello
04cd1b4409 Correctly handle malformed OMEMO messages
Fix #1101
2019-05-23 13:12:02 +02:00
Michael Vetter
722cb5fdc3 OMEMO: Initialize result in omemo_automatic_start
This is actually not needed because result will always be set.

hartmann had problems building profanity on OpenBSD and he proposed this
patch.

Let's use it to make the compiler happy there.
2019-04-29 11:32:22 +02:00
Paul Fariello
a6eb0d2c43 Handle missing real jid in OMEMO encrypted MUC
This should never happens since we should ensure MUC is Non-Anonymous
before enabling OMEMO.

But we should neither segfault if this happens.
2019-04-17 14:03:14 +02:00
Paul Fariello
5f015e32b2 Add OMEMO policy
There is 3 policy:

- manual: OMEMO session are only started manually
- automatic: OMEMO session are only started if they have been started
  manually before
- always: OMEMO session are always started unless they have been ended
  manually before

Closes #1040 and fixes #1052
2019-04-17 14:03:14 +02:00
Paul Fariello
9c0a395408 Don't persist OMEMO {signed,}prekey cleaning on disconnect
We should not remove signed prekey and prekey from persistent storage
when cleaning OMEMO store on disconnect.
2019-04-14 22:03:16 +02:00
Paul Fariello
94a39b2e9b Handle malformed OMEMO identity.txt
If OMEMO identity.txt is malformed just abort loading.
User should be able to call `/omemo gen` again.
2019-04-14 22:03:16 +02:00
Paul Fariello
c33d8e5f0b Don't unload OMEMO cryto on disconnect if OMEMO wasn't loaded
If OMEMO wasn't loaded, removing key would create empty identity.txt
file. Then at load time it would segfault profanity.

Another commit should fix load of malformed identity.txt.
2019-04-14 22:03:16 +02:00
Paul Fariello
df648ba959 Try to start sessions with every jid in roster 2019-04-10 17:24:56 +02:00
Paul Fariello
0bc660400b Automatically starts OMEMO if one identity is trusted 2019-04-10 17:24:56 +02:00
Paul Fariello
25eb138d0b Rework trusted fingerprint storage
Stop using "jid:device_id" keys. And move long term storage to its own
file: trust.txt.
2019-04-10 17:23:46 +02:00
Paul Fariello
4ad6904216 Wait for discovery end to publish omemo devicelist and bundle
Add sv_ev_connection_features_received for that purpose
2019-04-10 17:23:46 +02:00
Paul Fariello
01e96769c2 Prefix static function with _ 2019-04-10 17:23:46 +02:00
Paul Fariello
0f4dd61776 Ensure pre keys are generated if missing from long term storage 2019-04-10 17:23:46 +02:00
Paul Fariello
5cd2b8dc9d Permanently store pre keys 2019-04-10 17:23:46 +02:00
Paul Fariello
562302846a Handle bundle publication error on publish-options
We try to reconfigure node and publish again.
If it fails again then we give up.
2019-04-10 17:23:45 +02:00
Paul Fariello
904528b490 Ensure signal context is built on connection
We can't keep it between two connection because signal context is
specific to a given account.
2019-04-10 17:23:45 +02:00
Paul Fariello
075d4cf35b Don't use glib 2.58 func 2019-04-10 17:23:45 +02:00
Paul Fariello
678bff9169 Add fingerprint autocompletion 2019-04-10 17:12:31 +02:00
Paul Fariello
3d8f47a724 Use /omemo fingerprint to show contact fingerprints
Don't print fingerprints when they are received
2019-04-10 17:12:31 +02:00
Paul Fariello
91ee289c77 Add support for disconnect in OMEMO 2019-04-10 17:12:31 +02:00
Paul Fariello
9a66e74986 Handle absent muc member 2019-04-10 17:12:31 +02:00
Paul Fariello
4e1ffa6bdb Log and print outgoing encrypted message 2019-04-10 17:12:31 +02:00
Paul Fariello
a9d55dec92 Add support for sending encrypted message in MUC 2019-04-10 17:12:31 +02:00
Paul Fariello
031e906035 Cosmetics rename variable barejid into roomjid 2019-04-10 17:12:31 +02:00
Paul Fariello
cf528383bd Allow to start OMEMO in MUC 2019-04-10 17:12:31 +02:00
Paul Fariello
a3897abba1 Add MUC message decryption 2019-04-10 17:12:31 +02:00
Paul Fariello
33b0b46420 Fix prekey handling after first use
libsignal will remove prekey on its own.
2019-04-10 17:12:31 +02:00
Paul Fariello
0dd5441f92 device_list iq should be from barejid or none
Ensure we request device_list and remove non conforming handling of
responses.

Move initialisation of iq_handlers before call to sv_ev_login_account_success
2019-04-10 17:12:31 +02:00
Paul Fariello
6bb7deeb9c Add logs about crypto generation 2019-04-10 17:12:31 +02:00
Paul Fariello
197e098f4b Log device_id on startup 2019-04-10 17:12:31 +02:00
Paul Fariello
4826da3aa6 Don't rely on account name being jid 2019-04-10 17:12:31 +02:00
Paul Fariello
8952684472 Add hints about trust command when printing fingerprints 2019-04-10 17:12:31 +02:00
Paul Fariello
2455bcc28a Avoid using xmpp_jid_bare 2019-04-10 17:12:31 +02:00
Paul Fariello
2622c2d21a Add OMEMO untrust command 2019-04-10 17:12:31 +02:00
Paul Fariello
dbf96dcfc6 Allow to trust own device id 2019-04-10 17:12:31 +02:00
Paul Fariello
063a5d1c52 Add trust command 2019-04-10 17:12:31 +02:00
Paul Fariello
23485eb4e7 Don't trust unknown identity keys
Also add long terme storage of known identity keys.
If a key is stored it means it is trusted.
2019-04-10 17:12:31 +02:00
Paul Fariello
b3be504e84 Add OMEMO fingerprint command 2019-04-10 16:31:45 +02:00
Paul Fariello
55407ee15f Add OMEMO session long term storage 2019-04-10 16:31:45 +02:00
Paul Fariello
5eb66aea26 Replace used prekey in bundle 2019-04-10 16:31:45 +02:00
Paul Fariello
1b5848fb23 Start new session upon prekey reception 2019-04-10 16:31:45 +02:00