This patch adds support for hyb6 servers to *propagate* remote klines, remote unklines and ENCAP. It doesnt allow users to set remote klines. This patch CANNOT be used with SLAVE_SERVERS. Most useful for a hub, as it means two servers around the hub can send klines to each other, and it will propagate ENCAP. -- Lee H diff -urN ircd-hybrid-6.3.1/include/m_commands.h ircd-hybrid-6.3.1+klnencap/include/m_commands.h --- ircd-hybrid-6.3.1/include/m_commands.h 2001-11-29 06:28:23.000000000 +0000 +++ ircd-hybrid-6.3.1+klnencap/include/m_commands.h 2003-06-28 21:27:37.000000000 +0100 @@ -39,7 +39,7 @@ extern int m_ungline(struct Client *,struct Client *,int,char **); extern int m_locops(struct Client *,struct Client *,int,char **); - +extern int m_encap(struct Client *,struct Client *,int,char **); extern int m_private(struct Client *,struct Client *,int,char **); extern int m_knock(struct Client *,struct Client *,int,char **); extern int m_topic(struct Client *,struct Client *,int,char **); diff -urN ircd-hybrid-6.3.1/include/msg.h ircd-hybrid-6.3.1+klnencap/include/msg.h --- ircd-hybrid-6.3.1/include/msg.h 2001-12-08 02:38:15.000000000 +0000 +++ ircd-hybrid-6.3.1+klnencap/include/msg.h 2003-06-28 21:28:34.000000000 +0100 @@ -128,6 +128,7 @@ #endif /* LWALLOPS */ #define MSG_KNOCK "KNOCK" /* KNOCK */ +#define MSG_ENCAP "ENCAP" #define MAXPARA 15 @@ -253,6 +254,7 @@ { MSG_HTM, m_htm, 0, MAXPARA, 1, 0, 0, 0L }, { MSG_SET, m_set, 0, MAXPARA, 1, 0, 0, 0L }, { MSG_TESTLINE, m_testline, 0, MAXPARA, 1, 0, 0, 0L }, + { MSG_ENCAP, m_encap, 0, MAXPARA, 1, 0, 0, 0L }, { (char *) 0, (int (*)()) 0 , 0, 0, 0, 0, 0, 0L } }; diff -urN ircd-hybrid-6.3.1/include/s_serv.h ircd-hybrid-6.3.1+klnencap/include/s_serv.h --- ircd-hybrid-6.3.1/include/s_serv.h 2001-12-09 19:02:09.000000000 +0000 +++ ircd-hybrid-6.3.1+klnencap/include/s_serv.h 2003-06-28 21:29:07.000000000 +0100 @@ -44,7 +44,10 @@ #define CAP_ZIP 0x00000004 /* Can do server compresion */ #define CAP_EX 0x00000008 /* Can do channel +e exemptions */ #define CAP_CHW 0x00000010 /* Can do channel wall @# */ -#define CAP_KNOCK 0x00000020 +#define CAP_KNOCK 0x00000020 +#define CAP_KLN 0x00000040 +#define CAP_UNKLN 0x00000080 +#define CAP_ENCAP 0x00000100 #define DoesCAP(x) ((x)->caps) diff -urN ircd-hybrid-6.3.1/src/Makefile.in ircd-hybrid-6.3.1+klnencap/src/Makefile.in --- ircd-hybrid-6.3.1/src/Makefile.in 2001-12-07 04:13:29.000000000 +0000 +++ ircd-hybrid-6.3.1+klnencap/src/Makefile.in 2003-06-28 21:33:43.000000000 +0100 @@ -38,6 +38,7 @@ m_close.c \ m_connect.c \ m_die.c \ + m_encap.c \ m_error.c \ m_gline.c \ m_htm.c \ diff -urN ircd-hybrid-6.3.1/src/m_encap.c ircd-hybrid-6.3.1+klnencap/src/m_encap.c --- ircd-hybrid-6.3.1/src/m_encap.c 1970-01-01 01:00:00.000000000 +0100 +++ ircd-hybrid-6.3.1+klnencap/src/m_encap.c 2003-06-28 21:33:20.000000000 +0100 @@ -0,0 +1,86 @@ +/* modules/m_encap.c + * Copyright (C) 2003 ircd-ratbox development team + * Copyright (C) 2003 Lee Hardy + * + * Parts taken from the +fr patch by W. Jami Campbell + * + * 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: m_encap.c,v 1.7 2003/06/25 07:56:36 leeh Exp $ + */ + +#include +#include "ircd.h" +#include "config.h" +#include "client.h" +#include "send.h" +#include "s_conf.h" +#include "s_serv.h" +#include "m_commands.h" + +int +m_encap(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) +{ + char buffer[BUFSIZE]; + char *ptr; + int cur_len = 0; + int len; + int i; + + if(!IsServer(cptr)) + return 0; + + ptr = buffer; + + for(i = 1; i < parc - 1; i++) + { + len = strlen(parv[i]) + 1; + + /* ugh, not even at the last parameter, just bail --fl */ + if((size_t)(cur_len + len) >= sizeof(buffer)) + return; + + snprintf(ptr, sizeof(buffer) - cur_len, "%s ", parv[i]); + cur_len += len; + ptr += len; + } + + len = strlen(parv[i]); + + /* if its a command without parameters, dont prepend a ':' */ + if(parc == 3) + snprintf(ptr, sizeof(buffer) - cur_len, "%s", parv[2]); + else + snprintf(ptr, sizeof(buffer) - cur_len, ":%s", parv[parc-1]); + + /* add a trailing \0 if it was too long */ + if((cur_len + len) >= BUFSIZE) + buffer[BUFSIZE-1] = '\0'; + + sendto_match_cap_servs(NULL, cptr, CAP_ENCAP, + ":%s ENCAP %s", + parv[0], buffer); +} + diff -urN ircd-hybrid-6.3.1/src/m_kline.c ircd-hybrid-6.3.1+klnencap/src/m_kline.c --- ircd-hybrid-6.3.1/src/m_kline.c 2001-12-15 02:42:04.000000000 +0000 +++ ircd-hybrid-6.3.1+klnencap/src/m_kline.c 2003-06-28 21:36:19.000000000 +0100 @@ -36,6 +36,7 @@ #include "s_conf.h" #include "s_log.h" #include "s_misc.h" +#include "s_serv.h" #include "send.h" #include "struct.h" #include "hash.h" @@ -466,6 +467,17 @@ else #endif { + if(IsServer(cptr)) + { + if(parc == 6) + sendto_match_cap_servs(NULL, sptr, CAP_KLN, + ":%s KLINE %s %s %s %s :%s", + parv[0], parv[1], parv[2], parv[3], + parv[4], parv[5]); + return 0; + } + else + { if (!MyClient(sptr) || !IsAnOper(sptr)) { sendto_one(sptr, form_str(ERR_NOPRIVILEGES), me.name, parv[0]); @@ -488,7 +500,8 @@ #ifdef SLAVE_SERVERS sendto_slaves(NULL,"KLINE",sptr->name,parc,parv); #endif - } + } + } argv = parv[1]; diff -urN ircd-hybrid-6.3.1/src/m_unkline.c ircd-hybrid-6.3.1+klnencap/src/m_unkline.c --- ircd-hybrid-6.3.1/src/m_unkline.c 2002-02-17 05:58:13.000000000 +0000 +++ ircd-hybrid-6.3.1+klnencap/src/m_unkline.c 2003-06-28 21:36:58.000000000 +0100 @@ -36,6 +36,7 @@ #include "s_conf.h" #include "s_log.h" #include "s_misc.h" +#include "s_serv.h" #include "send.h" #include "struct.h" #ifdef GLINES @@ -85,7 +86,16 @@ ircsprintf(temppath, "%s%s.tmp", ConfigFileEntry.dpath, ConfigFileEntry.klinefile); - + + if(IsServer(cptr)) + { + if(parc == 4) + sendto_match_cap_servs(NULL, cptr, CAP_UNKLN, + ":%s UNKLINE %s %s %s", + parv[0], parv[1], parv[2], parv[3]); + return 0; + } + if (check_registered(sptr)) { return -1; diff -urN ircd-hybrid-6.3.1/src/s_serv.c ircd-hybrid-6.3.1+klnencap/src/s_serv.c --- ircd-hybrid-6.3.1/src/s_serv.c 2002-04-15 23:38:22.000000000 +0100 +++ ircd-hybrid-6.3.1+klnencap/src/s_serv.c 2003-06-28 21:29:33.000000000 +0100 @@ -74,6 +74,9 @@ { "EX", CAP_EX }, { "CHW", CAP_CHW }, { "KNOCK", CAP_KNOCK }, + { "KLN", CAP_KLN }, + { "UNKLN", CAP_UNKLN }, + { "ENCAP", CAP_ENCAP }, { 0, 0 } };