Changes in / [52b3a99:b5a22e3]
- Files:
-
- 2 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/Makefile
r52b3a99 rb5a22e3 10 10 11 11 # [SH] Program variables 12 objects = http_client.o md5.o nogaim.o proxy.o sha.o $(SSL_CLIENT) util.o12 objects = md5.o nogaim.o proxy.o sha.o util.o $(SSL_CLIENT) 13 13 14 14 # [SH] The next two lines should contain the directory name (in $(subdirs)) -
protocols/proxy.c
r52b3a99 rb5a22e3 106 106 if (condition & GAIM_WRITE_COND) 107 107 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 ) ); 108 110 109 111 closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond); -
protocols/ssl_bogus.c
r52b3a99 rb5a22e3 28 28 int ssl_errno; 29 29 30 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )30 void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data ) 31 31 { 32 32 return( NULL ); -
protocols/ssl_client.h
r52b3a99 rb5a22e3 33 33 extern int ssl_errno; 34 34 35 typedef void (* ssl_input_function)(gpointer, void*, GaimInputCondition);35 typedef void (*SslInputFunction)(gpointer, void*, GaimInputCondition); 36 36 37 G_MODULE_EXPORT void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data );37 G_MODULE_EXPORT void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data ); 38 38 G_MODULE_EXPORT int ssl_read( void *conn, char *buf, int len ); 39 39 G_MODULE_EXPORT int ssl_write( void *conn, const char *buf, int len ); 40 40 G_MODULE_EXPORT void ssl_disconnect( void *conn_ ); 41 41 G_MODULE_EXPORT int ssl_getfd( void *conn ); 42 G_MODULE_EXPORT GaimInputCondition ssl_getdirection( void *conn ); -
protocols/ssl_gnutls.c
r52b3a99 rb5a22e3 38 38 struct scd 39 39 { 40 ssl_input_function func;40 SslInputFunction func; 41 41 gpointer data; 42 42 int fd; … … 51 51 52 52 53 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )53 void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data ) 54 54 { 55 55 struct scd *conn = g_new0( struct scd, 1 ); … … 117 117 if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED ) 118 118 { 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, 120 122 ssl_handshake, data ); 121 123 } … … 143 145 int ssl_read( void *conn, char *buf, int len ) 144 146 { 145 int st;146 147 147 if( !((struct scd*)conn)->established ) 148 148 { … … 151 151 } 152 152 153 st = gnutls_record_recv( ((struct scd*)conn)->session, buf, len);153 return( gnutls_record_recv( ((struct scd*)conn)->session, buf, len ) ); 154 154 155 ssl_errno = SSL_OK;156 if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )157 ssl_errno = SSL_AGAIN;158 159 return st;160 155 } 161 156 162 157 int ssl_write( void *conn, const char *buf, int len ) 163 158 { 164 int st;165 166 159 if( !((struct scd*)conn)->established ) 167 160 { … … 170 163 } 171 164 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 ) ); 179 166 } 180 167 … … 197 184 return( ((struct scd*)conn)->fd ); 198 185 } 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 45 45 struct scd 46 46 { 47 ssl_input_function func;47 SslInputFunction func; 48 48 gpointer data; 49 49 int fd; … … 91 91 92 92 93 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )93 void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data ) 94 94 { 95 95 struct scd *conn = g_new0( struct scd, 1 ); -
protocols/ssl_openssl.c
r52b3a99 rb5a22e3 41 41 struct scd 42 42 { 43 ssl_input_function func;43 SslInputFunction func; 44 44 gpointer data; 45 45 int fd; … … 54 54 55 55 56 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )56 void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data ) 57 57 { 58 58 struct scd *conn = g_new0( struct scd, 1 ); -
sock.h
r52b3a99 rb5a22e3 1 #include <errno.h>2 #include <fcntl.h>3 4 1 #ifndef _WIN32 5 2 #include <unistd.h> -
url.c
r52b3a99 rb5a22e3 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2001-200 5Wilmer van der Gaast and others *4 * Copyright 2001-2004 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 30 30 { 31 31 char s[MAX_STRING]; 32 char *i ;32 char *i, *j; 33 33 34 34 /* protocol:// */ … … 40 40 else 41 41 { 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 ) 45 43 url->proto = PROTO_HTTP; 46 44 else if( g_strncasecmp( set_url, "socks4", i - set_url ) == 0 ) … … 58 56 if( ( i = strchr( s, '/' ) ) == NULL ) 59 57 { 60 strcpy( url-> file, "/" );58 strcpy( url->dir, "/" ); 61 59 } 62 60 else 63 61 { 64 strncpy( url->file, i, MAX_STRING );65 62 *i = 0; 63 g_snprintf( url->dir, MAX_STRING, "/%s", i + 1 ); 64 if( url->proto == PROTO_HTTP ) 65 http_encode( url->dir ); 66 66 } 67 67 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 } 68 85 69 86 /* Check for username in host field */ … … 79 96 else 80 97 { 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 } 82 107 } 83 108 … … 92 117 { 93 118 *i = 0; 94 sscanf( i + 1, "% d", &url->port );119 sscanf( i + 1, "%i", &url->port ); 95 120 } 121 /* Take default port numbers from /etc/services */ 96 122 else 97 123 { 98 124 if( url->proto == PROTO_HTTP ) 99 url->port = 80; 100 else if( url->proto == PROTO_HTTPS ) 101 url->port = 443; 125 url->port = 8080; 102 126 else if( url->proto == PROTO_SOCKS4 || url->proto == PROTO_SOCKS4 ) 103 127 url->port = 1080; -
url.h
r52b3a99 rb5a22e3 26 26 #include "bitlbee.h" 27 27 28 #define PROTO_FTP 1 28 29 #define PROTO_HTTP 2 29 #define PROTO_HTTPS 530 30 #define PROTO_SOCKS4 3 31 31 #define PROTO_SOCKS5 4 … … 37 37 int port; 38 38 char host[MAX_STRING]; 39 char dir[MAX_STRING]; 39 40 char file[MAX_STRING]; 40 41 char user[MAX_STRING];
Note: See TracChangeset
for help on using the changeset viewer.