16 #include <my_global.h>
24 #include <my_getopt.h>
28 const char *VER=
"0.2";
32 const char *default_dbug_option=
"d:t:O,-";
36 fatal_error(
const char* r)
43 main(
int argc __attribute__((unused)),
46 char client_key[] =
"../SSL/client-key.pem", client_cert[] =
"../SSL/client-cert.pem";
47 char ca_file[] =
"../SSL/cacert.pem", *ca_path = 0, *cipher=0;
48 struct st_VioSSLFd* ssl_connector= 0;
49 struct sockaddr_in sa;
52 char xbuf[100]=
"Ohohhhhoh1234";
53 enum enum_ssl_init_error ssl_init_error;
54 unsigned long ssl_error;
57 DBUG_PROCESS(argv[0]);
58 DBUG_PUSH(default_dbug_option);
60 printf(
"Client key/cert : %s/%s\n", client_key, client_cert);
62 printf(
"CAfile : %s\n", ca_file);
64 printf(
"CApath : %s\n", ca_path);
66 ssl_connector = new_VioSSLConnectorFd(client_key, client_cert, ca_file, ca_path, cipher,
69 fatal_error(
"client:new_VioSSLConnectorFd failed");
75 client_vio = vio_new(socket (AF_INET, SOCK_STREAM, 0), VIO_TYPE_TCPIP, TRUE);
77 memset (&sa,
'\0',
sizeof(sa));
78 sa.sin_family = AF_INET;
79 sa.sin_addr.s_addr = inet_addr (
"127.0.0.1");
80 sa.sin_port = htons (1111);
82 err = connect(client_vio->sd, (
struct sockaddr*) &sa,
87 read(client_vio->sd,xbuf,
sizeof(xbuf));
88 sslconnect(ssl_connector,client_vio,60L,&ssl_error);
89 err = vio_read(client_vio,xbuf,
sizeof(xbuf));
91 my_free(ssl_connector);
92 fatal_error(
"client:SSL_read");
95 printf(
"client:got %s\n", xbuf);
97 my_free(ssl_connector);