mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-30 09:16:22 +00:00
Free OTR TLVS
This commit is contained in:
@@ -708,6 +708,14 @@ otr_encrypt_message(const char * const to, const char * const message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_otr_tlv_free(OtrlTLV *tlvs)
|
||||||
|
{
|
||||||
|
if (tlvs) {
|
||||||
|
otrl_tlv_free(tlvs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
otr_decrypt_message(const char * const from, const char * const message, gboolean *was_decrypted)
|
otr_decrypt_message(const char * const from, const char * const message, gboolean *was_decrypted)
|
||||||
{
|
{
|
||||||
@@ -723,7 +731,6 @@ otr_decrypt_message(const char * const from, const char * const message, gboolea
|
|||||||
// common tlv handling
|
// common tlv handling
|
||||||
OtrlTLV *tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
|
OtrlTLV *tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
|
||||||
if (tlv) {
|
if (tlv) {
|
||||||
|
|
||||||
if (context) {
|
if (context) {
|
||||||
otrl_context_force_plaintext(context);
|
otrl_context_force_plaintext(context);
|
||||||
ui_gone_insecure(from);
|
ui_gone_insecure(from);
|
||||||
@@ -732,16 +739,19 @@ otr_decrypt_message(const char * const from, const char * const message, gboolea
|
|||||||
|
|
||||||
// library version specific tlv handling
|
// library version specific tlv handling
|
||||||
otrlib_handle_tlvs(user_state, &ops, context, tlvs, smp_initiators);
|
otrlib_handle_tlvs(user_state, &ops, context, tlvs, smp_initiators);
|
||||||
|
_otr_tlv_free(tlvs);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// message was decrypted, return to user
|
// message was decrypted, return to user
|
||||||
} else if (decrypted) {
|
} else if (decrypted) {
|
||||||
|
_otr_tlv_free(tlvs);
|
||||||
*was_decrypted = TRUE;
|
*was_decrypted = TRUE;
|
||||||
return decrypted;
|
return decrypted;
|
||||||
|
|
||||||
// normal non OTR message
|
// normal non OTR message
|
||||||
} else {
|
} else {
|
||||||
|
_otr_tlv_free(tlvs);
|
||||||
*was_decrypted = FALSE;
|
*was_decrypted = FALSE;
|
||||||
return strdup(message);
|
return strdup(message);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user