commit 5efd59ecd052a5eabf5afa1b66405d24f6397d21
parent 11c072314d2ac98adacfb60deb6902dc893cecf0
Author: nibble <unknown>
Date: Thu, 12 Nov 2009 10:52:36 +0100
* Fixed bug handling plain connections
* More code cleanup in sock.c
Diffstat:
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/sock.c b/sock.c
@@ -19,8 +19,8 @@ static SSL *sfd;
static int fd = -1;
int sock_ssl (int enable) {
+ int ret = 0;
#if HAVE_SSL
- int err = 1;
if (enable) {
// TODO Check certificate
SSL_library_init ();
@@ -29,13 +29,11 @@ int sock_ssl (int enable) {
ctx = SSL_CTX_new (SSLv23_method ());
sfd = SSL_new (ctx);
SSL_set_fd (sfd, fd);
- err = SSL_connect (sfd);
+ ret = SSL_connect (sfd);
}
ssl = enable;
- return err;
-#else
- return 0;
#endif
+ return ret;
}
int sock_connect(const char *host, int port, int ssl) {