After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 474000 - Use GLib's Base64 API
Use GLib's Base64 API
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: general
1.12.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2007-09-05 19:24 UTC by Matthew Barnes
Modified: 2013-09-14 16:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (7.88 KB, patch)
2007-09-05 19:24 UTC, Matthew Barnes
committed Details | Review
Additional patch for evolution-data-server (18.67 KB, patch)
2007-09-12 03:40 UTC, Matthew Barnes
committed Details | Review
Proposed patch for evolution (6.17 KB, patch)
2007-09-12 03:40 UTC, Matthew Barnes
committed Details | Review
Proposed patch for evolution-exchange (883 bytes, patch)
2007-09-12 03:41 UTC, Matthew Barnes
committed Details | Review
Proposed patch for camel (15.41 KB, patch)
2007-09-12 18:02 UTC, Matthew Barnes
committed Details | Review
Additional patch for Camel (511 bytes, patch)
2007-11-07 18:24 UTC, Matthew Barnes
committed Details | Review
Additional patch strengthens error handling (5.30 KB, patch)
2007-11-15 17:51 UTC, Matthew Barnes
committed Details | Review

Description Matthew Barnes 2007-09-05 19:24:06 UTC
This bug is a piece of bug #376991.  I'm breaking things up to try and expedite the simple parts.

From bug #376991:

- Use the new Base64 API in GLib 2.12 for encoding and decoding passwords
  in the account passwords file.  All of the Base64 stuff at the end of
  e-passwords.c drops out.

I shipped the following patch in Fedora 7.
Comment 1 Matthew Barnes 2007-09-05 19:24:50 UTC
Created attachment 95020 [details] [review]
Proposed patch
Comment 2 Matthew Barnes 2007-09-12 03:39:22 UTC
I'm piling on to this a bit because I found several other Base64 codec implementations in evolution-data-server.  Here's what I changed in addition
to the above patch for e-passwords.c:

  - libsoup's Base64 API is deprecated in favor of GLib's.  Change all calls
    to soup_base64_encode() to g_base64_encode().  Similarly with decode.

  - Remove the Exchange server's Base64 implementation.

  - Remove the EVCard Base64 implementation.

  - Remove the LDIF importer's Base64 decoder implementation.

  - Camel's Base64 API should be deprecated and I plan to do so after this
    round of patches are committed.  For now, convert all external calls to
    Camel's Base64 API over to GLib's Base64 API.
Comment 3 Matthew Barnes 2007-09-12 03:40:01 UTC
Created attachment 95398 [details] [review]
Additional patch for evolution-data-server
Comment 4 Matthew Barnes 2007-09-12 03:40:39 UTC
Created attachment 95399 [details] [review]
Proposed patch for evolution
Comment 5 Matthew Barnes 2007-09-12 03:41:14 UTC
Created attachment 95400 [details] [review]
Proposed patch for evolution-exchange
Comment 6 Matthew Barnes 2007-09-12 18:02:06 UTC
Created attachment 95470 [details] [review]
Proposed patch for camel

Here's the final patch that deprecates Camel's Base64 API and turns it into thin wrappers for GLib's Base64 API.  I also changed Camel to not use the newly deprecated functions internally.

Please check my work carefully on this one!

CC'ing Philip since I imagine he'll be interested.
Comment 7 Srinivasa Ragavan 2007-09-27 06:28:18 UTC
Matthew, I have reviewed the patches and it seems fine for me. I liked the deprecation and fallback to g_base* in camel. I haven't compiled /tested it. Please do so and commit to head.
Comment 8 Matthew Barnes 2007-09-27 20:21:36 UTC
Committed patches to Subversion trunk:

Evolution (revision 34325)
Evolution-Data-Server (revision 8090)
Evolution-Exchange (revision 1480)
Comment 9 Philip Van Hoof 2007-10-07 17:14:59 UTC
This work/bug/patch has been used to synchronized tinymail's camel-lite
Comment 10 Pascal Terjan 2007-11-05 16:38:40 UTC
The camel patch has an issue :
When camel_base64_decode_simple gets "" as data, g_base64_decode will return NULL, the g_assert will be OK (as out_len will be <= 0), so memcpy will be called with NULL as source.
Comment 11 Srinivasa Ragavan 2007-11-06 04:55:21 UTC
Matthew?
Comment 12 Matthew Barnes 2007-11-07 17:28:00 UTC
Looking into it.  Also double-checking whether these changes are related to the recent GAL authentication breakage.
Comment 13 Matthew Barnes 2007-11-07 18:24:48 UTC
Created attachment 98735 [details] [review]
Additional patch for Camel

This patch adds argument guards to camel_base64_decode_simple() so that it fails gracefully on invalid data.  Of course nothing in Evolution or E-D-S should still be calling this function...
Comment 14 Matthew Barnes 2007-11-07 18:47:34 UTC
Okay, I'm fairly certain the GAL authentication issues are unrelated to this.
Comment 15 Philip Van Hoof 2007-11-08 22:07:17 UTC
Camel-lite has been updated with this patch: 
http://tinymail.org/trac/tinymail/changeset/2932
Comment 16 Srinivasa Ragavan 2007-11-09 14:44:35 UTC
Commit
Comment 17 Matthew Barnes 2007-11-09 17:32:58 UTC
Committed to trunk (revision 8188).
Comment 18 Matthew Barnes 2007-11-15 17:28:35 UTC
Reopening due to a flaw in my error handling logic.  See [1] for details.

[1] http://bugzilla.redhat.com/show_bug.cgi?id=384741
Comment 19 Matthew Barnes 2007-11-15 17:51:02 UTC
Created attachment 99152 [details] [review]
Additional patch strengthens error handling

Patch for the previously mentioned bug.  Basically just ensures that 'length' is initialized before calling g_base64_decode().  Fixed across the board.
Comment 20 Matthew Barnes 2007-11-15 17:52:51 UTC
Philip, you'll want to pick the Camel hunks out of this.
Comment 21 Milan Crha 2007-11-15 18:05:38 UTC
(In reply to comment #19)
> Created an attachment (id=99152) [edit]
> Additional patch strengthens error handling
> 
> Patch for the previously mentioned bug.  Basically just ensures that 'length'
> is initialized before calling g_base64_decode().  Fixed across the board.
> 

Just add ChangeLog entry and make all those len gsize and commit to trunk.
Comment 22 Milan Crha 2007-11-15 18:06:34 UTC
...and stable :)
Comment 23 Matthew Barnes 2007-11-15 18:27:38 UTC
Thanks for the quick review, Milan.  Turns out my original Base64 changes are not in the stable branch, so this patch doesn't apply there.  My mistake.

Committed to trunk (revision 8215).
Comment 24 Philip Van Hoof 2007-11-21 09:18:28 UTC
Committed patch in #19 to camel-lite