Changes in / [52b3a99:b5a22e3]


Ignore:
Files:
2 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • protocols/Makefile

    r52b3a99 rb5a22e3  
    1010
    1111# [SH] Program variables
    12 objects = http_client.o md5.o nogaim.o proxy.o sha.o $(SSL_CLIENT) util.o
     12objects = md5.o nogaim.o proxy.o sha.o util.o $(SSL_CLIENT)
    1313
    1414# [SH] The next two lines should contain the directory name (in $(subdirs))
  • protocols/proxy.c

    r52b3a99 rb5a22e3  
    106106        if (condition & GAIM_WRITE_COND)
    107107                gaim_cond |= GAIM_INPUT_WRITE;
     108//      if (condition & GAIM_ERR_COND)
     109//              fprintf( stderr, "ERROR! fd=%d\n", g_io_channel_unix_get_fd( source ) );
    108110
    109111        closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond);
  • protocols/ssl_bogus.c

    r52b3a99 rb5a22e3  
    2828int ssl_errno;
    2929
    30 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
     30void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data )
    3131{
    3232        return( NULL );
  • protocols/ssl_client.h

    r52b3a99 rb5a22e3  
    3333extern int ssl_errno;
    3434
    35 typedef void (*ssl_input_function)(gpointer, void*, GaimInputCondition);
     35typedef void (*SslInputFunction)(gpointer, void*, GaimInputCondition);
    3636
    37 G_MODULE_EXPORT void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data );
     37G_MODULE_EXPORT void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data );
    3838G_MODULE_EXPORT int ssl_read( void *conn, char *buf, int len );
    3939G_MODULE_EXPORT int ssl_write( void *conn, const char *buf, int len );
    4040G_MODULE_EXPORT void ssl_disconnect( void *conn_ );
    4141G_MODULE_EXPORT int ssl_getfd( void *conn );
    42 G_MODULE_EXPORT GaimInputCondition ssl_getdirection( void *conn );
  • protocols/ssl_gnutls.c

    r52b3a99 rb5a22e3  
    3838struct scd
    3939{
    40         ssl_input_function func;
     40        SslInputFunction func;
    4141        gpointer data;
    4242        int fd;
     
    5151
    5252
    53 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
     53void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data )
    5454{
    5555        struct scd *conn = g_new0( struct scd, 1 );
     
    117117                if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )
    118118                {
    119                         conn->inpa = gaim_input_add( conn->fd, ssl_getdirection( conn ),
     119                        conn->inpa = gaim_input_add( conn->fd,
     120                                                     gnutls_record_get_direction( conn->session ) ?
     121                                                         GAIM_INPUT_WRITE : GAIM_INPUT_READ,
    120122                                                     ssl_handshake, data );
    121123                }
     
    143145int ssl_read( void *conn, char *buf, int len )
    144146{
    145         int st;
    146        
    147147        if( !((struct scd*)conn)->established )
    148148        {
     
    151151        }
    152152       
    153         st = gnutls_record_recv( ((struct scd*)conn)->session, buf, len );
     153        return( gnutls_record_recv( ((struct scd*)conn)->session, buf, len ) );
    154154       
    155         ssl_errno = SSL_OK;
    156         if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )
    157                 ssl_errno = SSL_AGAIN;
    158        
    159         return st;
    160155}
    161156
    162157int ssl_write( void *conn, const char *buf, int len )
    163158{
    164         int st;
    165        
    166159        if( !((struct scd*)conn)->established )
    167160        {
     
    170163        }
    171164       
    172         st = gnutls_record_send( ((struct scd*)conn)->session, buf, len );
    173        
    174         ssl_errno = SSL_OK;
    175         if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )
    176                 ssl_errno = SSL_AGAIN;
    177        
    178         return st;
     165        return( gnutls_record_send( ((struct scd*)conn)->session, buf, len ) );
    179166}
    180167
     
    197184        return( ((struct scd*)conn)->fd );
    198185}
    199 
    200 GaimInputCondition ssl_getdirection( void *conn )
    201 {
    202         return( gnutls_record_get_direction( ((struct scd*)conn)->session ) ?
    203                 GAIM_INPUT_WRITE : GAIM_INPUT_READ );
    204 }
  • protocols/ssl_nss.c

    r52b3a99 rb5a22e3  
    4545struct scd
    4646{
    47         ssl_input_function func;
     47        SslInputFunction func;
    4848        gpointer data;
    4949        int fd;
     
    9191
    9292
    93 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
     93void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data )
    9494{
    9595        struct scd *conn = g_new0( struct scd, 1 );
  • protocols/ssl_openssl.c

    r52b3a99 rb5a22e3  
    4141struct scd
    4242{
    43         ssl_input_function func;
     43        SslInputFunction func;
    4444        gpointer data;
    4545        int fd;
     
    5454
    5555
    56 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
     56void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data )
    5757{
    5858        struct scd *conn = g_new0( struct scd, 1 );
  • sock.h

    r52b3a99 rb5a22e3  
    1 #include <errno.h>
    2 #include <fcntl.h>
    3 
    41#ifndef _WIN32
    52#include <unistd.h>
  • url.c

    r52b3a99 rb5a22e3  
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
    4   * Copyright 2001-2005 Wilmer van der Gaast and others                *
     4  * Copyright 2001-2004 Wilmer van der Gaast and others                *
    55  \********************************************************************/
    66
     
    3030{
    3131        char s[MAX_STRING];
    32         char *i;
     32        char *i, *j;
    3333       
    3434        /* protocol://                                                  */
     
    4040        else
    4141        {
    42                 if( g_strncasecmp( set_url, "https", i - set_url ) == 0 )
    43                         url->proto = PROTO_HTTPS;
    44                 else if( g_strncasecmp( set_url, "http", i - set_url ) == 0 )
     42                if( g_strncasecmp( set_url, "http", i - set_url ) == 0 )
    4543                        url->proto = PROTO_HTTP;
    4644                else if( g_strncasecmp( set_url, "socks4", i - set_url ) == 0 )
     
    5856        if( ( i = strchr( s, '/' ) ) == NULL )
    5957        {
    60                 strcpy( url->file, "/" );
     58                strcpy( url->dir, "/" );
    6159        }
    6260        else
    6361        {
    64                 strncpy( url->file, i, MAX_STRING );
    6562                *i = 0;
     63                g_snprintf( url->dir, MAX_STRING, "/%s", i + 1 );
     64                if( url->proto == PROTO_HTTP )
     65                        http_encode( url->dir );
    6666        }
    6767        strncpy( url->host, s, MAX_STRING );
     68        j = strchr( url->dir, '?' );
     69        if( j != NULL )
     70                *j = 0;
     71        i = strrchr( url->dir, '/' );
     72        *i = 0;
     73        if( j != NULL )
     74                *j = '?';
     75        if( i == NULL )
     76        {
     77                strcpy( url->file, url->dir );
     78                strcpy( url->dir, "/" );
     79        }
     80        else
     81        {
     82                strcpy( url->file, i + 1 );
     83                strcat( url->dir, "/" );
     84        }
    6885       
    6986        /* Check for username in host field                             */
     
    7996        else
    8097        {
    81                 *url->user = *url->pass = 0;
     98                if( url->proto == PROTO_FTP )
     99                {
     100                        strcpy( url->user, "anonymous" );
     101                        strcpy( url->pass, "-p.artmaps@lintux.cx" );
     102                }
     103                else
     104                {
     105                        *url->user = *url->pass = 0;
     106                }
    82107        }
    83108       
     
    92117        {
    93118                *i = 0;
    94                 sscanf( i + 1, "%d", &url->port );
     119                sscanf( i + 1, "%i", &url->port );
    95120        }
     121        /* Take default port numbers from /etc/services                 */
    96122        else
    97123        {
    98124                if( url->proto == PROTO_HTTP )
    99                         url->port = 80;
    100                 else if( url->proto == PROTO_HTTPS )
    101                         url->port = 443;
     125                        url->port = 8080;
    102126                else if( url->proto == PROTO_SOCKS4 || url->proto == PROTO_SOCKS4 )
    103127                        url->port = 1080;
  • url.h

    r52b3a99 rb5a22e3  
    2626#include "bitlbee.h"
    2727
     28#define PROTO_FTP               1
    2829#define PROTO_HTTP              2
    29 #define PROTO_HTTPS             5
    3030#define PROTO_SOCKS4    3
    3131#define PROTO_SOCKS5    4
     
    3737        int port;
    3838        char host[MAX_STRING];
     39        char dir[MAX_STRING];
    3940        char file[MAX_STRING];
    4041        char user[MAX_STRING];
Note: See TracChangeset for help on using the changeset viewer.