added a flags field to SERVER Command to set make it easier to communicate the server options

This commit is contained in:
fishwaldo 2002-09-13 09:17:14 +00:00
parent 30a9a4c616
commit bdf6023ddd
12 changed files with 89 additions and 123 deletions

View file

@ -42,3 +42,4 @@ Symbols are:
(F) - Started to clean up Documentation
(F) - This is version 0.9.1 Getting ready for Beta testing by Closed group.
(F) - Added m_map to core modules
(F) - HiddenServer and Ulined Servers are now set via *nice* Server command (<*optional*prefix*optional*> SERVER <name> <hops> <*new*Flags*new*> :<infoline>)

View file

@ -259,26 +259,16 @@ options that were in config.h, to be changed with a /rehash.
TS - Support the TS protocol
QS - Remove the QUIT storm on splits
EX - Support +e exceptions in channels
CHW - Support PRIVMSG/NOTICE @#channel messages
LL - LazyLink server
IE - Invite Exceptions - +I on channels - All nick!user@hosts listed in
a +I are exempt from having to be invited to the channel before
JOINing
EOB - End of Burst - Marks the end of a servers burst. Will be used in
future to help prevent mode hacking by servers.
KLN - Support remote K-lines
GLN - Support G-lines
KNOCK - Support propogated KNOCK
HOPS - Support half-ops
HUB - Is a hub server (used to prevent two LL hubs from linking in that
state)
AOPS - Supports anonymous channel ops (channel mode +a)
UID - Unique user-ID support
ZIP - Ziplink (Link is compressed with zlib compression)
TBURST - Supports topic bursting, a contrib/ module.
PARA - Controls propogation of INVITE notices for +p (paranoid) channels
ENC:a - Encrypted link, where 'a' is the cipher being used
# $Id: whats-new.txt,v 1.2 2002/08/13 14:45:01 fishwaldo Exp $
# $Id: whats-new.txt,v 1.3 2002/09/13 09:17:13 fishwaldo Exp $

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: channel_mode.h,v 1.7 2002/09/13 06:50:06 fishwaldo Exp $
* $Id: channel_mode.h,v 1.8 2002/09/13 09:17:13 fishwaldo Exp $
*/
@ -28,19 +28,6 @@
#include "config.h" /* config settings */
#include "ircd_defs.h" /* buffer sizes */
/* If the below define is enabled, we will bounce halfops as follows:
* If we receive a halfop for a user, we will check their ->from supports
* CAP_HOPS, if not, we will bounce the mode back as a -h (which will
* be translated to -o for any back down the line not supporting CAP_HOPS).
* If it does, we'll send it as +h to that server, and any others supporting
* CAP_HOPS. All other servers will see a +o.
*
* The first server to find (user_being_halfoped)->from is not capable
* of CAP_HOPS will also send a notice to the user performing the mode
* (if it is indeed a user) informing them why.
*/
#undef BOUNCE_BAD_HOPS
#define MODEBUFLEN 200
/* Maximum mode changes allowed per client, per server is different */

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: s_serv.h,v 1.3 2002/09/13 06:50:06 fishwaldo Exp $
* $Id: s_serv.h,v 1.4 2002/09/13 09:17:13 fishwaldo Exp $
*/
#ifndef INCLUDED_serv_h
@ -47,6 +47,15 @@ struct Client;
struct ConfItem;
struct Channel;
/*
* Server command flags. Decide if a Server is Hidden, or Ulined
*/
#define SERVER_HIDDEN 0x00001
#define SERVER_ULINED 0x00002
/* Capabilities */
struct Capability
{
@ -56,31 +65,19 @@ struct Capability
#define CAP_CAP 0x00000001 /* received a CAP to begin with */
#define CAP_QS 0x00000002 /* Can handle quit storm removal */
#define CAP_EX 0x00000008 /* Can do channel +e exemptions */
#define CAP_CHW 0x00000010 /* Can do channel wall @# */
#define CAP_LL 0x00000020 /* Can do lazy links */
#define CAP_IE 0x00000040 /* Can do invite exceptions */
#define CAP_EOB 0x00000100 /* Can do EOB message */
#define CAP_KLN 0x00000200 /* Can do KLINE message */
#define CAP_GLN 0x00000400 /* Can do GLINE message */
#define CAP_HOPS 0x00000800 /* can do half ops (+h) */
#define CAP_HUB 0x00001000 /* This server is a HUB */
#define CAP_AOPS 0x00002000 /* Can do anon ops (+a) */
#define CAP_UID 0x00004000 /* Can do UIDs */
#define CAP_ZIP 0x00008000 /* Can do ZIPlinks */
#define CAP_ENC 0x00010000 /* Can do ENCrypted links */
#define CAP_KNOCK 0x00020000 /* supports KNOCK */
#define CAP_TBURST 0x00040000 /* supports TBURST */
#define CAP_PARA 0x00080000 /* supports invite broadcasting for +p */
#define CAP_MODEX 0x00100000 /* Supports ModeX */
#define CAP_MASK (CAP_QS | CAP_EX | CAP_CHW | \
CAP_IE | CAP_EOB | CAP_KLN | \
CAP_GLN | CAP_HOPS | CAP_AOPS | \
#define CAP_MASK (CAP_QS | CAP_EOB | \
CAP_UID | CAP_ZIP | CAP_ENC | \
CAP_KNOCK | CAP_PARA | CAP_MODEX)
CAP_PARA)
#ifdef HAVE_LIBZ
#define CAP_ZIP_SUPPORTED CAP_ZIP

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_message.c,v 1.5 2002/09/13 06:50:07 fishwaldo Exp $
* $Id: m_message.c,v 1.6 2002/09/13 09:17:14 fishwaldo Exp $
*/
#include "stdinc.h"
@ -122,7 +122,7 @@ _moddeinit(void)
mod_del_cmd(&notice_msgtab);
}
const char *_version = "$Revision: 1.5 $";
const char *_version = "$Revision: 1.6 $";
#endif
/*
@ -551,14 +551,13 @@ msg_channel_flags(int p_or_n, char *command, struct Client *client_p,
if (chptr->chname[0] == '&')
return;
sendto_channel_remote(source_p, client_p, type, CAP_CHW, CAP_UID, vchan,
sendto_channel_remote(source_p, client_p, type, NOCAPS, CAP_UID, vchan,
":%s %s %c%s :%s", source_p->name, command, c,
vchan->chname, text);
sendto_channel_remote(source_p, client_p, type, CAP_CHW|CAP_UID, NOCAPS, vchan,
sendto_channel_remote(source_p, client_p, type, CAP_UID, NOCAPS, vchan,
":%s %s %c%s :%s", ID(source_p), command, c,
vchan->chname, text);
/* non CAP_CHW servers? */
}
/*

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_server.c,v 1.4 2002/09/13 06:50:07 fishwaldo Exp $
* $Id: m_server.c,v 1.5 2002/09/13 09:17:14 fishwaldo Exp $
*/
#include "stdinc.h"
@ -51,7 +51,7 @@ static void ms_server(struct Client*, struct Client*, int, char **);
static int set_server_gecos(struct Client *, char *);
struct Message server_msgtab = {
"SERVER", 0, 0, 4, 0, MFLG_SLOW | MFLG_UNREG, 0,
"SERVER", 0, 0, 5, 0, MFLG_SLOW | MFLG_UNREG, 0,
{mr_server, m_registered, ms_server, m_registered}
};
@ -67,7 +67,7 @@ _moddeinit(void)
{
mod_del_cmd(&server_msgtab);
}
const char *_version = "$Revision: 1.4 $";
const char *_version = "$Revision: 1.5 $";
#endif
int bogus_host(char *host);
@ -77,8 +77,9 @@ struct Client *server_exists(char *);
* mr_server - SERVER message handler
* parv[0] = sender prefix
* parv[1] = servername
* parv[2] = serverinfo/hopcount
* parv[3] = serverinfo
* parv[2] = hopcount
* parv[3] = server flags
* parv[4] = serverinfo
*/
static void mr_server(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
@ -87,6 +88,7 @@ static void mr_server(struct Client *client_p, struct Client *source_p,
char *name;
struct Client *target_p;
int hop;
unsigned int srvopt;
if (parc < 4)
{
@ -97,7 +99,8 @@ static void mr_server(struct Client *client_p, struct Client *source_p,
name = parv[1];
hop = atoi(parv[2]);
strlcpy(info, parv[3], REALLEN);
srvopt = atoi(parv[3]);
strlcpy(info, parv[4], REALLEN);
/*
* Reject a direct nonTS server connection if we're TS_ONLY -orabidoo
@ -246,12 +249,14 @@ static void mr_server(struct Client *client_p, struct Client *source_p,
strlcpy(client_p->name, name, HOSTLEN+1);
/* clear the Ulined flag before looking into the info field for (U) (dynamic Uline) */
/* clear the Ulined flag */
client_p->flags &= ~FLAGS_ULINED;
if (srvopt && SERVER_HIDDEN) client_p->hidden_server = 1;
set_server_gecos(client_p, info);
/* if this server is trying to set itself Ulined, its Not allowed, so exit it */
if (IsUlined(client_p)) {
if (srvopt && SERVER_ULINED) {
sendto_realops_flags(FLAGS_ALL, L_ALL, "Server %s trying to U line itself. No Way, Nadda, I dun think so", client_p->name);
exit_client(client_p, client_p, client_p, "Got a Gline Instead");
return;
@ -266,8 +271,9 @@ static void mr_server(struct Client *client_p, struct Client *source_p,
* ms_server - SERVER message handler
* parv[0] = sender prefix
* parv[1] = servername
* parv[2] = serverinfo/hopcount
* parv[3] = serverinfo
* parv[2] = hopcount
* parv[3] = server flags
* parv[4] = serverinfo
*/
static void ms_server(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
@ -282,6 +288,7 @@ static void ms_server(struct Client *client_p, struct Client *source_p,
int hlined = 0;
int llined = 0;
dlink_node *ptr;
unsigned int srvopt;
/* Just to be sure -A1kmm. */
if (!IsServer(source_p))
@ -295,7 +302,8 @@ static void ms_server(struct Client *client_p, struct Client *source_p,
name = parv[1];
hop = atoi(parv[2]);
strlcpy(info, parv[3], REALLEN);
srvopt = atoi(parv[3]);
strlcpy(info, parv[4], REALLEN);
if ((target_p = server_exists(name)))
{
@ -490,7 +498,10 @@ static void ms_server(struct Client *client_p, struct Client *source_p,
strlcpy(target_p->name, name, HOSTLEN+1);
/* clear the Ulined flag before we look at info for (U) */
target_p->flags &= ~FLAGS_ULINED;
if (srvopt && SERVER_ULINED) target_p->flags |= FLAGS_ULINED;
if (srvopt && SERVER_HIDDEN) target_p->hidden_server = 1;
set_server_gecos(target_p, info);
@ -533,10 +544,12 @@ static void ms_server(struct Client *client_p, struct Client *source_p,
}
if (match(my_name_for_link(me.name, aconf), target_p->name))
continue;
sendto_one(bclient_p, ":%s SERVER %s %d :%s%s",
srvopt = 0;
if (IsUlined(target_p)) srvopt |= SERVER_ULINED;
if (target_p->hidden_server) srvopt |= SERVER_HIDDEN;
sendto_one(bclient_p, ":%s SERVER %s %d %d :%s",
parv[0], target_p->name, hop + 1,
target_p->hidden_server ? "(H) " : "",
srvopt,
target_p->info);
}
@ -588,30 +601,6 @@ static int set_server_gecos(struct Client *client_p, char *info)
if((p = strchr(s, ' ')))
*p = '\0';
/* check for (H) which is a hidden server */
if(!strcmp(s, "(H)"))
{
client_p->hidden_server = 1;
/* if there was no space.. theres nothing to set info to */
if(p)
s = ++p;
else
s = NULL;
}
/* check for (U) which is a U lined Server */
if (!strcmp(s, "(U)"))
{
SetUlined(client_p);
if(p)
s = ++p;
else
s = NULL;
}
else if(p)
*p = ' ';
/* if there was a trailing space, s could point to \0, so check */
if(s && (*s != '\0'))
strlcpy(client_p->info, s, REALLEN);

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_gline.c,v 1.5 2002/09/13 06:50:06 fishwaldo Exp $
* $Id: m_gline.c,v 1.6 2002/09/13 09:17:13 fishwaldo Exp $
*/
#include "stdinc.h"
@ -95,7 +95,7 @@ _moddeinit(void)
mod_del_cmd(&gline_msgtab[1]);
}
const char *_version = "$Revision: 1.5 $";
const char *_version = "$Revision: 1.6 $";
#endif
/*
* mo_gline()
@ -196,11 +196,11 @@ mo_gline(struct Client *client_p, struct Client *source_p,
log_gline(source_p->name, source_p->username, source_p->host, me.name, user, host, reason);
/* 4 param version for hyb-7 servers */
sendto_server(NULL, source_p, NULL, CAP_GLN|CAP_UID, NOCAPS,
sendto_server(NULL, source_p, NULL, CAP_UID, NOCAPS,
LL_ICLIENT,
":%s GLINE %s %s :%s",
ID(source_p), user, host, reason);
sendto_server(NULL, source_p, NULL, CAP_GLN, CAP_UID,
sendto_server(NULL, source_p, NULL, NOCAPS, CAP_UID,
LL_ICLIENT,
":%s GLINE %s %s :%s",
source_p->name, user, host, reason);
@ -274,7 +274,7 @@ static void ms_gline(struct Client *client_p,
return;
/* send in hyb-7 to compatable servers */
sendto_server(client_p, acptr, NULL, CAP_GLN, NOCAPS, LL_ICLIENT,
sendto_server(client_p, acptr, NULL, NOCAPS, NOCAPS, LL_ICLIENT,
":%s GLINE %s %s :%s",
oper_nick, user, host, reason);
if (ConfigFileEntry.glines)

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_kline.c,v 1.6 2002/09/13 06:50:06 fishwaldo Exp $
* $Id: m_kline.c,v 1.7 2002/09/13 09:17:13 fishwaldo Exp $
*/
#include "stdinc.h"
@ -86,7 +86,7 @@ _moddeinit(void)
mod_del_cmd(&dline_msgtab[0]);
mod_del_cmd(&dline_msgtab[1]);
}
const char *_version = "$Revision: 1.6 $";
const char *_version = "$Revision: 1.7 $";
#endif
/* Local function prototypes */
@ -218,7 +218,7 @@ mo_kline(struct Client *client_p, struct Client *source_p,
if (target_server != NULL)
{
sendto_server(NULL, source_p, NULL, CAP_KLN, NOCAPS, LL_ICLIENT,
sendto_server(NULL, source_p, NULL, NOCAPS, NOCAPS, LL_ICLIENT,
":%s KLINE %s %lu %s %s :%s",
source_p->name,
target_server,
@ -287,7 +287,7 @@ ms_kline(struct Client *client_p, struct Client *source_p,
/* parv[0] parv[1] parv[2] parv[3] parv[4] parv[5] */
/* oper target_server tkline_time user host reason */
sendto_server(client_p, source_p, NULL, CAP_KLN, NOCAPS, LL_ICLIENT,
sendto_server(client_p, source_p, NULL, NOCAPS, NOCAPS, LL_ICLIENT,
":%s KLINE %s %s %s %s :%s",
parv[0], parv[1], parv[2], parv[3], parv[4], parv[5]);

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_knock.c,v 1.5 2002/09/13 06:50:06 fishwaldo Exp $
* $Id: m_knock.c,v 1.6 2002/09/13 09:17:13 fishwaldo Exp $
*/
#include "stdinc.h"
@ -80,7 +80,7 @@ _moddeinit(void)
mod_del_cmd(&knockll_msgtab);
}
const char *_version = "$Revision: 1.5 $";
const char *_version = "$Revision: 1.6 $";
#endif
/* m_knock
@ -344,7 +344,7 @@ static void send_knock(struct Client *client_p, struct Client *source_p,
source_p->username,
source_p->vhost);
sendto_server(client_p, source_p, chptr, CAP_KNOCK, NOCAPS, LL_ICLIENT,
sendto_server(client_p, source_p, chptr, NOCAPS, NOCAPS, LL_ICLIENT,
":%s KNOCK %s %s",
source_p->name, name, key ? key : "");
}

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: channel.c,v 1.6 2002/09/13 06:50:08 fishwaldo Exp $
* $Id: channel.c,v 1.7 2002/09/13 09:17:14 fishwaldo Exp $
*/
#include "stdinc.h"
@ -341,11 +341,9 @@ send_channel_modes(struct Client *client_p, struct Channel *chptr)
send_mode_list(client_p, chptr->chname, &chptr->banlist, 'b', 0);
if (IsCapable(client_p, CAP_EX))
send_mode_list(client_p, chptr->chname, &chptr->exceptlist, 'e', 0);
send_mode_list(client_p, chptr->chname, &chptr->exceptlist, 'e', 0);
if (IsCapable(client_p, CAP_IE))
send_mode_list(client_p, chptr->chname, &chptr->invexlist, 'I', 0);
send_mode_list(client_p, chptr->chname, &chptr->invexlist, 'I', 0);
}
/*

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: s_serv.c,v 1.9 2002/09/13 06:50:08 fishwaldo Exp $
* $Id: s_serv.c,v 1.10 2002/09/13 09:17:14 fishwaldo Exp $
*/
#include "stdinc.h"
@ -88,22 +88,13 @@ static SlinkRplHnd slink_zipstats;
struct Capability captab[] = {
/* name cap */
{ "QS", CAP_QS },
{ "EX", CAP_EX },
{ "CHW", CAP_CHW },
{ "LL", CAP_LL },
{ "IE", CAP_IE },
{ "EOB", CAP_EOB },
{ "KLN", CAP_KLN },
{ "GLN", CAP_GLN },
{ "KNOCK", CAP_KNOCK },
{ "HOPS", CAP_HOPS },
{ "HUB", CAP_HUB },
{ "AOPS", CAP_AOPS },
{ "UID", CAP_UID },
{ "ZIP", CAP_ZIP },
{ "TBURST", CAP_TBURST },
{ "PARA", CAP_PARA },
{ "MX", CAP_MODEX},
{ 0, 0 }
};
@ -945,6 +936,7 @@ int server_estab(struct Client *client_p)
char* host;
dlink_node *m;
dlink_node *ptr;
unsigned int srvopt;
assert(NULL != client_p);
if(client_p == NULL)
@ -1008,9 +1000,12 @@ int server_estab(struct Client *client_p)
| ((aconf->flags & CONF_FLAGS_COMPRESSED) ? CAP_ZIP_SUPPORTED : 0),
0);
sendto_one(client_p, "SERVER %s 1 :%s%s",
srvopt = 0;
if (ConfigServerHide.hidden) srvopt = SERVER_HIDDEN;
sendto_one(client_p, "SERVER %s 1 %d :%s",
my_name_for_link(me.name, aconf),
ConfigServerHide.hidden ? "(H) " : "",
srvopt,
(me.info[0]) ? (me.info) : "IRCers United");
}
@ -1151,10 +1146,14 @@ int server_estab(struct Client *client_p)
if ((aconf = target_p->serv->sconf) &&
match(my_name_for_link(me.name, aconf), client_p->name))
continue;
sendto_one(target_p,":%s SERVER %s 2 :%s%s%s",
srvopt = 0;
if (IsUlined(client_p)) srvopt |= SERVER_ULINED;
if (client_p->hidden_server) srvopt |= SERVER_HIDDEN;
sendto_one(target_p,":%s SERVER %s 2 %d :%s",
me.name, client_p->name,
client_p->hidden_server ? "(H) " : "",
IsUlined(client_p) ? "(U) " : "",
srvopt,
client_p->info);
}
@ -1187,11 +1186,14 @@ int server_estab(struct Client *client_p)
{
if (match(my_name_for_link(me.name, aconf), target_p->name))
continue;
sendto_one(client_p, ":%s SERVER %s %d :%s%s%s",
srvopt = 0;
if (IsUlined(target_p)) srvopt |= SERVER_ULINED;
if (target_p->hidden_server) srvopt |= SERVER_HIDDEN;
sendto_one(client_p, ":%s SERVER %s %d %d :%s",
target_p->serv->up,
target_p->name, target_p->hopcount+1,
target_p->hidden_server ? "(H) " : "",
IsUlined(target_p) ? "(U) " : "",
srvopt,
target_p->info);
}
}
@ -2104,6 +2106,7 @@ serv_connect_callback(int fd, int status, void *data)
{
struct Client *client_p = data;
struct ConfItem *aconf;
unsigned int srvopt;
/* First, make sure its a real client! */
assert(client_p != NULL);
@ -2176,9 +2179,11 @@ serv_connect_callback(int fd, int status, void *data)
| (ServerInfo.hub ? CAP_HUB : 0),
0);
sendto_one(client_p, "SERVER %s 1 :%s%s",
srvopt = 0;
if (ConfigServerHide.hidden) srvopt = SERVER_HIDDEN;
sendto_one(client_p, "SERVER %s 1 %d :%s",
my_name_for_link(me.name, aconf),
ConfigServerHide.hidden ? "(H) " : "",
srvopt,
me.info);
/*

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: s_user.c,v 1.10 2002/09/13 06:50:09 fishwaldo Exp $
* $Id: s_user.c,v 1.11 2002/09/13 09:17:14 fishwaldo Exp $
*/
#include "stdinc.h"
@ -1139,7 +1139,7 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, char *parv
* only send out a sethost if +x mode was added
*/
if (!(setflags & FLAGS_HIDDEN) && IsHidden(target_p)) {
sendto_server(NULL, target_p, NULL, CAP_MODEX, 0, LL_ICLIENT, ":%s SETHOST %s :%s", target_p->name, target_p->name, target_p->vhost);
sendto_server(NULL, target_p, NULL, NOCAPS, NOCAPS, LL_ICLIENT, ":%s SETHOST %s :%s", target_p->name, target_p->name, target_p->vhost);
ilog(L_WARN, "Sending sethost for %s", target_p->name);
}