diff --git a/ChangeLog b/ChangeLog index 89c124ac..a950e7ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,72 @@ +nenolod 2007/01/25 07:00:49 UTC (20070125-3157) + Log: + Removed merge tracking for "svnmerge" for + http://svn.atheme.org/charybdis/branches/release-2.2 + + + Changes: Modified: + + - trunk/ (Property Modified) + + +nenolod 2007/01/25 06:59:58 UTC (20070125-3155) + Log: + Initialized merge tracking via "svnmerge" with revisions "1-1919" from + http://svn.atheme.org/charybdis/branches/release-2.2 + + + Changes: Modified: + + - trunk/ (Property Modified) + + +nenolod 2007/01/25 06:59:30 UTC (20070125-3153) + Log: + Removed merge tracking for "svnmerge" for + http://svn.atheme.org/charybdis/branches/release-2.2 + + + Changes: Modified: + + - trunk/ (Property Modified) + + +nenolod 2007/01/25 06:58:41 UTC (20070125-3151) + Log: + Initialized merge tracking via "svnmerge" with revisions "1-2190" from + http://svn.atheme.org/charybdis/branches/release-2.2 + + + Changes: Modified: + + - trunk/ (Property Modified) + + +nenolod 2007/01/25 06:57:47 UTC (20070125-3149) + Log: + - bleah + + + Changes: Modified: + + - trunk/ (Property Modified) + + +nenolod 2007/01/25 06:50:46 UTC (20070125-3147) + Log: + Initialized merge tracking via "svnmerge" with revisions "1-3146" from + http://svn.atheme.org/charybdis/branches/release-2.2 + + + Changes: Modified: + + - trunk/ (Property Modified) + + +nenolod 2007/01/25 06:45:04 UTC (20070125-3145) + Log: + - version bump to 2.2.0 + + + Changes: Modified: + +3 -1 trunk/NEWS (File Modified) + +1 -1 trunk/configure.ac (File Modified) + + nenolod 2007/01/25 06:40:21 UTC (20070125-3143) Log: - the new plan: diff --git a/doc/example.conf b/doc/example.conf index a0576c58..25d59796 100755 --- a/doc/example.conf +++ b/doc/example.conf @@ -4,7 +4,7 @@ * Copyright (C) 2002-2005 ircd-ratbox development team * Copyright (C) 2005-2006 charybdis development team * - * $Id: example.conf 3131 2007-01-21 15:36:31Z jilles $ + * $Id: example.conf 3159 2007-01-25 07:08:21Z nenolod $ * * See reference.conf for more information. */ @@ -286,7 +286,7 @@ serverhide { /* These are the blacklist settings. * You can have multiple combinations of host and rejection reasons. - * They are used in pairs of one host/rejection reason. + * They are used in pairs of one host/rejection reason, or multiple hosts/rejection reason. * * These settings should be adequate for most networks, and are (presently) * required for use on AthemeNet. @@ -294,16 +294,25 @@ serverhide { * Word to the wise: Do not use blacklists like SPEWS for blocking IRC * connections. * + * As of charybdis 2.2, you can do some keyword substitution on the rejection + * reason. The available keyword substitutions are: + * + * ${ip} - the user's IP + * ${host} - the user's canonical hostname + * ${dnsbl-host} - the dnsbl hostname the lookup was done against + * ${nick} - the user's nickname + * ${network-name} - the name of the network + * * Note: AHBL (the providers of the below BLs) request that they be * contacted, via email, at admins@2mbit.com before using these BLs. * See for more information. */ #blacklist { # host = "ircbl.ahbl.org"; -# reject_reason = "You have a host listed in the ircbl.ahbl.org blacklist."; +# reject_reason = "${nick}, your IP (${ip}) is listed in ${dnsbl-host} for having an open proxy. In order to protect ${network-name} from abuse, we are not allowing connections with open proxies to connect."; # # host = "tor.ahbl.org"; -# reject_reason = "You are connecting from a TOR exit node."; +# reject_reason = "${nick}, your IP (${ip}) is listed as a TOR exit node. In order to protect ${network-name} from tor-based abuse, we are not allowing TOR exit nodes to connect to our network."; #}; alias "NickServ" { diff --git a/doc/reference.conf b/doc/reference.conf index 6fcb82e2..4b43faef 100755 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -6,7 +6,7 @@ * * Written by ejb, wcampbel, db, leeh and others * - * $Id: reference.conf 3131 2007-01-21 15:36:31Z jilles $ + * $Id: reference.conf 3159 2007-01-25 07:08:21Z nenolod $ */ /* IMPORTANT NOTES: @@ -675,7 +675,7 @@ serverhide { /* These are the blacklist settings. * You can have multiple combinations of host and rejection reasons. - * They are used in pairs of one host/rejection reason. + * They are used in pairs of one host/rejection reason, or multiple hosts/rejection reason. * * These settings should be adequate for most networks, and are (presently) * required for use on AthemeNet. @@ -683,16 +683,25 @@ serverhide { * Word to the wise: Do not use blacklists like SPEWS for blocking IRC * connections. * + * As of charybdis 2.2, you can do some keyword substitution on the rejection + * reason. The available keyword substitutions are: + * + * ${ip} - the user's IP + * ${host} - the user's canonical hostname + * ${dnsbl-host} - the dnsbl hostname the lookup was done against + * ${nick} - the user's nickname + * ${network-name} - the name of the network + * * Note: AHBL (the providers of the below BLs) request that they be * contacted, via email, at admins@2mbit.com before using these BLs. * See for more information. */ #blacklist { # host = "ircbl.ahbl.org"; -# reject_reason = "You have a host listed in the ircbl.ahbl.org blacklist."; +# reject_reason = "${nick}, your IP (${ip}) is listed in ${dnsbl-host} for having an open proxy. In order to protect ${network-name} from abuse, we are not allowing connections with open proxies to connect."; # # host = "tor.ahbl.org"; -# reject_reason = "You are connecting from a TOR exit node."; +# reject_reason = "${nick}, your IP (${ip}) is listed as a TOR exit node. In order to protect ${network-name} from tor-based abuse, we are not allowing TOR exit nodes to connect to our network."; #}; /* diff --git a/include/serno.h b/include/serno.h index cf6eb51c..eea15871 100644 --- a/include/serno.h +++ b/include/serno.h @@ -1 +1 @@ -#define SERNO "20070125-3143" +#define SERNO "20070125-3157" diff --git a/include/substitution.h b/include/substitution.h new file mode 100644 index 00000000..1a36433e --- /dev/null +++ b/include/substitution.h @@ -0,0 +1,46 @@ +/* + * charybdis: an advanced ircd + * markup.h: parses markup into human-readable strings + * + * Copyright (c) 2006-2007 William Pitcock + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $Id$ + */ + +#include "stdinc.h" +#include "tools.h" + +#ifndef SUBSTITUTION_H +#define SUBSTITUTION_H + +extern void substitution_append_var(dlink_list *varlist, const char *name, const char *value); +extern void substitution_free(dlink_list *varlist); +extern char *substitution_parse(const char *fmt, dlink_list *varlist); + +#endif diff --git a/src/Makefile.in b/src/Makefile.in index 0306d032..29c47377 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ # # Makefile.in for ircd/src # -# $Id: Makefile.in 1887 2006-08-29 13:42:56Z jilles $ +# $Id: Makefile.in 3159 2007-01-25 07:08:21Z nenolod $ # CC = @CC@ INSTALL = @INSTALL@ @@ -96,6 +96,7 @@ BASE_SRCS = \ scache.c \ send.c \ snomask.c \ + substitution.c \ supported.c \ whowas.c \ $(FNVHASH_S) diff --git a/src/s_conf.c b/src/s_conf.c index 6ca336ab..ca5e414a 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: s_conf.c 3131 2007-01-21 15:36:31Z jilles $ + * $Id: s_conf.c 3159 2007-01-25 07:08:21Z nenolod $ */ #include "stdinc.h" @@ -379,7 +379,7 @@ verify_access(struct Client *client_p, const char *username) if(ConfigFileEntry.kline_with_reason) { sendto_one(client_p, - ":%s NOTICE %s :*** Banned %s", + form_str(ERR_YOUREBANNEDCREEP), me.name, client_p->name, aconf->passwd); } return (BANNED_CLIENT); @@ -390,7 +390,7 @@ verify_access(struct Client *client_p, const char *username) if(ConfigFileEntry.kline_with_reason) sendto_one(client_p, - ":%s NOTICE %s :*** Banned %s", + form_str(ERR_YOUREBANNEDCREEP), me.name, client_p->name, aconf->passwd); return (BANNED_CLIENT); diff --git a/src/s_user.c b/src/s_user.c index 531278ea..9007818d 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: s_user.c 3131 2007-01-21 15:36:31Z jilles $ + * $Id: s_user.c 3159 2007-01-25 07:08:21Z nenolod $ */ #include "stdinc.h" @@ -56,6 +56,7 @@ #include "monitor.h" #include "snomask.h" #include "blacklist.h" +#include "substitution.h" static void report_and_set_user_flags(struct Client *, struct ConfItem *); void user_welcome(struct Client *source_p); @@ -452,10 +453,22 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char source_p->sockhost, source_p->preClient->dnsbl_listed->host); else { + dlink_list varlist; + + substitution_append_var(&varlist, "nick", source_p->name); + substitution_append_var(&varlist, "ip", source_p->sockhost); + substitution_append_var(&varlist, "host", source_p->host); + substitution_append_var(&varlist, "dnsbl-host", source_p->preClient->dnsbl_listed->host); + substitution_append_var(&varlist, "network-name", ServerInfo.network_name); + ServerStats->is_ref++; + sendto_one(source_p, form_str(ERR_YOUREBANNEDCREEP), me.name, source_p->name, - source_p->preClient->dnsbl_listed->reject_reason); + substitution_parse(source_p->preClient->dnsbl_listed->reject_reason, &varlist)); + + substitution_free(&varlist); + sendto_one_notice(source_p, ":*** Your IP address %s is listed in %s", source_p->sockhost, source_p->preClient->dnsbl_listed->host); source_p->preClient->dnsbl_listed->hits++; diff --git a/src/substitution.c b/src/substitution.c new file mode 100644 index 00000000..d0bff4c2 --- /dev/null +++ b/src/substitution.c @@ -0,0 +1,150 @@ +/* + * charybdis: an advanced ircd + * substitution.c: parses substitution-keyword expansions + * + * Copyright (c) 2006-2007 William Pitcock + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $Id$ + */ + +#include "stdinc.h" +#include "tools.h" +#include "balloc.h" +#include "s_user.h" +#include "irc_string.h" + +/* + * Simple mappings for $foo -> 'bar'. + * Everything is a string, so typing doesn't really matter too + * horribly much right now. + */ +struct substitution_variable +{ + char *name; + char *value; +}; + +/* + * substitution_append_var + * + * Inputs - A variable list (dlink_list), name -> value for mapping to make + * Output - none + * Side Effects - Adds a name->value mapping to a list. + */ +void substitution_append_var(dlink_list *varlist, const char *name, const char *value) +{ + struct substitution_variable *tmp = MyMalloc(sizeof(struct substitution_variable)); + + DupString(tmp->name, name); + DupString(tmp->value, value); + + dlinkAddAlloc(tmp, varlist); +} + +/* + * substitution_free + * + * Inputs - A dlink_list of markup variables to free. + * Outputs - none + * Side Effects - Empties a list of markup variables. + */ +void substitution_free(dlink_list *varlist) +{ + dlink_node *nptr, *nptr2; + + DLINK_FOREACH_SAFE(nptr, nptr2, varlist->head) + { + struct substitution_variable *tmp = (struct substitution_variable *) nptr->data; + + dlinkDelete(nptr, varlist); + MyFree(tmp->name); + MyFree(tmp->value); + MyFree(tmp); + } +} + +/* + * substitution_parse + * + * Inputs - A markup string, dlink-list of markup values + * Output - A string which has been markup-replaced. + * Side Effects - Strings larger than BUFSIZE are terminated. + */ +char *substitution_parse(const char *fmt, dlink_list *varlist) +{ + static char buf[BUFSIZE]; + const char *ptr; + char *bptr = buf; + + for (ptr = fmt; *ptr != '\0' && bptr - buf < BUFSIZE; ptr++) + if (*ptr != '$') + *bptr++ = *ptr; + else if (*(ptr + 1) == '{') + { + static char varname[BUFSIZE]; + char *vptr = varname; + const char *pptr; + dlink_node *nptr; + + *vptr = '\0'; + + /* break out ${var} */ + for (pptr = ptr + 2; *pptr != '\0'; pptr++) + { + if (*pptr != '}') + *vptr++ = *pptr; + else + { + *vptr++ = '\0'; + break; + } + } + + s_assert(*varname != '\0'); + s_assert(*pptr != '\0'); + + /* advance ptr by length of variable */ + ptr += (pptr - ptr); + + DLINK_FOREACH(nptr, varlist->head) + { + struct substitution_variable *val = (struct substitution_variable *) nptr->data; + + if (!strcasecmp(varname, val->name)) + { + strlcpy(bptr, val->value, BUFSIZE - (bptr - buf)); + bptr += strlen(val->value); + break; + } + } + } + + *bptr = '\0'; + return buf; +}