Changeset 6197702 for lib


Ignore:
Timestamp:
2010-10-09T18:41:19Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
d150a9d
Parents:
23b29c6 (diff), 27b407f (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 OTR branch. It's more or less a plugin if you enable it, and
otherwise a no-op. DO NOT INSTALL THIS ON PUBLIC SERVERS.

Location:
lib
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • lib/events.h

    r23b29c6 r6197702  
    8181G_MODULE_EXPORT void b_event_remove(gint id);
    8282
    83 /* For now, closesocket() is only a function when using libevent. With GLib
    84    it's a preprocessor macro. */
    85 #ifdef EVENTS_LIBEVENT
     83/* With libevent, this one also cleans up event handlers if that wasn't already
     84   done (the caller is expected to do so but may miss it sometimes). */
    8685G_MODULE_EXPORT void closesocket(int fd);
    87 #endif
    8886
    8987#endif /* _EVENTS_H_ */
  • lib/events_glib.c

    r23b29c6 r6197702  
    147147                g_source_remove(tag);
    148148}
     149
     150void closesocket( int fd )
     151{
     152        close( fd );
     153}
  • lib/misc.c

    r23b29c6 r6197702  
    157157        char *s = out, *cs;
    158158        int i, matched;
     159        int taglen;
    159160       
    160161        memset( out, 0, sizeof( out ) );
     
    173174                                in ++;
    174175                       
     176                        taglen = in - cs - 1;   /* not <0 because the above loop runs at least once */
    175177                        if( *in )
    176178                        {
    177                                 if( g_strncasecmp( cs+1, "br", 2) == 0 )
     179                                if( g_strncasecmp( cs+1, "b", taglen) == 0 )
     180                                        *(s++) = '\x02';
     181                                else if( g_strncasecmp( cs+1, "/b", taglen) == 0 )
     182                                        *(s++) = '\x02';
     183                                else if( g_strncasecmp( cs+1, "i", taglen) == 0 )
     184                                        *(s++) = '\x1f';
     185                                else if( g_strncasecmp( cs+1, "/i", taglen) == 0 )
     186                                        *(s++) = '\x1f';
     187                                else if( g_strncasecmp( cs+1, "br", taglen) == 0 )
    178188                                        *(s++) = '\n';
    179189                                in ++;
  • lib/ssl_bogus.c

    r23b29c6 r6197702  
    2727
    2828int ssl_errno;
     29
     30void ssl_init( void )
     31{
     32}
    2933
    3034void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
     
    6670        return 0;
    6771}
     72
     73int ssl_pending( void *conn )
     74{
     75        return 0;
     76}
  • lib/ssl_client.h

    r23b29c6 r6197702  
    4747
    4848
     49/* Perform any global initialization the SSL library might need. */
     50G_MODULE_EXPORT void ssl_init( void );
     51
    4952/* Connect to host:port, call the given function when the connection is
    5053   ready to be used for SSL traffic. This is all done asynchronously, no
  • lib/ssl_gnutls.c

    r23b29c6 r6197702  
    6060static gboolean ssl_handshake( gpointer data, gint source, b_input_condition cond );
    6161
     62
     63void ssl_init( void )
     64{
     65        gnutls_global_init();
     66        initialized = TRUE;
     67        atexit( gnutls_global_deinit );
     68}
    6269
    6370void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
     
    122129        if( !initialized )
    123130        {
    124                 gnutls_global_init();
    125                 initialized = TRUE;
    126                 atexit( gnutls_global_deinit );
     131                ssl_init();
    127132        }
    128133       
  • lib/ssl_nss.c

    r23b29c6 r6197702  
    9191
    9292
     93void ssl_init( void )
     94{
     95        PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
     96        NSS_NoDB_Init(NULL);
     97        NSS_SetDomesticPolicy();
     98        initialized = TRUE;
     99}
     100
    93101void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
    94102{
     
    107115        if( !initialized )
    108116        {
    109                 PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
    110                 NSS_NoDB_Init(NULL);
    111                 NSS_SetDomesticPolicy();
     117                ssl_init();
    112118        }
    113119
  • lib/ssl_openssl.c

    r23b29c6 r6197702  
    5656static gboolean ssl_handshake( gpointer data, gint source, b_input_condition cond );
    5757
     58
     59void ssl_init( void )
     60{
     61        initialized = TRUE;
     62        SSL_library_init();
     63        // SSLeay_add_ssl_algorithms();
     64}
    5865
    5966void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
     
    115122        if( !initialized )
    116123        {
    117                 initialized = TRUE;
    118                 SSL_library_init();
    119                 //SSLeay_add_ssl_algorithms();
    120                 //OpenSSL_add_all_algorithms();
     124                ssl_init();
    121125        }
    122126       
Note: See TracChangeset for help on using the changeset viewer.