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 437331 - Read NSS certificate files more reliably
Read NSS certificate files more reliably
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: Mailer
1.10.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2007-05-10 02:05 UTC by Matthew Barnes
Modified: 2007-10-07 17:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (2.59 KB, patch)
2007-05-10 02:06 UTC, Matthew Barnes
committed Details | Review

Description Matthew Barnes 2007-05-10 02:05:52 UTC
I rewrote the part of Camel that reads NSS certificates in an attempt to fix a downstream bug about Evolution crashing at startup [1].

camel_certdb_nss_cert_get() currently calls read() to read the certificate file and tries to handle all the corner cases that come with using system I/O calls directly (e.g. interrupts, error conditions, short reads).  The reporter of the downstream bug is seeing warning messages emanating from this function before Evolution crashes, so my assumption is that the read logic is not properly handling some corner case.

I rewrote the read logic to just call g_file_get_contents(), which handles all these corner cases for you.

[1] http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=215634
Comment 1 Matthew Barnes 2007-05-10 02:06:21 UTC
Created attachment 87927 [details] [review]
Proposed patch
Comment 2 Matthew Barnes 2007-05-10 02:11:23 UTC
Philip, I thought you might be interested in this.
Comment 3 Jeffrey Stedfast 2007-05-10 16:20:35 UTC
hmmm, path is getting free'd and then used later (original code).

also I'm not sure I see any problem with the previous read loop, tho it probably should have reused camel-file-utils.c's i/o wrappers.

Comment 4 Matthew Barnes 2007-05-10 16:46:28 UTC
Agreed, it should be calling some higher-level function than read(), be it in Camel or GLib.

The reporter is seeing the following warnings that seem to indicate the file is not being read correctly.  It's hard to say what's causing the read() failure since the original code doesn't output strerror(errno).

(evolution:3032): camel-WARNING **: rawcert != derCer
(evolution:3032): camel-WARNING **: cert size read truncated X\xf7r\xb4: 0 != 827
Comment 5 Srinivasa Ragavan 2007-05-11 05:31:59 UTC
As per comment #3 updating patch status.
Comment 6 Matthew Barnes 2007-05-11 13:15:08 UTC
I think either Camel's I/O wrappers or g_file_get_contents() would work fine.  Camel's I/O wrappers seems like a bit of an overkill to me; this operation doesn't need to be cancellable.
Comment 7 Philip Van Hoof 2007-05-12 07:55:55 UTC
comment #2: Indeed. I will take a look. Thanks.
Comment 8 Matthew Barnes 2007-05-16 20:58:14 UTC
Changing the patch status back to "none", as I feel it's ready for review as is.
Comment 9 Srinivasa Ragavan 2007-06-10 18:58:00 UTC
Ah! I misread it. Sorry for the confusion for the patch state.

Varadhan: Can you review this for 2.11.4?
Comment 10 Matthew Barnes 2007-08-14 13:48:44 UTC
I'm going to confirm this bug since the downstream reporter claims the patch fixed his crash (see [1] and subsequent comments).

[1] http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=215634#c21
Comment 11 Veerapuram Varadhan 2007-08-23 12:28:51 UTC
Patch looks good.  Please commit to trunk with a ChangeLog.
Comment 12 Matthew Barnes 2007-08-23 14:44:07 UTC
Committed to trunk (revision 7982).
Comment 13 Philip Van Hoof 2007-10-07 17:22:08 UTC
Committed this patch to Tinymail's camel-lite.

http://tinymail.org/trac/tinymail/changeset/2824