OK, so this is what happens:

        I can make a successful connection on my server. I request data and
receive data. I close the connection but then i need another
connection. This time SSL_connect fails and gives me SSL_ERROR_SSL. I
can't find exactly what happened soi started to try different ways to
make the second connection: reusinfg the session, closing everything
(including the SSL_CTX) and creating them all again and even looked
at some examples  (OpenSSL Example Programs 20020110 by Eric Rescorla
January 10, 2002 Edition) but nothing worked...

        Here is my code (the way it looks now...):

int ret;
         BIO *sbio;

         /* Cria um novo contexto SSL */
         ssl = SSL_new (ssl_ctx);

         /* Determina qual socket vamos utilizar */
         //SSL_set_fd (ssl, sockfd);

         /* BIO = Wrapper para IO da openssl */
         sbio = BIO_new_socket(sockfd, BIO_NOCLOSE);
         SSL_set_bio(ssl, sbio, sbio);

         //SSL_set_connect_state (ssl);

         if (session)
         {
            SSL_set_session (ssl, session);
         }

      if ( (ret = SSL_connect (ssl) <= 0 ) )
         {
            FILE *teste;
            teste = fopen ("/home/curumim/connect.log", "w");

            switch (ret)
            {
               case SSL_ERROR_SSL:
               fprintf (teste, "SSL_ERROR_SSL\n");
               ERR_print_errors_fp (teste);
               break;
            }

         return (0);
         }
      }

   /* Programa uma limpeza para a saida */
   atexit (net_close);
   //session = SSL_get1_session (ssl);

        This is my net_open. It is used once and called again later. The
second time it fails...

Obs:  ERR_print_errors doesn't print any errors. Commented lines
where used in different strategies (e.g. getting the actual session
and then reusing it for the second connection).

Ps: Sorry for the big mail...
--
Fabio Durieux Lopes - Salsa
Desenvolvimento
Tel.-Fax: 55(48) 2106-5698
www.nexxera.com
NEXXERA Tecnologia e Serviços S.A.



______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to