SSL SNI support; important http-*:// fix; also http-post support added

This commit is contained in:
van Hauser 2016-06-15 19:53:36 +02:00
parent 4c25bddad7
commit 1579369097
52 changed files with 437 additions and 418 deletions

View file

@ -18,7 +18,7 @@ char apop_challenge[300] = "";
pool *plist = NULL, *p = NULL;
/* functions */
int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port);
int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname);
pool *list_create(pool data) {
pool *p;
@ -411,13 +411,13 @@ int start_pop3(int s, char *ip, int port, unsigned char options, char *miscptr,
return 2;
}
void service_pop3(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port) {
void service_pop3(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int run = 1, next_run = 1, sock = -1;
char *ptr = NULL;
//extract data from the pool, ip is the key
if (plist == NULL)
if (service_pop3_init(ip, sp, options, miscptr, fp, port) != 0)
if (service_pop3_init(ip, sp, options, miscptr, fp, port, hostname) != 0)
hydra_child_exit(2);
p = list_find(ip);
if (p == NULL) {
@ -442,7 +442,7 @@ void service_pop3(char *ip, int sp, unsigned char options, char *miscptr, FILE *
if ((options & OPTION_SSL) == 0) {
sock = hydra_connect_tcp(ip, port);
} else {
sock = hydra_connect_ssl(ip, port);
sock = hydra_connect_ssl(ip, port, hostname);
}
if (sock < 0) {
if (verbose || debug)
@ -475,7 +475,7 @@ void service_pop3(char *ip, int sp, unsigned char options, char *miscptr, FILE *
hydra_report(stderr, "[ERROR] TLS negotiation failed, no answer received from STARTTLS request\n");
} else {
free(buf);
if ((hydra_connect_to_ssl(sock) == -1)) {
if ((hydra_connect_to_ssl(sock, hostname) == -1)) {
if (verbose)
hydra_report(stderr, "[ERROR] Can't use TLS\n");
p->disable_tls = 1;
@ -511,7 +511,7 @@ void service_pop3(char *ip, int sp, unsigned char options, char *miscptr, FILE *
}
int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port) {
int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
int myport = PORT_POP3, mysslport = PORT_POP3_SSL;
char *ptr = NULL;
int sock = -1;
@ -533,7 +533,7 @@ int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FI
} else {
if (port != 0)
mysslport = port;
sock = hydra_connect_ssl(p.ip, mysslport);
sock = hydra_connect_ssl(p.ip, mysslport, hostname);
}
if (sock < 0) {
if (verbose || debug)
@ -593,7 +593,7 @@ int service_pop3_init(char *ip, int sp, unsigned char options, char *miscptr, FI
hydra_report(stderr, "[ERROR] TLS negotiation failed, no answer received from STARTTLS request\n");
} else {
free(buf);
if ((hydra_connect_to_ssl(sock) == -1)) {
if ((hydra_connect_to_ssl(sock, hostname) == -1)) {
if (verbose)
hydra_report(stderr, "[ERROR] Can't use TLS\n");
p.disable_tls = 1;