Commit 6eb379de authored by 's avatar
Browse files

fix error in ssl (bug 455)


git-svn-id: file:///home/svn/mapi/trunk@967 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 7c40f6ff
......@@ -252,11 +252,11 @@ int mapiipc_remote_init(struct host *h)
if ((ctx=SSL_CTX_new(SSLv3_client_method())) == NULL) {
ERR_print_errors_fp(stderr);
return 0;
return -1;
}
if ((h->con = SSL_new(ctx)) == NULL) {
ERR_print_errors_fp(stderr);
return 0;;
return -1;
}
#endif
......@@ -308,11 +308,11 @@ int mapiipc_remote_init(struct host *h)
#ifdef DIMAPISSL
if (SSL_set_fd(h->con, h->sockfd) == 0) {
ERR_print_errors_fp(stderr);
return 0;
return -1;
}
if (SSL_connect(h->con) <= 0) {
ERR_print_errors_fp(stderr);
return 0;
return -1;
}
#endif
return 0;
......
......@@ -89,15 +89,15 @@ int main() {
#ifdef DIMAPISSL
if ((ctx=SSL_CTX_new(SSLv3_server_method())) == NULL) {
ERR_print_errors_fp(stderr);
return 0;
return -1;
}
if (SSL_CTX_use_certificate_file(ctx, CONFDIR"/"MAPICOMMD_SSL_CERT_FILE, SSL_FILETYPE_PEM) <= 0) {
ERR_print_errors_fp(stderr);
return 0;
return -1;
}
if (SSL_CTX_use_PrivateKey_file(ctx, CONFDIR"/"MAPICOMMD_SSL_KEY_FILE, SSL_FILETYPE_PEM) <= 0) {
ERR_print_errors_fp(stderr);
return 0;
return -1;
}
#endif
......@@ -110,7 +110,7 @@ int main() {
if (bind(serv_sock, (struct sockaddr *)&serv_addr, sizeof serv_addr) == -1) {
close(serv_sock);
die("Unexpected error on bind()");
exit(1);
exit(-1);
}
/* queue max 5 connections */
......@@ -134,15 +134,15 @@ int main() {
#ifdef DIMAPISSL
if ((con=SSL_new(ctx)) == NULL) {
ERR_print_errors_fp(stderr);
return 0;;
continue;
}
if (SSL_set_fd(con, new_sock) == 0) {
ERR_print_errors_fp(stderr);
return 0;
continue;
}
if (SSL_accept(con) <= 0) {
ERR_print_errors_fp(stderr);
return 0;
continue;
}
#endif
printf("<*> got connection from %s\n", inet_ntoa(clnt_addr.sin_addr));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment