Changeset 164352e for lib/ssl_nss.c


Ignore:
Timestamp:
2011-12-24T18:02:39Z (12 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
34ded90
Parents:
e306fbf (diff), 96f954d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merging mainline.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/ssl_nss.c

    re306fbf r164352e  
    5252        PRFileDesc *prfd;
    5353        gboolean established;
     54        gboolean verify;
    5455};
    5556
     
    102103}
    103104
    104 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
     105void *ssl_connect( char *host, int port, gboolean verify, ssl_input_function func, gpointer data )
    105106{
    106107        struct scd *conn = g_new0( struct scd, 1 );
     
    132133}
    133134
    134 void *ssl_starttls( int fd, ssl_input_function func, gpointer data )
     135void *ssl_starttls( int fd, char *hostname, gboolean verify, ssl_input_function func, gpointer data )
    135136{
    136137        struct scd *conn = g_new0( struct scd, 1 );
     
    139140        conn->func = func;
    140141        conn->data = data;
     142        conn->verify = verify && global.conf->cafile;
    141143
    142144        /* This function should be called via a (short) timeout instead of
     
    157159{
    158160        struct scd *conn = data;
     161       
     162        /* Right now we don't have any verification functionality for NSS. */
     163
     164        if( conn->verify )
     165        {
     166                conn->func( conn->data, 1, NULL, cond );
     167                if( source >= 0 ) closesocket( source );
     168                g_free( conn );
     169
     170                return FALSE;
     171        }
    159172       
    160173        if( source == -1 )
     
    177190       
    178191        conn->established = TRUE;
    179         conn->func( conn->data, conn, cond );
     192        conn->func( conn->data, 0, conn, cond );
    180193        return FALSE;
    181194       
    182195        ssl_connected_failure:
    183196       
    184         conn->func( conn->data, NULL, cond );
     197        conn->func( conn->data, 0, NULL, cond );
    185198       
    186199        PR_Close( conn -> prfd );
     
    238251        return B_EV_IO_READ;
    239252}
     253
     254char *ssl_verify_strerror( int code )
     255{
     256        return g_strdup( "SSL certificate verification not supported by BitlBee NSS code." );
     257}
Note: See TracChangeset for help on using the changeset viewer.