5 |
#include <netinet/in.h> |
#include <netinet/in.h> |
6 |
#include <netdb.h> |
#include <netdb.h> |
7 |
#include <sys/socket.h> |
#include <sys/socket.h> |
8 |
#include <sys/types.h> /* IEEE Std 1003.1-2001 non-conformance. */ |
#include <sys/types.h> /* IEEE Std 1003.1-2001 transitional. */ |
9 |
#include <sys/time.h> /* IEEE Std 1003.1-2001 non-conformance. */ |
#include <sys/time.h> /* IEEE Std 1003.1-2001 transitional. */ |
10 |
#include <sys/select.h> |
#include <sys/select.h> |
11 |
#include <fcntl.h> |
#include <fcntl.h> |
12 |
|
|
19 |
#endif |
#endif |
20 |
|
|
21 |
|
|
22 |
extern opts_t opts; |
extern options_t opts; |
23 |
extern conn_t connpri, connaux; |
extern connection_t connpri, connaux; |
24 |
|
|
25 |
|
|
26 |
/* |
/* |
27 |
* Connect to mail server. |
* Connect to mail server. |
28 |
*/ |
*/ |
29 |
int |
int |
30 |
init_connection(conn_t * conn, char *serv, unsigned short int port, |
init_connection(connection_t * conn, char *serv, unsigned short int port, |
31 |
unsigned int protocol) |
unsigned int protocol) |
32 |
{ |
{ |
33 |
struct sockaddr_in sa; |
struct sockaddr_in sa; |
87 |
* Initialize Secure Socket Layer connection. |
* Initialize Secure Socket Layer connection. |
88 |
*/ |
*/ |
89 |
int |
int |
90 |
init_secure_connection(conn_t * conn, unsigned int protocol) |
init_secure_connection(connection_t * conn, unsigned int protocol) |
91 |
{ |
{ |
92 |
int e; |
int e; |
93 |
SSL_CTX *ctx; |
SSL_CTX *ctx; |
155 |
* Disconnect from mail server. |
* Disconnect from mail server. |
156 |
*/ |
*/ |
157 |
int |
int |
158 |
close_connection(conn_t * conn) |
close_connection(connection_t * conn) |
159 |
{ |
{ |
160 |
#ifdef SSL_TLS |
#ifdef SSL_TLS |
161 |
if (conn->ssl) { |
if (conn->ssl) { |
178 |
* Read data from socket. |
* Read data from socket. |
179 |
*/ |
*/ |
180 |
int |
int |
181 |
socket_read(conn_t * conn, char *buf) |
socket_read(connection_t * conn, char *buf) |
182 |
{ |
{ |
183 |
int f, e, s; |
int f, e, s; |
184 |
fd_set fds; |
fd_set fds; |
259 |
* Write data to socket. |
* Write data to socket. |
260 |
*/ |
*/ |
261 |
int |
int |
262 |
socket_write(conn_t * conn, char *data) |
socket_write(connection_t * conn, char *data) |
263 |
{ |
{ |
264 |
int f, e, s; |
int f, e, s; |
265 |
fd_set fds; |
fd_set fds; |