mirror of
https://github.com/MariaDB/server.git
synced 2025-01-23 15:24:16 +01:00
Merge tonu@work.mysql.com:/home/bk/mysql-4.0
into hundin.mysql.fi:/home/tonu/mysql-4.0
This commit is contained in:
commit
2db2a22cbf
3 changed files with 33 additions and 29 deletions
|
@ -35,6 +35,10 @@ extern "C" {
|
|||
enum enum_vio_type { VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET,
|
||||
VIO_TYPE_NAMEDPIPE, VIO_TYPE_SSL};
|
||||
|
||||
#ifndef __WIN__
|
||||
#define HANDLE void *
|
||||
#endif
|
||||
|
||||
Vio* vio_new(my_socket sd,
|
||||
enum enum_vio_type type,
|
||||
my_bool localhost);
|
||||
|
@ -45,6 +49,10 @@ void vio_delete(Vio* vio);
|
|||
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
void vio_reset(Vio *vio);
|
||||
#else
|
||||
void vio_reset(Vio* vio, enum enum_vio_type type,
|
||||
my_socket sd, HANDLE hPipe,
|
||||
my_bool localhost);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -188,8 +196,6 @@ struct st_VioSSLAcceptorFd
|
|||
/* One copy for client */
|
||||
struct st_VioSSLConnectorFd
|
||||
{
|
||||
BIO* bio_;
|
||||
gptr ssl_;
|
||||
SSL_CTX* ssl_context_;
|
||||
SSL_METHOD* ssl_method_;
|
||||
/* function pointers which are only once for SSL client */
|
||||
|
@ -212,10 +218,6 @@ Vio* new_VioSSL(struct st_VioSSLAcceptorFd* fd, Vio* sd,int state);
|
|||
#endif
|
||||
#endif /* HAVE_OPENSSL */
|
||||
|
||||
#ifndef __WIN__
|
||||
#define HANDLE void *
|
||||
#endif
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
/* This structure is for every connection on both sides */
|
||||
struct st_vio
|
||||
|
|
44
vio/viossl.c
44
vio/viossl.c
|
@ -63,6 +63,26 @@
|
|||
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
|
||||
static void
|
||||
report_errors()
|
||||
{
|
||||
unsigned long l;
|
||||
const char* file;
|
||||
const char* data;
|
||||
int line,flags;
|
||||
DBUG_ENTER("report_errors");
|
||||
|
||||
while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0)
|
||||
{
|
||||
char buf[200];
|
||||
DBUG_PRINT("error", ("OpenSSL: %s:%s:%d:%s\n", ERR_error_string(l,buf),
|
||||
file,line,(flags&ERR_TXT_STRING)?data:"")) ;
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
void vio_ssl_delete(Vio * vio)
|
||||
{
|
||||
/* It must be safe to delete null pointers. */
|
||||
|
@ -266,24 +286,6 @@ my_bool vio_ssl_poll_read(Vio *vio,uint timeout)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
report_errors()
|
||||
{
|
||||
unsigned long l;
|
||||
const char* file;
|
||||
const char* data;
|
||||
int line,flags;
|
||||
DBUG_ENTER("report_errors");
|
||||
|
||||
while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0)
|
||||
{
|
||||
char buf[200];
|
||||
DBUG_PRINT("error", ("OpenSSL: %s:%s:%d:%s\n", ERR_error_string(l,buf),
|
||||
file,line,(flags&ERR_TXT_STRING)?data:"")) ;
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
/* FIXME: There are some duplicate code in
|
||||
* sslaccept()/sslconnect() which maybe can be eliminated
|
||||
*/
|
||||
|
@ -326,7 +328,7 @@ Vio *sslconnect(struct st_VioSSLConnectorFd* ptr, Vio* sd)
|
|||
DBUG_PRINT("enter", ("sd=%s ptr=%p ctx: %p", sd->desc,ptr,ptr->ssl_context_));
|
||||
vio_reset(sd,VIO_TYPE_SSL,sd->sd,0,FALSE);
|
||||
|
||||
ptr->bio_=0;
|
||||
sd->bio_=0;
|
||||
sd->ssl_=0;
|
||||
sd->open_=FALSE;
|
||||
assert(sd != 0);
|
||||
|
@ -339,7 +341,7 @@ Vio *sslconnect(struct st_VioSSLConnectorFd* ptr, Vio* sd)
|
|||
report_errors();
|
||||
DBUG_RETURN(sd);
|
||||
}
|
||||
if (!(ptr->bio_ = BIO_new_socket(sd->sd, BIO_NOCLOSE)))
|
||||
if (!(sd->bio_ = BIO_new_socket(sd->sd, BIO_NOCLOSE)))
|
||||
{
|
||||
DBUG_PRINT("error", ("BIO_new_socket failure"));
|
||||
report_errors();
|
||||
|
@ -347,7 +349,7 @@ Vio *sslconnect(struct st_VioSSLConnectorFd* ptr, Vio* sd)
|
|||
sd->ssl_=0;
|
||||
DBUG_RETURN(sd);
|
||||
}
|
||||
SSL_set_bio(sd->ssl_, ptr->bio_, ptr->bio_);
|
||||
SSL_set_bio(sd->ssl_, sd->bio_, sd->bio_);
|
||||
SSL_set_connect_state(sd->ssl_);
|
||||
/* sprintf(ptr->desc_, "VioSSL(%d)", sd->sd);
|
||||
sd->ssl_cip_ = SSL_get_cipher(sd->ssl_);*/
|
||||
|
|
|
@ -186,7 +186,7 @@ struct st_VioSSLConnectorFd* new_VioSSLConnectorFd(const char* key_file,
|
|||
DBUG_RETURN(ptr);
|
||||
ctor_failure:
|
||||
DBUG_PRINT("exit", ("there was an error"));
|
||||
DBUG_VOID_RETURN;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -267,7 +267,7 @@ new_VioSSLAcceptorFd(const char* key_file,
|
|||
DBUG_RETURN(ptr);
|
||||
ctor_failure:
|
||||
DBUG_PRINT("exit", ("there was an error"));
|
||||
DBUG_VOID_RETURN;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue