Changeset 3559

Show
Ignore:
Timestamp:
04/09/08 17:53:42
Author:
jdapena
Message:

* Added libtinymail-camel/camel-lite/camel/camel-certdb-cst.c.

Implementation of certificates database using maemo libcst. This
makes you can manage certificates using the maemo tablet certificate
manager.
* libtinymail-camel/camel-lite/camel/camel-certdb.h,
libtinymail-camel/camel-lite/camel/camel-private.h: modified to
have a pointer to the CST object in certdb and certificate id in
certificate object in case we compile with CST support.
* libtinymail-camel/camel-lite/camel/camel-tcp-stream-ssl.c:
Modified a bit the code for proper integration with cst (mainly
removing direct access to internal fields).
* libtinymail-camel/camel-lite/configure.ac,
libtinymail-camel/camel-lite/camel/Makefile.am:
Added support for detection and configuration of libcst.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r3555 r3559  
     12008-04-09  Jose Dapena Paz  <jdapena@igalia.com> 
     2 
     3        * Added libtinymail-camel/camel-lite/camel/camel-certdb-cst.c. 
     4        Implementation of certificates database using maemo libcst. This 
     5        makes you can manage certificates using the maemo tablet certificate 
     6        manager. 
     7         
     8        * libtinymail-camel/camel-lite/camel/camel-certdb.h, 
     9        libtinymail-camel/camel-lite/camel/camel-private.h: modified to 
     10        have a pointer to the CST object in certdb and certificate id in 
     11        certificate object in case we compile with CST support. 
     12         
     13        * libtinymail-camel/camel-lite/camel/camel-tcp-stream-ssl.c: 
     14        Modified a bit the code for proper integration with cst (mainly 
     15        removing direct access to internal fields). 
     16         
     17        * libtinymail-camel/camel-lite/configure.ac, 
     18        libtinymail-camel/camel-lite/camel/Makefile.am: 
     19        Added support for detection and configuration of libcst. 
     20 
    1212008-04-07 Dirk-Jan C. Binnema <dirk-jan.binnema@nokia.com> 
    222        * libtinymail-camel: 
  • trunk/libtinymail-camel/camel-lite/camel/Makefile.am

    r3538 r3559  
    147147        camel-arg.c                             \ 
    148148        camel-block-file.c                      \ 
    149         camel-certdb.c                          \ 
    150149        camel-charset-map.c                     \ 
    151150        camel-data-cache.c                      \ 
     
    208207        camel.c                                 \ 
    209208        $(LIBCAMEL_PLATFORM_DEP_SOURCES) 
     209 
     210if HAVE_CST 
     211libcamel_lite_1_2_la_SOURCES += camel-certdb-cst.c 
     212else 
     213libcamel_lite_1_2_la_SOURCES += camel-certdb.c 
     214endif 
     215 
    210216 
    211217libcamel_liteinclude_HEADERS =                  \ 
  • trunk/libtinymail-camel/camel-lite/camel/camel-certdb.c

    r2950 r3559  
    479479        CamelCert *cert; 
    480480 
     481        /* we set 0 to trust level this way (unknown) */ 
     482 
    481483        if (certdb->cert_chunks) 
    482484                cert = e_memchunk_alloc0 (certdb->cert_chunks); 
  • trunk/libtinymail-camel/camel-lite/camel/camel-certdb.h

    r2950 r3559  
    2727#include <stdio.h> 
    2828#include <camel/camel-object.h> 
     29#ifdef ENABLE_CST 
     30#include <cst.h> 
     31#endif 
    2932 
    3033#define CAMEL_CERTDB_TYPE         (camel_certdb_get_type ()) 
     
    6669 
    6770        CamelCertTrust trust; 
     71#ifdef ENABLE_CST 
     72        cst_t_seqnum certID; 
     73#endif 
    6874        GByteArray *rawcert; 
    6975} CamelCert; 
  • trunk/libtinymail-camel/camel-lite/camel/camel-private.h

    r3301 r3559  
    3333#include <pthread.h> 
    3434#include <libedataserver/e-msgport.h> 
     35#ifdef ENABLE_CST 
     36#include <cst.h> 
     37#endif 
    3538 
    3639G_BEGIN_DECLS 
     
    183186        GMutex *alloc_lock;     /* for setting up and using allocators */ 
    184187        GMutex *ref_lock;       /* for reffing/unreffing certs */ 
     188#ifdef ENABLE_CST 
     189        CST    *cst;            /* Certificate storage */ 
     190#endif 
    185191}; 
    186192 
  • trunk/libtinymail-camel/camel-lite/camel/camel-tcp-stream-ssl.c

    r3535 r3559  
    903903                        g_error_free (error); 
    904904 
    905                         camel_cert_set_trust ( 
    906                                 certdb, ccert, CAMEL_CERT_TRUST_UNKNOWN); 
    907905                        camel_certdb_touch (certdb); 
    908906                        g_free (fingerprint); 
     
    924922            || memcmp(ccert->rawcert->data, cert->derCert.data, cert->derCert.len) != 0) { 
    925923                g_warning("rawcert != derCer"); 
    926                 camel_cert_set_trust(certdb, ccert, CAMEL_CERT_TRUST_UNKNOWN); 
    927924                camel_certdb_touch(certdb); 
    928925        } 
     
    946943        /*camel_cert_set_hostname(certdb, ccert, ssl->priv->expected_host);*/ 
    947944        camel_cert_set_fingerprint(certdb, ccert, fingerprint); 
    948         camel_cert_set_trust(certdb, ccert, CAMEL_CERT_TRUST_UNKNOWN); 
    949945        g_free(fingerprint); 
    950946 
     
    10371033        SECStatus status = SECFailure; 
    10381034        struct _CamelTcpStreamSSLPrivate *priv; 
     1035        CamelCertTrust trust; 
    10391036 
    10401037        g_return_val_if_fail (data != NULL, SECFailure); 
     
    10551052        } 
    10561053 
    1057         if (ccert->trust == CAMEL_CERT_TRUST_UNKNOWN) { 
     1054        trust = camel_cert_get_trust (certdb, ccert); 
     1055        if (trust == CAMEL_CERT_TRUST_UNKNOWN) { 
    10581056                status = CERT_VerifyCertNow(cert->dbhandle, cert, TRUE, certUsageSSLClient, NULL); 
    10591057                fingerprint = cert_fingerprint(cert); 
     
    10621060                                              "Fingerprint:       %s\n" 
    10631061                                              "Signature:         %s"), 
    1064                                             CERT_NameToAscii (&cert->issuer), 
    1065                                             CERT_NameToAscii (&cert->subject), 
     1062                                            ccert?camel_cert_get_issuer (certdb, ccert):CERT_NameToAscii (&cert->issuer), 
     1063                                            ccert?camel_cert_get_subject (certdb, ccert):CERT_NameToAscii (&cert->subject), 
    10661064                                            fingerprint, status == SECSuccess?_("GOOD"):_("BAD")); 
    10671065                g_free(fingerprint); 
     
    10811079                } 
    10821080        } else { 
    1083                 accept = ccert->trust != CAMEL_CERT_TRUST_NEVER; 
     1081                accept = trust != CAMEL_CERT_TRUST_NEVER; 
    10841082        } 
    10851083 
  • trunk/libtinymail-camel/camel-lite/config.h.in

    r3276 r3559  
    66/* Base version (Major.Minor) */ 
    77#undef BASE_VERSION 
     8 
     9/* Is libcst enabled */ 
     10#undef ENABLE_CST 
    811 
    912/* Really don't try this at home */ 
  • trunk/libtinymail-camel/camel-lite/configure.ac

    r3461 r3559  
    8484                msg_ssl="yes (Mozilla NSS)" 
    8585                msg_smime="yes (Mozilla NSS)" 
     86                has_nss=yes 
    8687                AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled]) 
    8788                AC_DEFINE(HAVE_NSS,1,[Define if you have NSS]) 
     
    9798                SSL_LIBS="-lcrypto -lssl" 
    9899                msg_ssl="yes (OpenSSL)" 
     100                has_nss=no 
    99101                AC_DEFINE(HAVE_SSL,1,[Define if you have a supported SSL library]) 
    100102                AC_DEFINE(HAVE_OPENSSL,1,[Define if you want to use OpenSSL as SSL library]) 
     
    112114                msg_ssl="yes (Mozilla NSS)" 
    113115                msg_smime="yes (Mozilla NSS)" 
     116                has_nss=yes 
    114117                AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled]) 
    115118                AC_DEFINE(HAVE_NSS,1,[Define if you have NSS]) 
     
    119122   ]) 
    120123 
     124if test x$has_nss = xyes; then 
     125     AC_MSG_CHECKING(Support for libCST) 
     126     PKG_CHECK_MODULES(LIBCST, cst, have_cst=yes, have_cst=no) 
     127     AC_MSG_RESULT($have_cst) 
     128else 
     129     LIBCST_CFLAGS= 
     130     LIBCST_LIBS= 
     131     have_cst=no 
     132fi 
     133AM_CONDITIONAL([HAVE_CST],[test x"$have_cst" == "xyes"]) 
     134AC_DEFINE_UNQUOTED(ENABLE_CST, "$have_cst", [Is libcst enabled]) 
     135AC_SUBST(LIBCST_CFLAGS) 
     136AC_SUBST(LIBCST_LIBS) 
    121137 
    122138AC_SUBST(msg_smime) 
     
    209225 
    210226PKG_CHECK_MODULES(CAMEL, gthread-2.0 gmodule-2.0 gobject-2.0 $mozilla_nss_eds $mozilla_nspr_eds) 
    211 CAMEL_CFLAGS="$CAMEL_CFLAGS $THREADS_CFLAGS $KRB4_CFLAGS $KRB5_CFLAGS" 
    212 CAMEL_LIBS="$CAMEL_LIBS -lz $THREADS_LIBS $KRB4_LDFLAGS $KRB5_LDFLAGS" 
     227CAMEL_CFLAGS="$CAMEL_CFLAGS $LIBCST_CFLAGS $THREADS_CFLAGS $KRB4_CFLAGS $KRB5_CFLAGS" 
     228CAMEL_LIBS="$CAMEL_LIBS -lz $LIBCST_LIBS $THREADS_LIBS $KRB4_LDFLAGS $KRB5_LDFLAGS" 
    213229 
    214230AC_SUBST(CAMEL_CFLAGS)