static void bot_unlinked(int idx, char *par) { int i; char *bot = NULL; bot = newsplit(&par); i = nextbot(bot); if ((i >= 0) && (i != idx)) /* Bot is NOT downstream along idx, so * BOGUS! */ fake_alert(idx, "direction", bot, "unlinked"); else if (i >= 0) { /* Valid bot downstream of idx */ if (par[0]) /* #ifdef HUB */ chatout("*** (%s) %s\n", lastbot(bot), par); /* #else chatout("*** %s unlinked from botnet.\n", par); #endif */ botnet_send_unlinked(idx, bot, par); unvia(idx, findbot(bot)); rembot(bot); } /* Otherwise it's not even a valid bot, so just ignore! */ }
static void bot_thisbot(int idx, char *par) { if (strcasecmp(par, dcc[idx].nick)) { char s[1024] = ""; putlog(LOG_BOTS, "*", "Wrong bot--wanted %s, got %s", dcc[idx].nick, par); dprintf(idx, "bye imposter\n"); simple_snprintf(s, sizeof(s), "Disconnected %s (imposter)", dcc[idx].nick); chatout("*** %s\n", s); botnet_send_unlinked(idx, dcc[idx].nick, s); unvia(idx, findbot(dcc[idx].nick)); killsock(dcc[idx].sock); lostdcc(idx); return; } /* Set capitalization the way they want it */ noshare = 1; change_handle(dcc[idx].user, par); noshare = 0; strlcpy(dcc[idx].nick, par, sizeof(dcc[idx].nick)); }
/* remove every bot linked 'via' bot <x> */ void unvia(int idx, tand_t * who) { tand_t *bot, *bot2; if (!who) return; /* safety */ rempartybot(who->bot); bot = tandbot; while (bot) { if (bot->uplink == who) { unvia(idx, bot); bot2 = bot->next; rembot(bot->bot); bot = bot2; } else bot = bot->next; } #ifndef NO_OLD_BOTNET /* every bot unvia's bots behind anyway, so why send msg's for * EVERY one? - will this break things?! */ tandout_but(idx, "unlinked %s\n", who->bot); #endif }
static void bot_thisbot(int idx, char *par) { if (egg_strcasecmp(par, dcc[idx].nick)) { char s[1024]; putlog(LOG_BOTS, "*", NET_WRONGBOT, dcc[idx].nick, par); dprintf(idx, "bye %s\n", MISC_IMPOSTER); simple_sprintf(s, "%s %s (%s)", MISC_DISCONNECTED, dcc[idx].nick, MISC_IMPOSTER); chatout("*** %s\n", s); botnet_send_unlinked(idx, dcc[idx].nick, s); unvia(idx, findbot(dcc[idx].nick)); killsock(dcc[idx].sock); lostdcc(idx); return; } if (bot_flags(dcc[idx].user) & BOT_LEAF) dcc[idx].status |= BSTAT_LEAF; /* Set capitalization the way they want it */ noshare = 1; change_handle(dcc[idx].user, par); noshare = 0; strcpy(dcc[idx].nick, par); }