From 9df80388a7ddffe2e99cad0c8eeb47d3e11a7fec Mon Sep 17 00:00:00 2001 From: codemastr Date: Sun, 13 Jul 2003 16:43:26 +0000 Subject: [PATCH] various bug fixes and updates --- Changes | 4 ++++ doc/unreal32docs.html | 41 +++++++++++++++++++++++++++++++++++------ help.conf | 35 +++++++++++++++++++++++++++++++---- src/channel.c | 39 +++++++++++++++++++++++++++++++++++++-- src/s_svs.c | 38 +++++++++++++++++++++++++++++++++----- 5 files changed, 140 insertions(+), 17 deletions(-) diff --git a/Changes b/Changes index 68c3cc89c..88fb068eb 100644 --- a/Changes +++ b/Changes @@ -2259,3 +2259,7 @@ seen. gmtime warning still there - Added a system to allow modules to create snomasks using functions SnomaskAdd and SnomaskDel - Fixed ban version crash and another read-after-free. - Fixed problem with make custommodule and multiple EXLIBS arguments (EXLIBS="-la -lb -lc"). +- Fixed a bug with +b and +e involving how trimming should occur when a mask is too long. + (#0001103) reported by Troco. +- Fixed a bug in aliases reported by darko`` +- Updated help.conf and unreal32docs.html (#0001111) reported by SciFi, AngryWolf, and Zerwas. diff --git a/doc/unreal32docs.html b/doc/unreal32docs.html index b47dd7504..b444e678f 100644 --- a/doc/unreal32docs.html +++ b/doc/unreal32docs.html @@ -21,7 +21,7 @@ http://www.unrealircd.com
Version: 3.2
Current Version: 3.2 Beta17
- Last doc update: 2003-06-22 + Last doc update: 2003-07-13 Head Coders: Stskeeps / codemastr / Luke / McSkaf / Syzop
Contributors: Zogg / NiQuiL / assyrian / chasm / DrBin / llthangel / Griever / nighthawk
Documentation: CKnight^ / Syzop
@@ -1998,7 +1998,7 @@ set {
d
- Makes it so you can not receive private messages + Makes it so you can not receive channel PRIVMSGs
k
@@ -2028,6 +2028,18 @@ set {
p
Hides the channels you are in in a /whois reply + +
R
+ Allows you to only receive PRIVMSGs/NOTICEs from registered (+r) users + + +
V
+ Marks you as a WebTV user + + +
z
+ Indicates that you are an SSL client +

7 – User & Oper Commands Table

@@ -2077,9 +2089,9 @@ to get more information on a command.

All - part <channel1, channel2, ...> - Allows you to part (leave) channels. Using the /part #channel1, #channel2, - channel3 will allow you to part more than one channel at a time. + cycle <channel1, channel2, ...> + Cycles the given channel(s). This command is equivilent + to sending a PART then a JOIN command. All @@ -2253,6 +2265,15 @@ to get more information on a command.

of a channel.
All + + dns <option> + Returns information about the IRC server's DNS cache. + Note, since most clients have a builtin DNS command, + you will most likely need to use /raw DNS to use this. + Opers may specify an l as the first parameter to the command + to receive a list of entries in the DNS cache. + All + oper <userid> <password>
Command to give a user operator status if they match an Oper Block
@@ -2530,14 +2551,22 @@ to get more information on a command.

V - Send the vhost block list
y - Send the class block list
Z - Send memory usage information - Admin + All module
Lists all loaded modules + Admin + + close
+ + This command will disconnect all unknown connections from the IRC server. + + IRCOp +

diff --git a/help.conf b/help.conf index 9a9eff4f5..80d88da1e 100644 --- a/help.conf +++ b/help.conf @@ -35,8 +35,8 @@ help Usercmds { " AWAY LINKS NOTICE SILENCE WHO"; " CREDITS LIST PART STATS WHOIS"; " INVITE LUSERS PING TIME WHOWAS"; - " ISON MAP PONG TOPIC"; - " JOIN MODE PRIVMSG USERHOST"; + " ISON MAP PONG TOPIC CYCLE"; + " JOIN MODE PRIVMSG USERHOST DNS"; " KICK MOTD QUIT VERSION"; " KNOCK NAMES RULES VHOST"; " ==-----------------oOo-----------------=="; @@ -56,7 +56,7 @@ help Opercmds { " LAG SETHOST SETIDENT CHGHOST CHGIDENT"; " CHGNAME SQUIT CONNECT DCCDENY UNDCCDENY"; " SAJOIN SAPART SAMODE RPING TRACE"; - " OPERMOTD SDESC MKPASSWD"; + " OPERMOTD SDESC MKPASSWD CLOSE"; " ==----------------oOo---------------=="; }; @@ -104,7 +104,7 @@ help Umodes { " B = Marks you as being a Bot"; " G = Filters out all Bad words in your messages with "; " H = Hide IRCop status in /WHO and /WHOIS. (IRC Operators only)"; - " R = Allows you to only receive PRIVMSGs from registered (+r) users"; + " R = Allows you to only receive PRIVMSGs/NOTICEs from registered (+r) users"; " S = For Services only. (Protects them)"; " V = Marks the client as a WebTV user"; " W = Lets you see when people do a /WHOIS on you (IRC Operators only)"; @@ -263,6 +263,26 @@ help Whowas { " Example: WHOWAS hAtbLaDe"; }; +help Cycle { + " Cycles the given channel(s). This command is equivilent"; + " to sending a PART then a JOIN command."; + " -"; + " Syntax: CYCLE ,,"; + " Example: CYCLE #help"; + " Example: CYCLE #main,#chat"; +}; + +help Dns { + " Returns information about the IRC server's DNS cache."; + " Note, since most clients have a builtin DNS command,"; + " you will most likely need to use /raw DNS to use this."; + " Opers may specify an l as the first parameter to the command"; + " to receive a list of entries in the DNS cache."; + " -"; + "Syntax: DNS"; + "Syntax: DNS l (Oper only)"; +}; + help Names { " Provides a list of users on the specified channel."; " -"; @@ -902,6 +922,13 @@ help Mkpasswd { " Example: MKPASSWD crypt mpsare"; }; +help Close { + " This command will disconnect all unknown connections from the"; + " IRC server."; + " -"; + " Syntax: CLOSE"; +}; + help Tsctl { " This is a highly advanced command used to Adjust the"; " Internal IRC clock."; diff --git a/src/channel.c b/src/channel.c index 5f84ba84a..4b165b7c5 100644 --- a/src/channel.c +++ b/src/channel.c @@ -73,6 +73,7 @@ extern int lifesux; /* Some forward declarations */ CMD_FUNC(do_join); static void add_invite(aClient *, aChannel *); +static char *clean_ban_mask(char *); static int add_banid(aClient *, aChannel *, char *); static int can_join(aClient *, aClient *, aChannel *, char *, char *, char **); @@ -1968,7 +1969,7 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param, break; } retval = 1; - tmpstr = pretty_mask(param); + tmpstr = clean_ban_mask(param); /* For bounce, we don't really need to worry whether * or not it exists on our server. We'll just always * bounce it. */ @@ -1987,7 +1988,7 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param, break; } retval = 1; - tmpstr = pretty_mask(param); + tmpstr = clean_ban_mask(param); /* For bounce, we don't really need to worry whether * or not it exists on our server. We'll just always * bounce it. */ @@ -2402,6 +2403,40 @@ char *pretty_mask(char *mask) return make_nick_user_host(NULL, NULL, cp); return make_nick_user_host(cp, user, host); } + +char *trim_str(char *str, int len) +{ + int l; + if ((l = strlen(str)) > len) + { + str += l - len; + *str = '*'; + } + return str; +} + +char *clean_ban_mask(char *mask) +{ + char *cp; + char *user; + char *host; + + if ((user = index((cp = mask), '!'))) + *user++ = '\0'; + if ((host = rindex(user ? user : cp, '@'))) + { + *host++ = '\0'; + + if (!user) + return make_nick_user_host(NULL, trim_str(cp,USERLEN), + trim_str(host,HOSTLEN)); + } + else if (!user && index(cp, '.')) + return make_nick_user_host(NULL, NULL, trim_str(cp,HOSTLEN)); + return make_nick_user_host(trim_str(cp,NICKLEN), trim_str(user,USERLEN), + trim_str(host,HOSTLEN)); +} + /* Now let _invited_ people join thru bans, +i and +l. * Checking if an invite exist could be done only if a block exists, * but I'm not too fancy of the complicated structure that'd cause, diff --git a/src/s_svs.c b/src/s_svs.c index f0a65ba6a..fb508bdb3 100644 --- a/src/s_svs.c +++ b/src/s_svs.c @@ -278,7 +278,6 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) { char output[501]; char nums[4]; char *current = MyMalloc(strlen(parv[1])+1); - char *xparv[3]; bzero(current, strlen(parv[1])+1); bzero(output, sizeof output); while(format->parameters[i] && j < 500) { @@ -317,10 +316,39 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) { output[j++] = format->parameters[i++]; } output[j] = 0; - xparv[0] = parv[0]; - xparv[1] = output; - xparv[2] = NULL; - m_alias(cptr, sptr, 2, xparv, format->nick); + if (format->type == ALIAS_SERVICES) { + if (SERVICES_NAME && (acptr = find_person(format->nick, NULL))) + sendto_one(acptr, ":%s %s %s@%s :%s", parv[0], + IsToken(acptr->from) ? TOK_PRIVATE : MSG_PRIVATE, + format->nick, SERVICES_NAME, output); + else + sendto_one(sptr, err_str(ERR_SERVICESDOWN), me.name, + parv[0], format->nick); + } + else if (format->type == ALIAS_STATS) { + if (STATS_SERVER && (acptr = find_person(format->nick, NULL))) + sendto_one(acptr, ":%s %s %s@%s :%s", parv[0], + IsToken(acptr->from) ? TOK_PRIVATE : MSG_PRIVATE, + format->nick, STATS_SERVER, output); + else + sendto_one(sptr, err_str(ERR_SERVICESDOWN), me.name, + parv[0], format->nick); + } + else if (format->type == ALIAS_NORMAL) { + if ((acptr = find_person(format->nick, NULL))) { + if (MyClient(acptr)) + sendto_one(acptr, ":%s!%s@%s PRIVMSG %s :%s", parv[0], + sptr->user->username, IsHidden(sptr) ? sptr->user->virthost : sptr->user->realhost, + format->nick, output); + else + sendto_one(acptr, ":%s %s %s :%s", parv[0], + IsToken(acptr->from) ? TOK_PRIVATE : MSG_PRIVATE, + format->nick, output); + } + else + sendto_one(sptr, err_str(ERR_NOSUCHNICK), me.name, + parv[0], format->nick); + } free(current); break; }