From 7d2d25da3eb891a70ec5dfd3b077b0e130571472 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Mon, 3 Oct 2005 21:29:04 +0000 Subject: Added TLS/SSL support. --- SConstruct | 171 ++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 125 insertions(+), 46 deletions(-) (limited to 'SConstruct') diff --git a/SConstruct b/SConstruct index 0f24b6e8..130a3345 100644 --- a/SConstruct +++ b/SConstruct @@ -26,33 +26,26 @@ import string # Version # ############# -# How to increment version number when building a public release? -# =============================================================== -# -# Changing package version number: -# -# * Increment major number if major changes have been made to the library, -# that is, program depending on this library will need to be changed to -# work with the new major release. -# -# * Increment minor number when the changes are upward-compatible: some -# interfaces have been added, but compatibility is maintained for -# existing interfaces. -# -# * Increment micro number when the changes do not add any new interface. -# The changes only apply to the implementation (bug or security fix, -# performance improvement, etc.). -# - # Package version number packageVersionMajor = 0 packageVersionMinor = 7 packageVersionMicro = 2 -# Shared library version number (computed from package version number) -packageAPICurrent = packageVersionMajor + packageVersionMinor -packageAPIRevision = packageVersionMicro -packageAPIAge = packageVersionMinor +# API version number (libtool) +# +# Increment this number only immediately before a public release. +# This is independant from package version number. +# +# See: http://www.gnu.org/software/libtool/manual.html#Libtool-versioning +# +# . Implementation changed (eg. bug/security fix): REVISION++ +# . Interfaces added/removed/changed: CURRENT++, REVISION=0 +# . Interfaces added (upward-compatible changes): AGE++ +# . Interfaces removed: AGE=0 +# +packageAPICurrent = 0 +packageAPIRevision = 0 +packageAPIAge = 0 # Package information packageName = 'libvmime' @@ -204,7 +197,6 @@ libvmime_examples_sources = [ ] libvmime_messaging_sources = [ - 'net/authHelper.cpp', 'net/authHelper.hpp', 'net/builtinServices.inl', 'net/events.cpp', 'net/events.hpp', 'net/folder.cpp', 'net/folder.hpp', @@ -219,46 +211,64 @@ libvmime_messaging_sources = [ 'net/transport.cpp', 'net/transport.hpp' ] +libvmime_net_tls_sources = [ + 'net/tls/TLSSession.cpp', 'net/tls/TLSSession.hpp', + 'net/tls/TLSSocket.cpp', 'net/tls/TLSSocket.hpp', + 'net/tls/certificateChain.cpp', 'net/tls/certificateChain.hpp', + 'net/tls/certificateVerifier.hpp', + 'net/tls/defaultCertificateVerifier.cpp', 'net/tls/defaultCertificateVerifier.hpp', + 'net/tls/certificate.hpp', + 'net/tls/X509Certificate.cpp', 'net/tls/X509Certificate.hpp' +] + libvmime_messaging_proto_sources = [ [ 'pop3', [ - 'net/pop3/POP3Store.cpp', 'net/pop3/POP3Store.hpp', - 'net/pop3/POP3Folder.cpp', 'net/pop3/POP3Folder.hpp', - 'net/pop3/POP3Message.cpp', 'net/pop3/POP3Message.hpp' + 'net/pop3/POP3ServiceInfos.cpp', 'net/pop3/POP3ServiceInfos.hpp', + 'net/pop3/POP3Store.cpp', 'net/pop3/POP3Store.hpp', + 'net/pop3/POP3SStore.cpp', 'net/pop3/POP3SStore.hpp', + 'net/pop3/POP3Folder.cpp', 'net/pop3/POP3Folder.hpp', + 'net/pop3/POP3Message.cpp', 'net/pop3/POP3Message.hpp' ] ], [ 'smtp', [ - 'net/smtp/SMTPTransport.cpp', 'net/smtp/SMTPTransport.hpp' + 'net/smtp/SMTPServiceInfos.cpp', 'net/smtp/SMTPServiceInfos.hpp', + 'net/smtp/SMTPTransport.cpp', 'net/smtp/SMTPTransport.hpp', + 'net/smtp/SMTPSTransport.cpp', 'net/smtp/SMTPSTransport.hpp' ] ], [ 'imap', [ - 'net/imap/IMAPConnection.cpp', 'net/imap/IMAPConnection.hpp', - 'net/imap/IMAPStore.cpp', 'net/imap/IMAPStore.hpp', - 'net/imap/IMAPFolder.cpp', 'net/imap/IMAPFolder.hpp', - 'net/imap/IMAPMessage.cpp', 'net/imap/IMAPMessage.hpp', - 'net/imap/IMAPTag.cpp', 'net/imap/IMAPTag.hpp', - 'net/imap/IMAPUtils.cpp', 'net/imap/IMAPUtils.hpp', - 'net/imap/IMAPParser.hpp' + 'net/imap/IMAPServiceInfos.cpp', 'net/imap/IMAPServiceInfos.hpp', + 'net/imap/IMAPConnection.cpp', 'net/imap/IMAPConnection.hpp', + 'net/imap/IMAPStore.cpp', 'net/imap/IMAPStore.hpp', + 'net/imap/IMAPSStore.cpp', 'net/imap/IMAPSStore.hpp', + 'net/imap/IMAPFolder.cpp', 'net/imap/IMAPFolder.hpp', + 'net/imap/IMAPMessage.cpp', 'net/imap/IMAPMessage.hpp', + 'net/imap/IMAPTag.cpp', 'net/imap/IMAPTag.hpp', + 'net/imap/IMAPUtils.cpp', 'net/imap/IMAPUtils.hpp', + 'net/imap/IMAPParser.hpp', ] ], [ 'maildir', [ - 'net/maildir/maildirStore.cpp', 'net/maildir/maildirStore.hpp', - 'net/maildir/maildirFolder.cpp', 'net/maildir/maildirFolder.hpp', - 'net/maildir/maildirMessage.cpp', 'net/maildir/maildirMessage.hpp', - 'net/maildir/maildirUtils.cpp', 'net/maildir/maildirUtils.hpp' + 'net/maildir/maildirServiceInfos.cpp', 'net/maildir/maildirServiceInfos.hpp', + 'net/maildir/maildirStore.cpp', 'net/maildir/maildirStore.hpp', + 'net/maildir/maildirFolder.cpp', 'net/maildir/maildirFolder.hpp', + 'net/maildir/maildirMessage.cpp', 'net/maildir/maildirMessage.hpp', + 'net/maildir/maildirUtils.cpp', 'net/maildir/maildirUtils.hpp' ] ], [ 'sendmail', [ - 'net/sendmail/sendmailTransport.cpp', 'net/sendmail/sendmailTransport.hpp' + 'net/sendmail/sendmailServiceInfos.cpp', 'net/sendmail/sendmailServiceInfos.hpp', + 'net/sendmail/sendmailTransport.cpp', 'net/sendmail/sendmailTransport.hpp' ] ] ] @@ -348,6 +358,7 @@ libvmime_autotools = [ 'm4/lib-ld.m4', 'm4/lib-link.m4', 'm4/lib-prefix.m4', + 'm4/libgnutls.m4', 'autotools/install-sh', # 'autotools/mkinstalldirs', 'autotools/missing', @@ -367,7 +378,7 @@ libvmime_autotools = [ 'vmime/Makefile.in' ] -libvmime_all_sources = [] + libvmime_sources + libvmime_messaging_sources + libvmime_security_sasl_sources +libvmime_all_sources = [] + libvmime_sources + libvmime_messaging_sources + libvmime_security_sasl_sources + libvmime_net_tls_sources for i in range(len(libvmime_all_sources)): f = libvmime_all_sources[i] @@ -481,6 +492,14 @@ opts.AddOptions( map = { }, ignorecase = 1 ), + EnumOption( + 'with_tls', + 'Enable TLS support (requires GNU TLS library)', + 'yes', + allowed_values = ('yes', 'no'), + map = { }, + ignorecase = 1 + ), ( 'sendmail_path', 'Specifies the path to sendmail.', @@ -559,6 +578,8 @@ env.Append(CXXFLAGS = ['-pedantic']) env.Append(CXXFLAGS = ['-Wpointer-arith']) env.Append(CXXFLAGS = ['-Wold-style-cast']) env.Append(CXXFLAGS = ['-Wconversion']) +env.Append(CXXFLAGS = ['-Wcast-align']) +#env.Append(CXXFLAGS = ['-Wshadow']) env.Append(TARFLAGS = ['-c']) env.Append(TARFLAGS = ['--bzip2']) @@ -572,7 +593,11 @@ else: #env.Append(LIBS = ['additional-lib-here']) -env.ParseConfig('pkg-config --cflags --libs libgsasl') +if env['with_sasl'] == 'yes': + env.ParseConfig('pkg-config --cflags --libs libgsasl') + +if env['with_tls'] == 'yes': + env.ParseConfig('pkg-config --cflags --libs libgnutls') # Generate help text for command line options Help(opts.GenerateHelpText(env)) @@ -663,6 +688,7 @@ if env['with_messaging'] == 'yes': print "File-system support : " + env['with_filesystem'] print "Platform handlers : " + env['with_platforms'] print "SASL support : " + env['with_sasl'] +print "TLS/SSL support : " + env['with_tls'] if IsProtocolSupported(messaging_protocols, 'sendmail'): print "Sendmail path : " + env['sendmail_path'] @@ -754,6 +780,12 @@ if env['with_sasl'] == 'yes': else: config_hpp.write('#define VMIME_HAVE_SASL_SUPPORT 0\n') +config_hpp.write('// -- TLS/SSL support\n') +if env['with_tls'] == 'yes': + config_hpp.write('#define VMIME_HAVE_TLS_SUPPORT 1\n') +else: + config_hpp.write('#define VMIME_HAVE_TLS_SUPPORT 0\n') + config_hpp.write('// -- Messaging support\n') if env['with_messaging'] == 'yes': config_hpp.write('#define VMIME_HAVE_MESSAGING_FEATURES 1\n') @@ -832,6 +864,11 @@ if env['with_sasl'] == 'yes': for file in libvmime_security_sasl_sources: libvmime_sel_sources.append(file) +# -- TLS support +if env['with_tls'] == 'yes': + for file in libvmime_net_tls_sources: + libvmime_sel_sources.append(file) + # -- platform handlers for platform in platforms: files = libvmime_platforms_sources[platform] @@ -1010,9 +1047,9 @@ def generateAutotools(target, source, env): vmime_pc_in.write("Description: " + packageDescription + "\n") vmime_pc_in.write("Version: @VERSION@\n") vmime_pc_in.write("Requires: @GSASL_REQUIRED@\n") - vmime_pc_in.write("Libs: -L${libdir} -l@GENERIC_VERSIONED_LIBRARY_NAME@ @GSASL_LIBS@\n") + vmime_pc_in.write("Libs: -L${libdir} -l@GENERIC_VERSIONED_LIBRARY_NAME@ @GSASL_LIBS@ @LIBGNUTLS_LIBS@\n") #vmime_pc_in.write("Cflags: -I${includedir}/@GENERIC_VERSIONED_LIBRARY_NAME@\n") - vmime_pc_in.write("Cflags: -I${includedir}/\n") + vmime_pc_in.write("Cflags: -I${includedir}/ @LIBGNUTLS_CFLAGS@\n") vmime_pc_in.close() # Generate 'Makefile.am' @@ -1123,6 +1160,15 @@ INCLUDES = -I$(top_srcdir) -I$(srcdir) @PKGCONFIG_CFLAGS@ @EXTRA_CFLAGS@ Makefile_am.write(packageVersionedName + "_la_SOURCES += " + buildMakefileFileList(x, 1) + "\n") Makefile_am.write("endif\n") + # -- TLS support + x = selectFilesFromSuffixNot(libvmime_net_tls_sources, '.hpp') + sourceFiles += x + + Makefile_am.write("\n") + Makefile_am.write("if VMIME_HAVE_TLS_SUPPORT\n") + Makefile_am.write(packageVersionedName + "_la_SOURCES += " + buildMakefileFileList(x, 1) + "\n") + Makefile_am.write("endif\n") + # -- platform handlers for platform in libvmime_platforms_sources: Makefile_am.write("\n") @@ -1256,6 +1302,9 @@ AC_CHECK_HEADER(gsasl.h, have_gsasl=no), have_gsasl=no) +# -- GNU TLS Library (http://www.gnu.org/software/gnutls/) +AM_PATH_LIBGNUTLS(1.2.0, have_gnutls=yes, have_gnutls=no) + # -- global constructors (stolen from 'configure.in' in libsigc++) AC_MSG_CHECKING([if linker supports global constructors]) cat > mylib.$ac_ext <