mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 06:40:12 +01:00
code cleanup
This commit is contained in:
parent
ccb3d72b8e
commit
f6230971a7
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#define VERSION "1.2.0-master"
|
#define VERSION "1.2.0-master"
|
||||||
|
|
||||||
#define BUILD 932
|
#define BUILD 933
|
||||||
|
|
||||||
#define HOSTID "mailarchiver"
|
#define HOSTID "mailarchiver"
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ void usage(){
|
|||||||
|
|
||||||
|
|
||||||
void send_smtp_command(int sd, char *cmd, char *buf, int buflen, int timeout, int use_ssl, struct __data *data){
|
void send_smtp_command(int sd, char *cmd, char *buf, int buflen, int timeout, int use_ssl, struct __data *data){
|
||||||
|
if(data == NULL || cmd == NULL) return;
|
||||||
|
|
||||||
printf("sent: %s", cmd);
|
printf("sent: %s", cmd);
|
||||||
write1(sd, cmd, strlen(cmd), use_ssl, data->ssl);
|
write1(sd, cmd, strlen(cmd), use_ssl, data->ssl);
|
||||||
@ -54,6 +55,8 @@ static void test_smtp_commands_one_at_a_time(char *server, int port, int timeout
|
|||||||
char recvbuf[MAXBUFSIZE], sendbuf[MAXBUFSIZE];
|
char recvbuf[MAXBUFSIZE], sendbuf[MAXBUFSIZE];
|
||||||
struct __data data;
|
struct __data data;
|
||||||
|
|
||||||
|
data.ssl = NULL;
|
||||||
|
|
||||||
sd = connect_to_smtp_server(server, port, timeout, use_ssl, &data);
|
sd = connect_to_smtp_server(server, port, timeout, use_ssl, &data);
|
||||||
|
|
||||||
send_smtp_command(sd, "HELO aaaa.fu\r\n", recvbuf, sizeof(recvbuf)-1, timeout, use_ssl, &data);
|
send_smtp_command(sd, "HELO aaaa.fu\r\n", recvbuf, sizeof(recvbuf)-1, timeout, use_ssl, &data);
|
||||||
@ -85,6 +88,8 @@ static void test_smtp_commands_pipelining(char *server, int port, int timeout){
|
|||||||
char recvbuf[MAXBUFSIZE], sendbuf[MAXBUFSIZE];
|
char recvbuf[MAXBUFSIZE], sendbuf[MAXBUFSIZE];
|
||||||
struct __data data;
|
struct __data data;
|
||||||
|
|
||||||
|
data.ssl = NULL;
|
||||||
|
|
||||||
sd = connect_to_smtp_server(server, port, timeout, use_ssl, &data);
|
sd = connect_to_smtp_server(server, port, timeout, use_ssl, &data);
|
||||||
|
|
||||||
send_smtp_command(sd, "HELO aaaa.fu\r\n", recvbuf, sizeof(recvbuf)-1, timeout, use_ssl, &data);
|
send_smtp_command(sd, "HELO aaaa.fu\r\n", recvbuf, sizeof(recvbuf)-1, timeout, use_ssl, &data);
|
||||||
@ -107,6 +112,8 @@ static void test_smtp_commands_with_reset_command(char *server, int port, int ti
|
|||||||
char recvbuf[MAXBUFSIZE];
|
char recvbuf[MAXBUFSIZE];
|
||||||
struct __data data;
|
struct __data data;
|
||||||
|
|
||||||
|
data.ssl = NULL;
|
||||||
|
|
||||||
sd = connect_to_smtp_server(server, port, timeout, use_ssl, &data);
|
sd = connect_to_smtp_server(server, port, timeout, use_ssl, &data);
|
||||||
|
|
||||||
send_smtp_command(sd, "HELO aaaa.fu\r\n", recvbuf, sizeof(recvbuf)-1, timeout, use_ssl, &data);
|
send_smtp_command(sd, "HELO aaaa.fu\r\n", recvbuf, sizeof(recvbuf)-1, timeout, use_ssl, &data);
|
||||||
@ -133,6 +140,8 @@ static void test_smtp_commands_partial_command(char *server, int port, int timeo
|
|||||||
char recvbuf[MAXBUFSIZE], sendbuf[MAXBUFSIZE];
|
char recvbuf[MAXBUFSIZE], sendbuf[MAXBUFSIZE];
|
||||||
struct __data data;
|
struct __data data;
|
||||||
|
|
||||||
|
data.ssl = NULL;
|
||||||
|
|
||||||
sd = connect_to_smtp_server(server, port, timeout, use_ssl, &data);
|
sd = connect_to_smtp_server(server, port, timeout, use_ssl, &data);
|
||||||
|
|
||||||
send_smtp_command(sd, "HELO aaaa.fu\r\n", recvbuf, sizeof(recvbuf)-1, timeout, use_ssl, &data);
|
send_smtp_command(sd, "HELO aaaa.fu\r\n", recvbuf, sizeof(recvbuf)-1, timeout, use_ssl, &data);
|
||||||
@ -167,6 +176,8 @@ static void test_smtp_commands_partial_command_pipelining(char *server, int port
|
|||||||
char recvbuf[MAXBUFSIZE], sendbuf[MAXBUFSIZE];
|
char recvbuf[MAXBUFSIZE], sendbuf[MAXBUFSIZE];
|
||||||
struct __data data;
|
struct __data data;
|
||||||
|
|
||||||
|
data.ssl = NULL;
|
||||||
|
|
||||||
sd = connect_to_smtp_server(server, port, timeout, use_ssl, &data);
|
sd = connect_to_smtp_server(server, port, timeout, use_ssl, &data);
|
||||||
|
|
||||||
send_smtp_command(sd, "HELO aaaa.fu\r\n", recvbuf, sizeof(recvbuf)-1, timeout, use_ssl, &data);
|
send_smtp_command(sd, "HELO aaaa.fu\r\n", recvbuf, sizeof(recvbuf)-1, timeout, use_ssl, &data);
|
||||||
@ -192,6 +203,8 @@ int connect_to_smtp_server(char *server, int port, int timeout, int use_ssl, str
|
|||||||
char port_string[8], buf[MAXBUFSIZE];
|
char port_string[8], buf[MAXBUFSIZE];
|
||||||
struct addrinfo hints, *res;
|
struct addrinfo hints, *res;
|
||||||
|
|
||||||
|
if(data == NULL) return sd;
|
||||||
|
|
||||||
snprintf(port_string, sizeof(port_string)-1, "%d", port);
|
snprintf(port_string, sizeof(port_string)-1, "%d", port);
|
||||||
|
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
|
Loading…
Reference in New Issue
Block a user