[Proposal/Patch] Replacing libesmtp in Balsa



Hi all,

as I promised a while ago, I finally prepared a /very/ first patch implementing the replacement of the 
libesmtp library by GIO for SMTP.

Unfortunately, the patch is so big that I cannot send it by mail; please load it from 
<http://www.mynetcologne.de/~nc-dreszal/balsa-smtp-gio.tar.bz2>.  After unpacking, you can verify the contents by 
running "gpg2 --verify balsa-smtp-gio.diff.asc balsa-smtp-gio.diff".

Basically, the patch is divided into two bigger parts: a new library in the folder libnetclient, and all the 
changes to the Balsa code.


(1) libnetclient
================

This library consists of a base class (libnetclient/net-client.[hc]), a derived class for the SMTP client 
(libnetclient/net-client-smtp.[hc]) and a few common helper functions (libnetclient/net-client-utils.[hc]).  
The sub-folder libnetclient/test contains a full unit test environment.  Please see the file 
libnetclient/README for more details.  Additionally, a Makefile template (libnetclient/Makefile.am) and a 
Doxygen control file (libnetclient/libnetclient.dox) for building the API docs are included.

Please note that you need to add extra options to configure as to check for the testing and documentation 
requirements, respectively:

<snip>
  --with-libnetclient-docs   Check requirements for building the libnetclient API docs (see 
libnetclient/README; default=no)
  --with-libnetclient-test   Check requirements for running libnetclient tests (see libnetclient/README; 
default=no)
</snip>

Please note also that libnetclient creates a dependency against gnutls, as gio also depends on it.


(2) Balsa changes
=================

Basically, in the balsa source code I removed everything which depends on ENABLE_ESMTP being unset (i.e. calling sendmail 
directly).  In the "old" libesmtp code, I replaced everything by calling the new library.  The result looks more or 
less like the "old" code with libesmtp being enabled, with the exception of libbalsa/send.c which contains most of the 
changes, and as a result shrunk significantly.  The coding style of that file is a mess, btw., and I must admit that my changes 
do not improve it, shame on me!  I hope we can use uncrustify in the future to fix it...

A special issue is the functionality of libesmtp to remove certain headers.  As libnetclient entirely depends 
upon GMime passing the proper input, I added a new GMime filter to remove unwanted headers from a GMime 
stream.  Currently, the all Bcc:, Status:, X-Status: and X-Balsa-* headers are removed, but this could easily 
be extended.

An other confusing issue was the treatment of Bcc: message recipients.  The balsa code used to double the message with 
different headers under certain circumstances, i.e. passing them /twice/ to the MTA.  As the RFC 5321 "RCPT 
TO" addresses are completely unrelated to RFC 5322 headers in the message itself, I removed the duplication (as I 
mentioned before, The Bcc: headers are stripped thanks to the new filter).  Please correct me if this is the wrong 
approach...

As libnetclient transparently handles SSL and STARTTLS encryption, I joined the respective options into a 
"security" setting, with warnings about insecure options (this may be controversial, as an unencrypted 
connection to localhost is not problematic).  However, IMO the SMTP configuration dialogue needs some changes, inter 
alia user certificate selection (see below), and maybe a check box whether authentication is required.

The complete functionality of the current, libesmtp-based implementation should be available, with the 
following exceptions:
- Currently, only the PLAIN, LOGIN, CRAM-MD5 and CRAM-SHA1 authentication methods are supported.  This should 
cover most use cases, though (actually, isp's will typically enforce encryption these days, so PLAIN or LOGIN 
are safe).  If other mechanisms are required (which?) please let me know.
- Authentication using user-certificates is not yet supported; it's in libnetclient, but the config gui needs 
to be changed.  I wonder if anyone used it, as there is no way to set the user certificate in the config 
dialogue (only the pass phrase).  Anyone?

I added some calls to g_debug() in several places, so if you want to see more details about the internal operation set 
the environment variable "G_MESSAGES_DEBUG=all".

It should also be easy to use libnetclient for POP3, btw.  I already implemented a simple class, but it's not 
yet tested.

What do you think of my approach?  As always, any comment or suggestion would be highly appreciated!

Cheers,
Albrecht.

--
Here are more details about the changes in the different source files:

* configure.ac: remove libesmtp and sendmail checks, add gnutls and the libnetclient "specials" (see above)
* Makefile.am: add libnetclient folder
* libinit_balsa/Makefile.am, src/Makefile.am: include libnetclient
* libbalsa/Makefile.am: include libnetclient, add new GMime filter
* libbalsa/gmime-filter-header.[hc]: implement filter as to strip RFC 5322 message headers
* libbalsa/identity.[hc], libbalsa/libbalsa.h, libbalsa/send.h, libinit_balsa/assistant_page_user.[hc], 
src/balsa-app.[hc], src/balsa-message.c, src/balsa-mime-widget-message.c, src/balsa-mime-widget-vcalendar.c, 
src/main-window.c, src/pref-manager.c, src/save-restore.c, src/sendmsg-window.c: strip libesmtp-related 
conditionals
* libbalsa/send.c: replace all libesmtp related stuff by libnetclient, strip all sendmail-related 
implementations; *HUGE* change...
* libbalsa/server.[hc]: add "Security" option (but keep ssl and tls)
* libbalsa/smtp-server.[hc]: strip libesmtp-related conditionals, use Security option in GUI
* po/POTFILES.in: add libnetclient files to translatables (*Note:* all the *.po files still must be updated!)

Attachment: pgpYdCVAiF3Dd.pgp
Description: PGP signature



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