Bug 3109 - libravatar: make mail address lower case before hashing MD5
Summary: libravatar: make mail address lower case before hashing MD5
Status: RESOLVED FIXED
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: Plugins (show other bugs)
Version: 3.10.0
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2014-03-13 13:42 UTC by Christian Hesse
Modified: 2014-03-17 09:29 UTC (History)
0 users

See Also:


Attachments
libravatar: make mail address lower case before hashing MD5 (901 bytes, application/x-download)
2014-03-13 13:42 UTC, Christian Hesse
no flags Details
libravatar: make mail address lower case before hashing MD5 (908 bytes, patch)
2014-03-13 14:26 UTC, Christian Hesse
no flags Details | Diff
libravatar: make mail address lower case before hashing MD5 (1.05 KB, patch)
2014-03-13 15:06 UTC, Christian Hesse
mones: applied+
Details | Diff

Description Christian Hesse 2014-03-13 13:42:52 UTC
Created attachment 1343 [details]
libravatar: make mail address lower case before hashing MD5

The hash only matches if email address is lower case, so just do that.
Comment 1 Ricardo Mones 2014-03-13 14:17:49 UTC
Good catch Christian!

And thanks for the patch, but since we're using glib I think using g_ascii_tolower instead of tolower would be better.
Comment 2 Christian Hesse 2014-03-13 14:21:00 UTC
Makes sense... ;) Did not know about that function.

Do you prepare that yourself or do you want a patch?
Comment 3 Ricardo Mones 2014-03-13 14:24:46 UTC
As you prefer: if you update the patch I'll commit as is, otherwise I'll do it myself tonight :)
Comment 4 Christian Hesse 2014-03-13 14:26:24 UTC
Created attachment 1344 [details]
libravatar: make mail address lower case before hashing MD5

Use g_ascii_tolower().
Comment 5 Ricardo Mones 2014-03-13 14:37:51 UTC
I'm very sorry and I should have thought twice before answering.

Just realized that's not the correct point to convert the address to lowercase, because it will be done on every render, which is unnecessary and a waste of cpu cycles.

Conversion to lowercase must be made on libravatar_header_update_hook, just after extract_address call, the address will be always in lowercase for any subsequent rendering calls.
Comment 6 Christian Hesse 2014-03-13 15:06:32 UTC
Created attachment 1345 [details]
libravatar: make mail address lower case before hashing MD5

Update patch, do conversion to lowercase on libravatar_header_update_hook(), just
after extract_address() call.
Comment 7 users 2014-03-14 08:56:03 UTC
Changes related to this bug have been committed.
Please check latest Git and update the bug accordingly.
You can also get the patch from:
http://git.claws-mail.org/

++ ChangeLog	2014-03-14 08:56:03.557538967 +0100
http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=719fc3f474022b0599b1dc636168bb6b64ddf7c8
Merge: 462d00f eeb18db
Author: Colin Leroy <colin@colino.net>
Date:   Fri Mar 14 08:56:03 2014 +0100

    Merge branch 'master' of file:///home/git/claws

http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=eeb18db35ed1136568ae802b2fb7445315471025
Author: Christian Hesse <mail@eworm.de>
Date:   Thu Mar 13 15:03:39 2014 +0100

    Fix bug #3109 “libravatar: make mail address lower case before hashing MD5”
    
    Thanks again Christian Hesse for the patch!

Note You need to log in before you can comment on or make changes to this bug.