1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-03 10:23:13 +02:00

- Partially redid m_message, moved some stuff to a subroutine, etc to avoid duplicate code

- Rephrased/editted part of example.conf and unreal32docs to make it a littttttle bit easier
  for beginners / try to mention the FAQ a bit more explicitly.
This commit is contained in:
Bram Matthys
2006-03-12 20:56:09 +00:00
parent 9db31d4032
commit 898ff7855d
4 changed files with 172 additions and 148 deletions
+3
View File
@@ -1081,3 +1081,6 @@
- Updated win32 makefile due to m_names modulization, reported by Trocotronic (#0002838).
- Actually committed src/modules/m_names.c... This tends to help with the compiling process.
- Fixed possible netsplit problem (#0002790).
- Partially redid m_message, moved some stuff to a subroutine, etc to avoid duplicate code
- Rephrased/editted part of example.conf and unreal32docs to make it a littttttle bit easier
for beginners / try to mention the FAQ a bit more explicitly.
+6 -4
View File
@@ -14,9 +14,11 @@
* closing } line. The IRCd will ignore commented lines.
*
* PLEASE READ doc/unreal32docs.html! The online version is also available at:
* www.vulnscan.org/UnrealIrcd/unreal32docs.html
* www.vulnscan.org/UnrealIRCd/unreal32docs.html
* It contains a lot information about the configfile: gives information about
* every block, variable, etc..
* If you try to edit this file without reading the documentation properly
* then you are pretty much guaranteed to fail!
*/
/* Type of comments */
@@ -754,7 +756,7 @@ set {
*/
oper-only-stats "okfGsMRUEelLCXzdD";
/* Throttling: this example sets a limit of 3 connections per 60s (per host). */
/* Throttling: this example sets a limit of 3 connection attempts per 60s (per host). */
throttle {
connections 3;
period 60s;
@@ -776,8 +778,8 @@ set {
/*
* Problems or need more help?
* 1) www.vulnscan.org/UnrealIrcd/unreal32docs.html
* 2) www.vulnscan.org/UnrealIrcd/faq/ <- contains 80% of your questions!
* 1) www.vulnscan.org/UnrealIRCd/unreal32docs.html
* 2) www.vulnscan.org/UnrealIRCd/faq/ <- contains 80% of your questions!
* 3) If you still have problems you can go irc.ircsystems.net #unreal-support,
* note that we require you to READ THE DOCUMENTATION and FAQ first!
*/
+22 -21
View File
@@ -36,11 +36,9 @@ English |
<b>Head Coders:</b> Stskeeps / codemastr / Syzop / Luke<br>
<b>Contributors:</b> McSkaf / Zogg / NiQuiL / assyrian / chasm / DrBin / llthangel / Griever / nighthawk<br>
<b>Documentation:</b> CKnight^ / Syzop<br>
<p>Due to the increasing complexity of UnrealIRCd3.2 We have switched to an easier
to navigate, more inclusive documentation set. To view this documentation you
must have a compatible browser, which are listed below. Up to date docs are
available at <a href="http://www.vulnscan.org/UnrealIrcd/unreal32docs.html">http://www.vulnscan.org/UnrealIrcd/unreal32docs.html</a>
and a FAQ at <a href="http://www.vulnscan.org/UnrealIrcd/faq/" TARGET="_blank">http://www.vulnscan.org/UnrealIrcd/faq/</a>.
<p>To view this documentation you must have a compatible browser, which are listed below. Up to date docs are
available at <a href="http://www.vulnscan.org/UnrealIRCd/unreal32docs.html">http://www.vulnscan.org/UnrealIRCd/unreal32docs.html</a>
and a FAQ at <a href="http://www.vulnscan.org/UnrealIRCd/faq/" TARGET="_blank">http://www.vulnscan.org/UnrealIRCd/faq/</a>.
</p>
<p><b>Compatible Browsers: </b><br>
<ul>
@@ -127,7 +125,7 @@ English |
---8.7. <a href="#secinformation">Information disclosure</a><br>
---8.8. <a href="#secantiexploit">Protecting against exploits</a><br>
---8.9. <a href="#secsummary">Summary</a><br>
9. <a href="http://www.vulnscan.org/UnrealIrcd/faq/" target="_blank">Frequently Asked Questions (FAQ)</a><br>
9. <a href="http://www.vulnscan.org/UnrealIRCd/faq/" target="_blank">Frequently Asked Questions (FAQ)</a><br>
A. <a href="#regex">Regular Expressions</a><br>
---A.1. <a href="#regexlit">Literals</a><br>
---A.2. <a href="#regexdot">Dot Operator</a><br>
@@ -146,9 +144,9 @@ English |
another software package is strictly prohibited without the written permission
of the UnrealIRCd Development Team. This document may be copied/printed/reproduced/published
as many times as you like, provided it is for use with UnrealIRCd and it is not
modified in anyway. &#8211; Copyright UnrealIRCd Development Team 2002-2004</p>
modified in anyway. &#8211; Copyright UnrealIRCd Development Team 2002-2006</p>
<p>Please read this manual before asking for help, you also REALLY want to take a look at the
<a href="http://www.vulnscan.org/UnrealIrcd/faq/" target="_blank">FAQ</a> since over 80% of your questions/problems are answered in it. If you still
<a href="http://www.vulnscan.org/UnrealIRCd/faq/" target="_blank">FAQ</a> since over 80% of your questions/problems are answered in it. If you still
need help you can ask for support at irc.ircsystems.net (port 6667) channel #unreal-support (note
that we REQUIRE you to read the docs and faq and we only help with UnrealIRCd, not with services!).
If you have a real bug (like a crash) then report it at
@@ -234,7 +232,8 @@ Windows:<br>
<a name="features"></a></p><div class="desc">
<p>Some major/nice features are explained in this section. It provides a general overview,
and sometimes refers to the config file (something which you might know nothing about yet).</p>
<p>You can skip this section, however it's suggested to read it before/after installing.</p></div>
<p>You can skip this section, however it's very much suggested to read it before/after installing
because otherwise you will not understand concepts such as 'cloaking', 'snomasks', etc.</p></div>
<p><font size="+2"><b>3.1 - Cloaking</b></font><a name="feature_cloaking"></a></p><div class="desc">
<p>Cloaking is a way to hide the real hostname of users, for example if your real host is <i>d5142341.cable.wanadoo.nl</i>,
@@ -643,11 +642,11 @@ IRC, instead of the host/ip of the CGI:IRC-gateway.</p>
<p> </p>
<p><font size="+2"><b>4.0 - Configuring your unrealircd.conf</b></font>
<a name="configuringyourunrealircdconf"></a></p><div class="desc">
<p>First of all, creating a good unrealircd.conf will take some time, probably
something like 10 - 60m. You can try to get it booted up as quickly as you can and
tweak later, or you can learn the major sections directly step-by-step which is
the recommended method ;P. If you have any problems, check your syntax, check the manual
and check the FAQ before asking for help/reporting a bug.</p></div>
<p>First of all, creating your first unrealircd.conf will take time (say, 15-60
minutes). Creating a <u>good</u> unrealircd.conf will take even more time.
You should not rush to get the IRCd booted, but rather go through things
step-by-step. If you have any problems, check your syntax, check this manual
and check the <a href="http://www.vulnscan.org/UnrealIRCd/faq/">FAQ</a> before asking for help/reporting a bug.</p></div>
<p><b><font size="+2">4.1 Configuration File Explained</font></b><a name="configurationfileexplained"></a><br><div class="desc">
</p>
<p>The new system uses a block-based format. Each entry, or block, in the new
@@ -671,8 +670,8 @@ IRC, instead of the host/ip of the CGI:IRC-gateway.</p>
Also note that there is no set format, meaning the whole block can appear on
one line or over multiple lines. The format above is what is normally used (and
what will be used in this file) because it is easy to read. </p>
<p>Note: the configuration file is currently case sensitive so BLOCK-NAME is not
the same as block-name. There is a special notation used to talk about entries
<p>Note: the configuration file is currently case sensitive so <i>BLOCK-NAME</i> is not
the same as <i>block-name</i>. There is a special notation used to talk about entries
in the config file. For example, to talk about &lt;directive-name&gt; in the
example above, you'd say &lt;block-name&gt;::&lt;block-directive&gt;, and if
that directive has a sub block you want to reverence, you would add another
@@ -686,9 +685,11 @@ IRC, instead of the host/ip of the CGI:IRC-gateway.</p>
/* Multi line<br>
&nbsp;&nbsp;&nbsp;&nbsp;comment */<br>
</p>
<p>Now that you know how it works, create your unrealircd.conf from scratch or
copy doc/example.conf and start editing. It's recommended to walk step by step
through all block types and use this manual as a reference.</p>
<p>Now that you know how it works, copy <i>doc/example.conf</i> to your UnrealIRCd
directory (eg: /home/user/Unreal3.2) and rename it to <i>unrealircd.conf</i>
(OR create your <i>unrealircd.conf</i> from scratch).
It's recommended to walk step by step through all block types and
settings in your conf and use this manual as a reference.</p>
<p></p></div>
<p><font class="block_section">4.2 - </font><font class="block_name">Me Block</font>
<font class="block_required">REQUIRED</font> <font class="block_old">(Previously known as the M:Line)</font><a name="meblock"></a><div class="desc">
@@ -3439,7 +3440,7 @@ It will however make it more difficult / increase the effort needed to attack/ha
<p><b><font size="+2">8.8 Protecting against exploits</font></b><a name="secantiexploit"></a><br><div class="desc">
There are kernel patches that make it more difficult for stack- and heap-based exploits to
work. This should however not be your main focus point, you have a far more bigger risk
work. This is nice, but should not be your main focus point, you have a far more bigger risk
of getting exploited through the other points than this... for various reasons.<br>
<br>
There's one thing you should do however, which is to ALWAYS USE THE LATEST VERSION,
@@ -3459,7 +3460,7 @@ security until they got hacked, try to avoid that :).
<p><font size="+2"><b>9 &#8211; Frequently Asked Questions (FAQ)<a name="faq"></a></b></font></p>
<div class="desc"><p>The FAQ is available online <a href="http://www.vulnscan.org/UnrealIrcd/faq/" TARGET="_blank">here</a></p></div>
<div class="desc"><p>The FAQ is available online <a href="http://www.vulnscan.org/UnrealIRCd/faq/" TARGET="_blank">here</a></p></div>
<p></p>
<p><font size="+2"><b>A Regular Expressions<a name="regex"></a></b></font></p>
+141 -123
View File
@@ -102,6 +102,111 @@ DLLFUNC int MOD_UNLOAD(m_message)(int module_unload)
static int check_dcc(aClient *sptr, char *target, aClient *targetcli, char *text);
static int check_dcc_soft(aClient *from, aClient *to, char *text);
#define CANPRIVMSG_CONTINUE 100
#define CANPRIVMSG_SEND 101
/** Check if PRIVMSG's are permitted from a person to another person.
* cptr: ..
* sptr: ..
* acptr: target client
* notice: 1 if notice, 0 if privmsg
* text: Pointer to a pointer to a text [in, out]
* cmd: Pointer to a pointer which contains the command to use [in, out]
*
* RETURN VALUES:
* CANPRIVMSG_CONTINUE: issue a 'continue' in target nickname list (aka: skip further processing this target)
* CANPRIVMSG_SEND: send the message (use text/newcmd!)
* Other: return with this value (can be anything like 0, -1, FLUSH_BUFFER, etc)
*/
static int can_privmsg(aClient *cptr, aClient *sptr, aClient *acptr, int notice, char **text, char **cmd)
{
char *ctcp;
int ret;
if (IsVirus(sptr))
{
sendnotice(sptr, "You are only allowed to talk in '%s'", SPAMFILTER_VIRUSCHAN);
return CANPRIVMSG_CONTINUE;
}
/* Umode +R (idea from Bahamut) */
if (IsRegNickMsg(acptr) && !IsRegNick(sptr) && !IsULine(sptr) && !IsOper(sptr) && !IsServer(sptr)) {
sendto_one(sptr, err_str(ERR_NONONREG), me.name, sptr->name,
acptr->name);
return 0;
}
if (IsNoCTCP(acptr) && !IsOper(sptr) && **text == 1 && acptr != sptr)
{
ctcp = *text + 1; /* &*text[1]; */
if (myncmp(ctcp, "ACTION ", 7) && myncmp(ctcp, "DCC ", 4))
{
sendto_one(sptr, err_str(ERR_NOCTCP), me.name, sptr->name, acptr->name);
return 0;
}
}
if (MyClient(sptr) && !strncasecmp(*text, "\001DCC", 4))
{
ret = check_dcc(sptr, acptr->name, acptr, *text);
if (ret < 0)
return ret;
if (ret == 0)
return CANPRIVMSG_CONTINUE;
}
if (MyClient(acptr) && !strncasecmp(*text, "\001DCC", 4) &&
!check_dcc_soft(sptr, acptr, *text))
return CANPRIVMSG_CONTINUE;
if (MyClient(sptr) && check_for_target_limit(sptr, acptr, acptr->name))
return CANPRIVMSG_CONTINUE;
if (!is_silenced(sptr, acptr))
{
#ifdef STRIPBADWORDS
int blocked = 0;
#endif
Hook *tmphook;
if (notice && IsWebTV(acptr) && **text != '\1')
*cmd = MSG_PRIVATE;
if (!notice && MyConnect(sptr) &&
acptr->user && acptr->user->away)
sendto_one(sptr, rpl_str(RPL_AWAY),
me.name, sptr->name, acptr->name,
acptr->user->away);
#ifdef STRIPBADWORDS
if (MyClient(sptr) && !IsULine(acptr) && IsFilteringWords(acptr))
{
*text = stripbadwords_message(*text, &blocked);
if (blocked)
{
if (!notice && MyClient(sptr))
sendto_one(sptr, rpl_str(ERR_NOSWEAR),
me.name, sptr->name, acptr->name);
return CANPRIVMSG_CONTINUE;
}
}
#endif
if (MyClient(sptr))
{
ret = dospamfilter(sptr, *text, (notice ? SPAMF_USERNOTICE : SPAMF_USERMSG), acptr->name, 0, NULL);
if (ret < 0)
return ret;
}
for (tmphook = Hooks[HOOKTYPE_USERMSG]; tmphook; tmphook = tmphook->next) {
*text = (*(tmphook->func.pcharfunc))(cptr, sptr, acptr, *text, notice);
if (!*text)
break;
}
if (!*text)
return CANPRIVMSG_CONTINUE;
return CANPRIVMSG_SEND;
}
return CANPRIVMSG_CONTINUE;
}
/*
** m_message (used in m_private() and m_notice())
** the general function to deliver MSG's between users/channels
@@ -117,10 +222,10 @@ static int check_dcc_soft(aClient *from, aClient *to, char *text);
static int recursive_webtv = 0;
DLLFUNC int m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int notice)
{
aClient *acptr;
aClient *acptr, *srvptr;
char *s;
aChannel *chptr;
char *nick, *server, *p, *cmd, *ctcp, *p2, *pc, *text;
char *nick, *server, *p, *cmd, *ctcp, *p2, *pc, *text, *newcmd;
int cansend = 0;
int prefix = 0;
char pfixchan[CHANNELLEN + 4];
@@ -197,96 +302,21 @@ DLLFUNC int m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int
return ret;
}
}
if (*nick != '#' && (acptr = find_person(nick, NULL)))
{
if (IsVirus(sptr))
text = parv[2];
newcmd = cmd;
ret = can_privmsg(cptr, sptr, acptr, notice, &text, &newcmd);
if (ret == CANPRIVMSG_SEND)
{
sendnotice(sptr, "You are only allowed to talk in '%s'", SPAMFILTER_VIRUSCHAN);
sendto_message_one(acptr, sptr, parv[0], newcmd, nick, text);
continue;
}
/* Umode +R (idea from Bahamut) */
if (IsRegNickMsg(acptr) && !IsRegNick(sptr) && !IsULine(sptr) && !IsOper(sptr) && !IsServer(sptr)) {
sendto_one(sptr, err_str(ERR_NONONREG), me.name, parv[0],
acptr->name);
return 0;
}
if (IsNoCTCP(acptr) && !IsOper(sptr) && *parv[2] == 1 && acptr != sptr)
{
ctcp = &parv[2][1];
if (myncmp(ctcp, "ACTION ", 7) && myncmp(ctcp, "DCC ", 4))
{
sendto_one(sptr, err_str(ERR_NOCTCP), me.name, parv[0],
acptr->name);
return 0;
}
}
if (MyClient(sptr) && !strncasecmp(parv[2], "\001DCC", 4))
{
ret = check_dcc(sptr, acptr->name, acptr, parv[2]);
if (ret < 0)
return ret;
if (ret == 0)
continue;
}
if (MyClient(acptr) && !strncasecmp(parv[2], "\001DCC", 4) &&
!check_dcc_soft(sptr, acptr, parv[2]))
} else
if (ret == CANPRIVMSG_CONTINUE)
continue;
if (MyClient(sptr) && check_for_target_limit(sptr, acptr, acptr->name))
continue;
if (!is_silenced(sptr, acptr))
{
#ifdef STRIPBADWORDS
int blocked = 0;
#endif
char *newcmd = cmd, *text;
Hook *tmphook;
if (notice && IsWebTV(acptr) && *parv[2] != '\1')
newcmd = MSG_PRIVATE;
if (!notice && MyConnect(sptr) &&
acptr->user && acptr->user->away)
sendto_one(sptr, rpl_str(RPL_AWAY),
me.name, parv[0], acptr->name,
acptr->user->away);
#ifdef STRIPBADWORDS
if (MyClient(sptr) && !IsULine(acptr) && IsFilteringWords(acptr))
{
text = stripbadwords_message(parv[2], &blocked);
if (blocked)
{
if (!notice && MyClient(sptr))
sendto_one(sptr, rpl_str(ERR_NOSWEAR),
me.name, parv[0], acptr->name);
continue;
}
}
else
#endif
text = parv[2];
if (MyClient(sptr))
{
ret = dospamfilter(sptr, text, (notice ? SPAMF_USERNOTICE : SPAMF_USERMSG), acptr->name, 0, NULL);
if (ret < 0)
return ret;
}
for (tmphook = Hooks[HOOKTYPE_USERMSG]; tmphook; tmphook = tmphook->next) {
text = (*(tmphook->func.pcharfunc))(cptr, sptr, acptr, text, notice);
if (!text)
break;
}
if (!text)
continue;
sendto_message_one(acptr,
sptr, parv[0], newcmd, nick, text);
}
continue;
else
return ret;
}
p2 = (char *)strchr(nick, '#');
@@ -546,49 +576,37 @@ DLLFUNC int m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int
/* There is always a \0 if its a string */
if (*(server + 1) != '\0')
{
acptr = find_server_quick(server + 1);
if (acptr)
char fulltarget[NICKLEN + HOSTLEN + 1];
strlcpy(fulltarget, nick, sizeof(fulltarget)); /* lame.. I know.. */
srvptr = find_server_quick(server + 1);
if (srvptr)
{
/*
** Not destined for a user on me :-(
*/
if (!IsMe(acptr))
acptr = find_nickserv(nick, NULL);
if (acptr && (acptr->srvptr == srvptr))
{
if (IsToken(acptr->from))
sendto_one(acptr,
":%s %s %s :%s", parv[0],
notice ? TOK_NOTICE : TOK_PRIVATE,
nick, parv[2]);
else
sendto_one(acptr,
":%s %s %s :%s", parv[0],
cmd, nick, parv[2]);
continue;
}
text = parv[2];
newcmd = cmd;
ret = can_privmsg(cptr, sptr, acptr, notice, &text, &newcmd);
if (ret == CANPRIVMSG_CONTINUE)
continue;
else if (ret != CANPRIVMSG_SEND)
return ret;
/* If we end up here, we have to actually send it... */
/* Find the nick@server using hash. */
acptr =
find_nickserv(nick,
(aClient *)NULL);
if (acptr)
{
sendto_prefix_one(acptr, sptr,
":%s %s %s :%s",
parv[0], cmd,
acptr->name, parv[2]);
if (IsMe(acptr))
sendto_prefix_one(acptr, sptr, ":%s %s %s :%s", sptr->name, newcmd, acptr->name, text);
else
sendto_message_one(acptr, sptr, sptr->name, newcmd, fulltarget, text);
continue;
}
}
if (server
&& strncasecmp(server + 1, SERVICES_NAME,
strlen(SERVICES_NAME)) == 0)
sendto_one(sptr,
err_str(ERR_SERVICESDOWN), me.name,
parv[0], nick);
/* NICK@SERVER NOT FOUND: */
if (server && strncasecmp(server + 1, SERVICES_NAME, strlen(SERVICES_NAME)) == 0)
sendto_one(sptr, err_str(ERR_SERVICESDOWN), me.name, parv[0], nick);
else
sendto_one(sptr,
err_str(ERR_NOSUCHNICK), me.name,
parv[0], nick);
sendto_one(sptr, err_str(ERR_NOSUCHNICK), me.name, parv[0], fulltarget);
continue;
}