Skip to content
Permalink
Browse files

Remove eggdrop port+1,2,3 linking

Patch by: Geo
Fixes: #843

Remove Eggdrop attempting to connect to port+1, port+2, and port+3 after failing to
link on original port
  • Loading branch information
vanosg committed Nov 26, 2019
1 parent 3058664 commit 0450189818df492fc6b644c8a2c738dedd4260bb
Showing with 11 additions and 43 deletions.
  1. +11 −43 src/dcc.c
@@ -255,53 +255,21 @@ void failed_link(int idx)
{
char s[NICKLEN + 18], s1[512];

#ifdef TLS
/* Stop trying when we are sslport+3 */
if (dcc[idx].port >= dcc[idx].u.bot->port + 3 && dcc[idx].ssl) {
#else
if (dcc[idx].port >= dcc[idx].u.bot->port + 3) {
#endif
if (dcc[idx].u.bot->linker[0]) {
egg_snprintf(s, sizeof s, "Couldn't link to %s.", dcc[idx].nick);
strcpy(s1, dcc[idx].u.bot->linker);
add_note(s1, botnetnick, s, -2, 0);
}
if (dcc[idx].u.bot->numver >= -1)
putlog(LOG_BOTS, "*", DCC_LINKFAIL, dcc[idx].nick);
killsock(dcc[idx].sock);
strcpy(s, dcc[idx].nick);
lostdcc(idx);
autolink_cycle(s); /* Check for more auto-connections */
return;
if (dcc[idx].u.bot->linker[0]) {
egg_snprintf(s, sizeof s, "Couldn't link to %s.", dcc[idx].nick);
strcpy(s1, dcc[idx].u.bot->linker);
add_note(s1, botnetnick, s, -2, 0);
}
if (dcc[idx].u.bot->numver >= -1)
putlog(LOG_BOTS, "*", DCC_LINKFAIL, dcc[idx].nick);
killsock(dcc[idx].sock);
strcpy(s, dcc[idx].nick);
lostdcc(idx);
autolink_cycle(s); /* Check for more auto-connections */
return;

/* Try next port, if it makes sense (no AF_UNSPEC, ...) */
killsock(dcc[idx].sock);
dcc[idx].timeval = now;
#ifdef TLS
/* Order of attempts:
* If initial SSL: sslport+1; sslport+2; sslport+3
* Else: sslport; plain+1; sslport+1; plain+2; sslport+2; plain+3; sslport+3
*/
if (dcc[idx].u.bot->ssl) {
++dcc[idx].port;
} else if (dcc[idx].ssl) {
dcc[idx].ssl = 0;
++dcc[idx].port;
} else {
dcc[idx].ssl = 1;
}
#else
++dcc[idx].port;
#endif

if (open_telnet(idx, dcc[idx].host, dcc[idx].port) < 0)
failed_link(idx);
#ifdef TLS
else if (dcc[idx].ssl && ssl_handshake(dcc[idx].sock, TLS_CONNECT,
tls_vfybots, LOG_BOTS, dcc[idx].host, NULL))
failed_link(idx);
#endif
}

static void cont_link(int idx, char *buf, int i)

0 comments on commit 0450189

Please sign in to comment.
You can’t perform that action at this time.