Changeset 164352e for lib/ssl_openssl.c
- Timestamp:
- 2011-12-24T18:02:39Z (13 years ago)
- Branches:
- master
- Children:
- 34ded90
- Parents:
- e306fbf (diff), 96f954d (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/ssl_openssl.c
re306fbf r164352e 45 45 int fd; 46 46 gboolean established; 47 gboolean verify; 47 48 48 49 int inpa; … … 64 65 } 65 66 66 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )67 void *ssl_connect( char *host, int port, gboolean verify, ssl_input_function func, gpointer data ) 67 68 { 68 69 struct scd *conn = g_new0( struct scd, 1 ); … … 82 83 } 83 84 84 void *ssl_starttls( int fd, ssl_input_function func, gpointer data )85 void *ssl_starttls( int fd, char *hostname, gboolean verify, ssl_input_function func, gpointer data ) 85 86 { 86 87 struct scd *conn = g_new0( struct scd, 1 ); … … 90 91 conn->data = data; 91 92 conn->inpa = -1; 93 conn->verify = verify && global.conf->cafile; 92 94 93 95 /* This function should be called via a (short) timeout instead of … … 117 119 SSL_METHOD *meth; 118 120 121 /* Right now we don't have any verification functionality for OpenSSL. */ 122 123 if( conn->verify ) 124 { 125 conn->func( conn->data, 1, NULL, cond ); 126 if( source >= 0 ) closesocket( source ); 127 g_free( conn ); 128 129 return FALSE; 130 } 131 119 132 if( source == -1 ) 120 133 goto ssl_connected_failure; … … 141 154 142 155 ssl_connected_failure: 143 conn->func( conn->data, NULL, cond );156 conn->func( conn->data, 0, NULL, cond ); 144 157 145 158 if( conn->ssl ) … … 169 182 if( conn->lasterr != SSL_ERROR_WANT_READ && conn->lasterr != SSL_ERROR_WANT_WRITE ) 170 183 { 171 conn->func( conn->data, NULL, cond );184 conn->func( conn->data, 0, NULL, cond ); 172 185 173 186 SSL_shutdown( conn->ssl ); … … 187 200 conn->established = TRUE; 188 201 sock_make_blocking( conn->fd ); /* For now... */ 189 conn->func( conn->data, conn, cond );202 conn->func( conn->data, 0, conn, cond ); 190 203 return FALSE; 191 204 } … … 272 285 { 273 286 return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? B_EV_IO_WRITE : B_EV_IO_READ ); 287 } 288 289 char *ssl_verify_strerror( int code ) 290 { 291 return g_strdup( "SSL certificate verification not supported by BitlBee OpenSSL code." ); 274 292 } 275 293
Note: See TracChangeset
for help on using the changeset viewer.