Permalink
Browse files

Fix starttls or passreq being on same line as stealth-prompt

Found by: Cizzle (but mostly Geo)
Patch by: Cizzle

Broken earlier this dev release- When a stealth-prompt in conf (with stealth-telnets set to 1) or 0x53e in a language file (with stealth-telnets set to 0) is used without a trailing newline ("\n"), no upgrade to TLS of a botlink or no link at all when TLS is not compiled in happens.
  • Loading branch information...
Cizzle authored and vanosg committed Nov 20, 2018
1 parent e6f2fa1 commit b6d2d094fdf4299d192944f7a3135c82bcd76080
Showing with 12 additions and 6 deletions.
  1. +12 −6 src/dcc.c
@@ -1787,7 +1787,8 @@ static void dcc_telnet_pass(int idx, int atr)
struct threaddata *td = threaddata();
/* mark socket to read next incoming at reduced len */
td->socklist[i].flags |= SOCK_SENTTLS;
dprintf(idx, "starttls\n");
/* Prefix with \n in case of newline-less ending stealth_prompt */
dprintf(idx, "\nstarttls\n");
putlog(LOG_BOTS, "*", "Sent STARTTLS to %s...", dcc[idx].nick);
}
#endif
@@ -1802,7 +1803,8 @@ static void dcc_telnet_pass(int idx, int atr)
* <Cybah>
*/
putlog(LOG_BOTS, "*", "Challenging %s...", dcc[idx].nick);
dprintf(idx, "passreq <%x%x@%s>\n", getpid(), dcc[idx].timeval, botnetnick);
/* Prefix with \n in case of newline-less ending stealth_prompt */
dprintf(idx, "\npassreq <%x%x@%s>\n", getpid(), dcc[idx].timeval, botnetnick);
dcc[idx].type = old;
} else {
/* NOTE: The MD5 digest used above to prevent cleartext passwords being
@@ -2414,12 +2416,16 @@ static void dcc_telnet_got_ident(int i, char *host)
/* This is so we don't tell someone doing a portscan anything
* about ourselves. <cybah>
*/
if (stealth_telnets)
if (stealth_telnets) {
/* Show here so it doesn't interfere with newline-less stealth_prompt */
if (allow_new_telnets)
dprintf(i, "(If you are new, enter 'NEW' here.)\n");
dprintf(i, stealth_prompt);
else {
} else {
dprintf(i, "\n\n");
sub_lang(i, MISC_BANNER);
/* Show here so it doesn't get lost before the banner */
if (allow_new_telnets)
dprintf(i, "(If you are new, enter 'NEW' here.)\n");
}
if (allow_new_telnets)
dprintf(i, "(If you are new, enter 'NEW' here.)\n");
}

0 comments on commit b6d2d09

Please sign in to comment.