- {
- BIO *conn;
- SSL *serverCon;
- int width, i;
- fd_set readfds;
-
- if ((conn=BIO_new(BIO_s_connect())) == NULL)
- return(NULL);
-
-/* BIO_set_conn_port(conn,port);*/
- BIO_set_conn_hostname(conn,host);
-
- if (scon == NULL)
- serverCon=SSL_new(tm_ctx);
- else
- {
- serverCon=scon;
- SSL_set_connect_state(serverCon);
- }
-
- SSL_set_bio(serverCon,conn,conn);
-
-#if 0
- if( scon != NULL )
- SSL_set_session(serverCon,SSL_get_session(scon));
-#endif
-
- /* ok, lets connect */
- for(;;) {
- i=SSL_connect(serverCon);
- if (BIO_sock_should_retry(i))
- {
- BIO_printf(bio_err,"DELAY\n");
-
- i=SSL_get_fd(serverCon);
- width=i+1;
- FD_ZERO(&readfds);
- openssl_fdset(i,&readfds);
- /* Note: under VMS with SOCKETSHR the 2nd parameter
- * is currently of type (int *) whereas under other
- * systems it is (void *) if you don't have a cast it
- * will choke the compiler: if you do have a cast then
- * you can either go for (int *) or (void *).
- */
- select(width,(void *)&readfds,NULL,NULL,NULL);
- continue;
- }
- break;
- }
- if(i <= 0)
- {
- BIO_printf(bio_err,"ERROR\n");
- if (verify_error != X509_V_OK)
- BIO_printf(bio_err,"verify error:%s\n",
- X509_verify_cert_error_string(verify_error));
- else
- ERR_print_errors(bio_err);
- if (scon == NULL)
- SSL_free(serverCon);
- return NULL;
- }
-
- return serverCon;
- }
+{
+ BIO *conn;
+ SSL *serverCon;
+ int width, i;
+ fd_set readfds;
+
+ if ((conn = BIO_new(BIO_s_connect())) == NULL)
+ return (NULL);
+
+/* BIO_set_conn_port(conn,port);*/
+ BIO_set_conn_hostname(conn, host);
+
+ if (scon == NULL)
+ serverCon = SSL_new(tm_ctx);
+ else {
+ serverCon = scon;
+ SSL_set_connect_state(serverCon);
+ }