27 |
* Connect to mail server. |
* Connect to mail server. |
28 |
*/ |
*/ |
29 |
#ifndef SSL_TLS |
#ifndef SSL_TLS |
30 |
int init_connection(char *serv, unsigned int port) |
int init_connection(char *serv, unsigned short int port) |
31 |
#else |
#else |
32 |
int init_connection(char *serv, unsigned int port, unsigned int protocol) |
int init_connection(char *serv, unsigned short int port, unsigned int protocol) |
33 |
#endif |
#endif |
34 |
{ |
{ |
35 |
struct sockaddr_in sa; |
struct sockaddr_in sa; |
62 |
log_info(LOG_SERVER, serv); |
log_info(LOG_SERVER, serv); |
63 |
|
|
64 |
#ifdef SSL_TLS |
#ifdef SSL_TLS |
65 |
if (protocol != SSL_DISABLED && !ssl_init(protocol)) { |
if (protocol != SSL_DISABLED) |
66 |
info("Connected to %s using %s.\n", serv, SSL_get_cipher(ssl)); |
if (!ssl_init(protocol)) { |
67 |
return 0; |
info("Connected to %s using %s.\n", serv, SSL_get_cipher(ssl)); |
68 |
} else |
return 0; |
69 |
|
} else |
70 |
|
return ERROR_SSL; |
71 |
|
else |
72 |
ssl = NULL; |
ssl = NULL; |
73 |
#endif |
#endif |
74 |
|
|