Re: [Patch/GMime3 branch] Autocrypt



Am 30.11.19 17:55 schrieb(en) Albrecht Dreß:
I suspect that there is some lower-case vs. mixed case mail address confusion – can you please try the 
attached patch (which enforces lower-case for all mail addresses; this is not strictly RFC 5322 compliant, as 
the local-part shall be case-sensitive, but in practice it is).  The patch just changes the SQL queries.

…now *with* the patch…
diff --git a/libbalsa/autocrypt.c b/libbalsa/autocrypt.c
index b993ccaed..86fb1a820 100644
--- a/libbalsa/autocrypt.c
+++ b/libbalsa/autocrypt.c
@@ -133,13 +133,13 @@ gboolean
 autocrypt_init(GError **error)
 {
        static const gchar * const prepare_statements[NUM_QUERIES] = {
-               "SELECT * FROM autocrypt WHERE LOWER(addr) = ?",
-               "INSERT INTO autocrypt VALUES (?1, ?2, ?2, ?3, ?4, ?5, ?6)",
+               "SELECT * FROM autocrypt WHERE addr = LOWER(?)",
+               "INSERT INTO autocrypt VALUES (LOWER(?1), ?2, ?2, ?3, ?4, ?5, ?6)",
                "UPDATE autocrypt SET last_seen = MAX(?2, last_seen), ac_timestamp = ?2, pubkey = ?3, 
fingerprint = ?4,"
-               " expires = ?5, prefer_encrypt = ?6 WHERE addr = ?1",
-               "UPDATE autocrypt SET last_seen = ?2 WHERE addr = ?1 AND last_seen < ?2 AND ac_timestamp < 
?2",
+               " expires = ?5, prefer_encrypt = ?6 WHERE addr = LOWER(?1)",
+               "UPDATE autocrypt SET last_seen = ?2 WHERE addr = LOWER(?1) AND last_seen < ?2 AND 
ac_timestamp < ?2",
                "SELECT pubkey FROM autocrypt WHERE fingerprint LIKE ?",
-               "SELECT addr, last_seen, ac_timestamp, prefer_encrypt, pubkey FROM autocrypt ORDER BY 
LOWER(addr) ASC"
+               "SELECT addr, last_seen, ac_timestamp, prefer_encrypt, pubkey FROM autocrypt ORDER BY addr 
ASC"
        };
        gboolean result;
 

Attachment: pgpVDZetsjVBZ.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]