Changeset ef043d3 for lib


Ignore:
Timestamp:
2010-11-20T15:13:40Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
1074806
Parents:
6d544a1
Message:

Fix up NSS SSL module.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/ssl_nss.c

    r6d544a1 ref043d3  
    3434#include <sslproto.h>
    3535#include <nss.h>
     36#include <pk11pub.h>
    3637#include <private/pprio.h>
    3738#include <ssl.h>
     39#include <seccomon.h>
    3840#include <secerr.h>
    3941#include <sslerr.h>
     
    5355
    5456static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond );
     57static gboolean ssl_starttls_real( gpointer data, gint source, b_input_condition cond );
    5558
    5659
     
    122125}
    123126
     127static gboolean ssl_starttls_real( gpointer data, gint source, b_input_condition cond )
     128{
     129        struct scd *conn = data;
     130
     131        return ssl_connected( conn, conn->fd, B_EV_IO_WRITE );
     132}
     133
     134void *ssl_starttls( int fd, ssl_input_function func, gpointer data )
     135{
     136        struct scd *conn = g_new0( struct scd, 1 );
     137
     138        conn->fd = fd;
     139        conn->func = func;
     140        conn->data = data;
     141
     142        /* This function should be called via a (short) timeout instead of
     143           directly from here, because these SSL calls are *supposed* to be
     144           *completely* asynchronous and not ready yet when this function
     145           (or *_connect, for examle) returns. Also, errors are reported via
     146           the callback function, not via this function's return value.
     147
     148           In short, doing things like this makes the rest of the code a lot
     149           simpler. */
     150
     151        b_timeout_add( 1, ssl_starttls_real, conn );
     152
     153        return conn;
     154}
     155
    124156static gboolean ssl_connected( gpointer data, gint source, b_input_condition cond )
    125157{
Note: See TracChangeset for help on using the changeset viewer.