- Timestamp:
- 2005-12-16T17:58:00Z (19 years ago)
- Branches:
- master
- Children:
- 12c6634, 4bfca70
- Parents:
- c4168f4
- Location:
- protocols
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/oscar/conn.c
rc4168f4 r701acdd4 627 627 } 628 628 629 #ifndef _WIN32 630 fcntl(conn->fd, F_SETFL, 0); /* XXX should restore original flags */ 631 #endif 629 sock_make_blocking(conn->fd); 632 630 633 631 conn->status &= ~AIM_CONN_STATUS_INPROGRESS; -
protocols/proxy.c
rc4168f4 r701acdd4 133 133 return; 134 134 } 135 fcntl(source, F_SETFL, 0);136 135 #endif 136 sock_make_blocking(source); 137 137 gaim_input_remove(phb->inpa); 138 138 if( phb->proxy_func ) … … 229 229 return; 230 230 } 231 #ifdef F_SETFL 232 fcntl(source, F_SETFL, 0); 233 #endif 231 sock_make_blocking(source); 234 232 235 233 g_snprintf(cmd, sizeof(cmd), "CONNECT %s:%d HTTP/1.1\r\nHost: %s:%d\r\n", phb->host, phb->port, … … 322 320 return; 323 321 } 324 #ifdef F_SETFL 325 fcntl(source, F_SETFL, 0); 326 #endif 322 sock_make_blocking(source); 327 323 328 324 /* XXX does socks4 not support host name lookups by the proxy? */ … … 509 505 return; 510 506 } 511 #ifdef F_SETFL 512 fcntl(source, F_SETFL, 0); 513 #endif 507 sock_make_blocking(source); 514 508 515 509 i = 0; -
protocols/ssl_bogus.c
rc4168f4 r701acdd4 26 26 #include "ssl_client.h" 27 27 28 int ssl_errno; 29 28 30 void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data ) 29 31 { -
protocols/ssl_client.h
rc4168f4 r701acdd4 27 27 #include "proxy.h" 28 28 29 #define SSL_OK 0 30 #define SSL_NOHANDSHAKE 1 31 #define SSL_AGAIN 2 32 33 extern int ssl_errno; 34 29 35 typedef void (*SslInputFunction)(gpointer, void*, GaimInputCondition); 30 36 -
protocols/ssl_gnutls.c
rc4168f4 r701acdd4 25 25 26 26 #include <gnutls/gnutls.h> 27 #include <fcntl.h> 28 #include <unistd.h> 27 29 #include "proxy.h" 28 30 #include "ssl_client.h" 29 31 #include "sock.h" 30 32 #include "stdlib.h" 33 34 int ssl_errno = 0; 31 35 32 36 static gboolean initialized = FALSE; … … 38 42 int fd; 39 43 gboolean established; 44 int inpa; 40 45 41 46 gnutls_session session; … … 44 49 45 50 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ); 46 47 51 48 52 … … 54 58 conn->func = func; 55 59 conn->data = data; 60 conn->inpa = -1; 56 61 57 62 if( conn->fd < 0 ) … … 76 81 } 77 82 83 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond ); 84 78 85 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ) 79 86 { … … 81 88 82 89 if( source == -1 ) 83 goto ssl_connected_failure; 90 { 91 conn->func( conn->data, NULL, cond ); 92 93 gnutls_deinit( conn->session ); 94 gnutls_certificate_free_credentials( conn->xcred ); 95 96 g_free( conn ); 97 98 return; 99 } 84 100 101 sock_make_nonblocking( conn->fd ); 85 102 gnutls_transport_set_ptr( conn->session, (gnutls_transport_ptr) conn->fd ); 86 103 87 if( gnutls_handshake( conn->session ) < 0 ) 88 goto ssl_connected_failure; 104 ssl_handshake( data, source, cond ); 105 } 106 107 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond ) 108 { 109 struct scd *conn = data; 110 int st; 89 111 90 conn->established = TRUE; 91 conn->func( conn->data, conn, cond ); 92 return; 112 if( conn->inpa != -1 ) 113 gaim_input_remove( conn->inpa ); 93 114 94 ssl_connected_failure: 95 conn->func( conn->data, NULL, cond ); 96 97 gnutls_deinit( conn->session ); 98 gnutls_certificate_free_credentials( conn->xcred ); 99 if( source >= 0 ) closesocket( source ); 100 g_free( conn ); 115 if( ( st = gnutls_handshake( conn->session ) ) < 0 ) 116 { 117 if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED ) 118 { 119 conn->inpa = gaim_input_add( conn->fd, 120 gnutls_record_get_direction( conn->session ) ? 121 GAIM_INPUT_WRITE : GAIM_INPUT_READ, 122 ssl_handshake, data ); 123 } 124 else 125 { 126 conn->func( conn->data, NULL, cond ); 127 128 gnutls_deinit( conn->session ); 129 gnutls_certificate_free_credentials( conn->xcred ); 130 closesocket( conn->fd ); 131 132 g_free( conn ); 133 } 134 } 135 else 136 { 137 /* For now we can't handle non-blocking perfectly everywhere... */ 138 sock_make_blocking( conn->fd ); 139 140 conn->established = TRUE; 141 conn->func( conn->data, conn, cond ); 142 } 101 143 } 102 144 … … 104 146 { 105 147 if( !((struct scd*)conn)->established ) 106 return( 0 ); 148 { 149 ssl_errno = SSL_NOHANDSHAKE; 150 return( -1 ); 151 } 107 152 108 153 return( gnutls_record_recv( ((struct scd*)conn)->session, buf, len ) ); 154 109 155 } 110 156 … … 112 158 { 113 159 if( !((struct scd*)conn)->established ) 114 return( 0 ); 160 { 161 ssl_errno = SSL_NOHANDSHAKE; 162 return( -1 ); 163 } 115 164 116 165 return( gnutls_record_send( ((struct scd*)conn)->session, buf, len ) ); -
protocols/ssl_nss.c
rc4168f4 r701acdd4 38 38 #include <secerr.h> 39 39 #include <sslerr.h> 40 41 int ssl_errno = 0; 40 42 41 43 static gboolean initialized = FALSE; -
protocols/ssl_openssl.c
rc4168f4 r701acdd4 34 34 #include "ssl_client.h" 35 35 #include "sock.h" 36 37 int ssl_errno = 0; 36 38 37 39 static gboolean initialized = FALSE;
Note: See TracChangeset
for help on using the changeset viewer.