-2000-10-30 Isomer <isomer@coders.net>
+2000-11-19 Isomer <isomer@coders.net>
+ * ircd/ircd_reply.c: added 'protocol_violation', thus alerting us
+ to problems in the server<->server protocol.
+
+ * ircd/m_connect.c: allow remote connects with a port of '0'
+ meaning to use the port in the config file.
+
+ * ircd/m_create.c: Enable hacking protection, lets see how far we
+ get.
+
+ * ircd/m_error.c: The RFC says never accept ERROR from unreg'd
+ clients, so we don't any more.
+
+ * ircd/m_kill.c: The kill path is now made up of numnicks of servers,
+ and the user@host is displayed of the victim.
+
+ * ircd/m_map.c: reloaded 'dump_map'.
+
+ * ircd/m_trace.c: allow per class T:
+
+ * ircd/m_stats.c: allow local opers /remote stats anywhere on the 'net.
+
+2000-11-17 Isomer <isomer@coders.net>
* ircd/m_topic.c: Fixed bug where we'd only send to clients topics
that were the *same* instead of different. Oh the embarrasment!
# It is possible to show a different Message of the Day to a connecting
# client depending on its origin.
# T:<hostmask>:<path to motd file>
+# or:
+# T:<classnumber>:<path to motd file>
#
# DPATH/net_com.motd contains a special MOTD where users are encouraged
# to register their domains and get their own I: lines if they're in
a new connection to another server immediately. CONNECT is a
privileged command and is to be available only to IRC Operators. If
a remote server is given then the CONNECT attempt is made by that
- server to <target server> and <port>.
+ server to <target server> and <port>. A port of 0 means use the default
+ port number. Most errors are reported in notice's.
Numeric Replies:
extern int m_notice(struct Client*, struct Client*, int, char*[]);
extern int m_oper(struct Client*, struct Client*, int, char*[]);
extern int m_part(struct Client*, struct Client*, int, char*[]);
-extern int m_pass(struct Client*, struct Client*, int, char*[]);
+extern int mr_pass(struct Client*, struct Client*, int, char*[]);
extern int m_ping(struct Client*, struct Client*, int, char*[]);
extern int m_pong(struct Client*, struct Client*, int, char*[]);
extern int m_private(struct Client*, struct Client*, int, char*[]);
struct Client;
+extern int protocol_violation(struct Client* cptr, const char* pattern, ...);
extern int need_more_params(struct Client* cptr, const char* cmd);
extern int send_error_to_client(struct Client* cptr, int error, ...);
extern int send_reply(struct Client* to, int reply, ...);
+++ /dev/null
-/*
- * map.h
- *
- * $Id$
- */
-#ifndef INCLUDED_map_h
-#define INCLUDED_map_h
-
-struct Client;
-
-/*
- * Prototypes
- */
-
-void dump_map(struct Client *cptr, struct Client *server, char *mask, int prompt_length);
-
-#endif /* INCLUDED_map_h */
m_who.c \
m_whois.c \
m_whowas.c \
- map.c \
match.c \
numnicks.c \
opercmds.c \
../include/ircd_defs.h ../include/dbuf.h ../include/ircd_handler.h \
../include/ircd.h ../config/config.h ../config/setup.h \
../include/struct.h ../include/ircd_snprintf.h ../include/numeric.h \
- ../include/s_conf.h ../include/s_debug.h ../include/send.h
+ ../include/msg.h ../include/s_conf.h ../include/s_debug.h \
+ ../include/send.h
ircd_signal.o: ircd_signal.c ../include/ircd_signal.h \
../include/ircd.h ../config/config.h ../config/setup.h \
../include/struct.h ../include/ircd_defs.h
../include/dbuf.h ../include/ircd_handler.h ../include/ircd.h \
../config/config.h ../config/setup.h ../include/struct.h \
../include/ircd_reply.h ../include/ircd_string.h \
- ../include/ircd_chattr.h ../include/map.h ../include/numeric.h \
- ../include/send.h
+ ../include/ircd_chattr.h ../include/numeric.h ../include/send.h
m_mode.o: m_mode.c ../include/handlers.h ../include/channel.h \
../config/config.h ../config/setup.h ../include/ircd_defs.h \
../include/client.h ../include/dbuf.h ../include/ircd_handler.h \
../include/ircd_chattr.h ../include/msg.h ../include/numeric.h \
../include/numnicks.h ../include/s_user.h ../include/s_misc.h \
../include/send.h ../include/whowas.h
-map.o: map.c ../include/map.h ../include/client.h \
- ../include/ircd_defs.h ../include/dbuf.h ../include/ircd_handler.h \
- ../include/ircd.h ../config/config.h ../config/setup.h \
- ../include/struct.h ../include/ircd_reply.h ../include/list.h \
- ../include/match.h ../include/numeric.h ../include/numnicks.h \
- ../include/querycmds.h ../include/send.h
match.o: match.c ../include/match.h ../include/ircd_chattr.h
numnicks.o: numnicks.c ../include/numnicks.h ../include/client.h \
../include/ircd_defs.h ../include/dbuf.h ../include/ircd_handler.h \
../include/ircd.h ../config/config.h ../config/setup.h \
../include/struct.h ../include/ircd_chattr.h ../include/parse.h \
../include/s_bsd.h ../include/s_misc.h ../include/send.h
-parse.o: parse.c ../include/parse.h ../include/client.h \
- ../include/ircd_defs.h ../include/dbuf.h ../include/ircd_handler.h \
- ../include/channel.h ../config/config.h ../config/setup.h \
- ../include/handlers.h ../include/hash.h ../include/ircd.h \
- ../include/struct.h ../include/ircd_alloc.h ../include/fda.h \
- ../include/ircd_chattr.h ../include/ircd_reply.h \
- ../include/ircd_string.h ../include/map.h ../include/msg.h \
- ../include/numeric.h ../include/numnicks.h ../include/opercmds.h \
- ../include/querycmds.h ../include/res.h ../include/s_bsd.h \
- ../include/s_conf.h ../include/s_debug.h ../include/s_misc.h \
- ../include/s_numeric.h ../include/s_user.h ../include/send.h \
- ../include/sys.h ../include/whocmds.h ../include/whowas.h
querycmds.o: querycmds.c ../include/querycmds.h
random.o: random.c ../include/random.h ../config/config.h \
../config/setup.h
#include "ircd.h"
#include "ircd_snprintf.h"
#include "numeric.h"
+#include "msg.h"
#include "s_conf.h"
#include "s_debug.h"
#include "send.h"
#include <assert.h>
#include <string.h>
+/* Report a protocol violation warning to anyone listening. This can be
+ * easily used to cleanup the last couple of parts of the code up.
+ */
+
+int protocol_violation(struct Client* cptr, const char* pattern, ...)
+{
+ va_list vl;
+ char buffer[512];
+ assert(pattern);
+ assert(cptr);
+ va_start(vl,pattern);
+ ircd_snprintf(0,buffer,sizeof(buffer)-2,
+ "Protocol Violation from %C: %v",vl);
+ sendcmdto_flag_butone(&me, CMD_DESYNCH, NULL, FLAGS_DEBUG,
+ ":%s", cptr, buffer);
+ va_end(vl);
+ return 0;
+}
+
int need_more_params(struct Client* cptr, const char* cmd)
{
+ if (!MyUser(cptr))
+ protocol_violation(cptr,"Not enough parameters for %s",cmd);
send_reply(cptr, ERR_NEEDMOREPARAMS, cmd);
return 0;
}
* servers can't set away
*/
if (IsServer(sptr))
- return 0;
+ return protocol_violation(sptr,"Server trying to set itself away");
if (user_set_away(sptr->user, away_message))
sendcmdto_serv_butone(sptr, CMD_AWAY, cptr, ":%s", away_message);
char modestr[IRC_BUFSIZE], nickstr[IRC_BUFSIZE], banstr[IRC_BUFSIZE];
if (parc < 4)
- return 0;
+ return protocol_violation(sptr,"Too few parameters for BURST");
if (!IsBurst(sptr)) /* don't allow BURST outside of burst */
return exit_client_msg(cptr, cptr, &me, "HACK: BURST message outside "
if (parc < 3)
return need_more_params(sptr, "CLEARMODE");
- if (!IsPrivileged(sptr))
+ if (!IsPrivileged(sptr)) {
+ protocol_violation(sptr,"No priviledges on source for CLEARMODE, desync?");
return send_reply(sptr, ERR_NOPRIVILEGES);
+ }
if (!IsChannelName(parv[1]) || IsLocalChannel(parv[1]) ||
!(chptr = FindChannel(parv[1])))
sptr, JupeServer(ajupe), JupeReason(ajupe));
return 0;
}
+
+ /*
+ * Allow opers to /connect foo.* 0 bah.* to connect foo and bah
+ * using the conf's configured port
+ */
+#if 0
/*
* Get port number from params, port must be non-zero if it comes from a
* server.
sptr);
return 0;
}
+#endif
+ port = atoi(parv[2]);
/*
* save the old port
*/
tmpport = aconf->port;
- aconf->port = port;
+ if (port) {
+ aconf->port = port;
+ }
+ else {
+ port = aconf->port;
+ }
/*
* Notify all operators about remote connect requests
*/
#include "numeric.h"
#include "numnicks.h"
#include "s_debug.h"
+#include "s_user.h"
#include "send.h"
#include <assert.h>
struct ModeBuf mbuf; /* a mode buffer */
int badop; /* a flag */
- if (IsServer(sptr)) {
- Debug((DEBUG_ERROR, "%s tried to CREATE a channel", sptr->name));
- return 0;
- }
+ if (IsServer(sptr))
+ return protocol_violation(sptr,"%s tried to CREATE a channel", sptr->name);
/* sanity checks: Only accept CREATE messages from servers */
if (parc < 3 || *parv[2] == '\0')
- return 0;
+ return need_more_params(sptr,"CREATE");
chanTS = atoi(parv[2]);
MAGIC_REMOTE_JOIN_TS != chanTS)
sptr->user->server->serv->lag = TStime() - chanTS;
-#if 0
+#if 1
/* If this server is >5 minutes fast, squit it */
if (TStime() - chanTS<-5*60*60)
return exit_client(sptr,sptr,"Timestamp Drift/Bogus TS");
-
+#endif
+#if 0
/* If we recieve a CREATE for a channel from a server before that server
* was linked, then it's a HACK
*/
assert(IsServer(cptr));
if (parc < 3 || EmptyString(parv[2]))
- return 0;
-
- /* sanity checks: Only accept DESTRUCT messages from servers */
- if (!IsServer(sptr))
- return 0;
+ return need_more_params(sptr,"DESTRUCT");
/* Don't pass on DESTRUCT messages for channels that exist */
if (FindChannel(parv[1]))
*/
int ms_desynch(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
- if (IsServer(sptr) && parc >= 2)
+ if (parc >= 2)
sendcmdto_flag_butone(sptr, CMD_DESYNCH, cptr, FLAGS_DEBUG, ":%s",
parv[parc - 1]);
+ else
+ need_more_params(sptr,"DESYNCH");
return 0;
}
assert(0 != cptr);
assert(0 != sptr);
- if (!IsServer(sptr))
- return 0;
- sendto_opmask_butone(0, SNO_NETWORK, "Completed net.burst from %C.", sptr);
+ sendto_opmask_butone(0, SNO_NETWORK, "Completed net.burst from %C.",
+ sptr);
sendcmdto_serv_butone(sptr, CMD_END_OF_BURST, cptr, "");
ClearBurst(sptr);
SetBurstAck(sptr);
para = (parc > 1 && *parv[parc - 1] != '\0') ? parv[parc - 1] : "<>";
Debug((DEBUG_ERROR, "Received ERROR message from %s: %s", sptr->name, para));
- /*
- * Ignore error messages generated by normal user clients
- * (because ill-behaving user clients would flood opers
- * screen otherwise). Pass ERROR's from other sources to
- * the local operator...
- */
- if (IsUser(cptr))
- return 0;
- if (IsUnknown(cptr))
- return exit_client_msg(cptr, cptr, &me, "Register first");
-
- if (cptr == sptr)
- sendto_opmask_butone(0, SNO_OLDSNO, "ERROR :from %C -- %s", cptr, para);
- else
- sendto_opmask_butone(0, SNO_OLDSNO, "ERROR :from %C via %C -- %s", sptr,
- cptr, para);
-
- if (sptr->serv)
- {
- MyFree(sptr->serv->last_error_msg);
- DupString(sptr->serv->last_error_msg, para);
- }
-
- return 0;
-}
-
-/*
- * mr_error - registration message handler
- *
- * parv[0] = sender prefix
- * parv[parc-1] = text
- */
-int mr_error(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
-{
- const char *para;
-
- para = (parc > 1 && *parv[parc - 1] != '\0') ? parv[parc - 1] : "<>";
-
- Debug((DEBUG_ERROR, "Received ERROR message from %s: %s", sptr->name, para));
- /*
- * Ignore error messages generated by normal user clients
- * (because ill-behaving user clients would flood opers
- * screen otherwise). Pass ERROR's from other sources to
- * the local operator...
- */
- if (IsUser(cptr))
- return 0;
- if (IsUnknown(cptr))
- return exit_client_msg(cptr, cptr, &me, "Register first");
if (cptr == sptr)
sendto_opmask_butone(0, SNO_OLDSNO, "ERROR :from %C -- %s", cptr, para);
send_reply(cptr, RPL_ENDOFINVITELIST);
return 0;
}
-
+
if (parc < 3 || EmptyString(parv[2]))
return need_more_params(sptr, "INVITE");
* this will blow up if we get an invite from a server
* we look for channel membership in sptr below.
*/
- /* PROTOCOL WARNING */
- return 0;
+ return protocol_violation(sptr,"Server attempting to invite");
}
if (parc < 3 || EmptyString(parv[2])) {
/*
* should have been handled upstream, ignore it.
*/
- /* PROTOCOL WARNING */
- return 0;
+ return need_more_params(sptr,"INVITE");
}
if ('#' != *parv[2]) {
/*
* should not be sent
*/
- /* PROTOCOL WARNING */
- return 0;
+ return protocol_violation(sptr, "Invite to a non-standard channel %s",parv[2]);
}
if (!(acptr = FindUser(parv[1]))) {
send_reply(sptr, ERR_NOSUCHNICK, parv[1]);
char *name;
if (IsServer(sptr)) {
- Debug((DEBUG_ERROR, "%s tried to JOIN a channel", sptr->name));
- return 0;
+ return protocol_violation(sptr,"%s tried to JOIN a channel, duh!", sptr->name);
}
if (parc < 2 || *parv[1] == '\0')
inpath = cptr->name;
sendto_opmask_butone(0, IsServer(sptr) ? SNO_SERVKILL : SNO_OPERKILL,
- "Received KILL message for %C. From %s Path: %C!%s",
- victim, parv[0], cptr, path);
+ "Received KILL message for %s. From %s Path: %C!%s",
+ get_client_name(victim,SHOW_IP), parv[0], cptr, path);
#if defined(SYSLOG_KILL)
ircd_log_kill(victim, sptr, cptr->name, path);
* anyway (as this user don't exist there any more either)
*/
if (MyConnect(victim))
- sendcmdto_one(sptr, CMD_KILL, victim, "%C :%s!%s", victim, cptr->name,
+ sendcmdto_one(sptr, CMD_KILL, victim, "%C :%s!%s", victim, NumServ(cptr),
path);
/*
* the first space in path will be at the end of the
*/
sendto_opmask_butone(0, SNO_OPERKILL,
"Received KILL message for %s. From %s Path: %s!%s",
- victim->name, parv[0], inpath, path);
+ get_client_name(victim,SHOW_IP), parv[0], inpath, path);
#if defined(SYSLOG_KILL)
ircd_log_kill(victim, sptr, inpath, path);
#include "client.h"
#include "ircd.h"
#include "ircd_reply.h"
+#include "ircd_snprintf.h"
#include "ircd_string.h"
-#include "map.h"
+#include "list.h"
+#include "match.h"
#include "numeric.h"
+#include "s_user.h"
+#include "s_serv.h"
#include "send.h"
+#include "querycmds.h"
#include <assert.h>
+#include <stdio.h>
+
+static void dump_map(struct Client *cptr, struct Client *server, char *mask, int prompt_length)
+{
+ static char prompt[64];
+ struct DLink *lp;
+ char *p = &prompt[prompt_length];
+ int cnt = 0;
+
+ *p = '\0';
+ if (prompt_length > 60)
+ send_reply(cptr, RPL_MAPMORE, prompt, server->name);
+ else {
+ char lag[512];
+ if (server->serv->lag>10000)
+ lag[0]=0;
+ else if (server->serv->lag<0)
+ strcpy(lag,"(0s)");
+ else
+ sprintf(lag,"(%is)",server->serv->lag);
+ send_reply(cptr, RPL_MAP, prompt, (
+ (IsBurst(server)) ? "*" : (IsBurstAck(server) ? "!" : "")),
+ server->name, lag, (server == &me) ? UserStats.local_clients :
+ server->serv->clients);
+ }
+ if (prompt_length > 0)
+ {
+ p[-1] = ' ';
+ if (p[-2] == '`')
+ p[-2] = ' ';
+ }
+ if (prompt_length > 60)
+ return;
+ strcpy(p, "|-");
+ for (lp = server->serv->down; lp; lp = lp->next)
+ if (match(mask, lp->value.cptr->name))
+ lp->value.cptr->flags &= ~FLAGS_MAP;
+ else
+ {
+ lp->value.cptr->flags |= FLAGS_MAP;
+ cnt++;
+ }
+ for (lp = server->serv->down; lp; lp = lp->next)
+ {
+ if ((lp->value.cptr->flags & FLAGS_MAP) == 0)
+ continue;
+ if (--cnt == 0)
+ *p = '`';
+ dump_map(cptr, lp->value.cptr, mask, prompt_length + 2);
+ }
+ if (prompt_length > 0)
+ p[-1] = '-';
+}
+
/*
* m_map - generic message handler
#include "numeric.h"
#include "numnicks.h"
#include "s_conf.h"
+#include "class.h"
#include "s_user.h"
#include "send.h"
+#include <stdlib.h>
#include <assert.h>
/*
struct TRecord *ptr;
int count;
struct MotdItem *temp;
+ int class = get_client_class(sptr);
#ifdef NODEFAULTMOTD
int no_motd;
no_motd = 1;
}
#endif
-
- /*
- * Find out if this is a remote query or if we have a T line for our hostname
+ /* 2.10.11: Allow per Class T:'s
+ * -- Isomer 2000-11-19
*/
- if (IsServer(cptr))
+ for (ptr = tdata; ptr; ptr = ptr->next)
{
- tm = 0; /* Remote MOTD */
- temp = rmotd;
- }
- else
- {
- for (ptr = tdata; ptr; ptr = ptr->next)
- {
- if (!match(ptr->hostmask, cptr->sockhost))
+ if (IsDigit(*ptr->hostmask)) {
+ if (atoi(ptr->hostmask)==class)
break;
}
- if (ptr)
- {
- temp = ptr->tmotd;
- tm = &ptr->tmotd_tm;
- }
- else
- temp = motd;
+ else if (!match(ptr->hostmask, cptr->sockhost))
+ break;
}
+ if (ptr)
+ {
+ temp = ptr->tmotd;
+ tm = &ptr->tmotd_tm;
+ }
+ else
+ temp = motd;
if (temp == 0)
{
send_reply(sptr, ERR_NOMOTD);
/*
* we can't deliver it, sending an error back is pointless
*/
- return 0;
+ return protocol_violation(sptr,"Not enough params for NOTICE");
}
name = parv[1];
/*
/*
* mr_pass - registration message handler
*/
-int m_pass(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
+int mr_pass(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
const char* password = parc > 1 ? parv[1] : 0;
if (EmptyString(password))
return need_more_params(cptr, "PASS");
+ /* TODO: For protocol negotiation */
+#if 0
+ if (ircd_strcmp(password,"PROT")==0) {
+ /* Do something here */
+ }
+#endif
ircd_strncpy(cptr->passwd, password, PASSWDLEN);
return 0;
}
*/
sendto_one(sptr, err_str(ERR_NOORIGIN), me.name, parv[0]); /* XXX DEAD */
#endif
- return 0;
+ return protocol_violation(sptr,"No Origin on PONG");
}
origin = parv[1];
destination = parv[2];
#include "ircd_string.h"
#include "struct.h"
#include "s_misc.h"
+#include "ircd_reply.h"
#include <assert.h>
#include <string.h>
{
assert(0 != sptr);
assert(parc > 0);
+ if (IsServer(sptr)) {
+ protocol_violation(sptr,"Server QUIT, not SQUIT?");
+ return 0;
+ }
/*
* ignore quit from servers
*/
- return IsServer(sptr) ? 0 : exit_client(cptr, sptr, sptr, parv[parc - 1]);
+ return exit_client(cptr, sptr, sptr, parv[parc - 1]);
}
#if 0
/*
* mo_rehash - oper message handler
+ *
+ * parv[1] = 'q' to not rehash the resolver (optional)
*/
int mo_rehash(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
}
else {
if (parc < 3) {
- /*
- * PROTOCOL ERROR
- */
return need_more_params(sptr, "RPING");
}
/*
if (parc < 7)
{
- return need_more_params(sptr, "SERVER");
+ need_more_params(sptr, "SERVER");
return exit_client(cptr, cptr, &me, "Need more parameters");
}
host = parv[1];
struct Client* acptr;
if (IsServer(sptr)) {
- /* PROTOCOL WARNING */
- /* bail, don't core */
- return 0;
+ return protocol_violation(sptr,"Server trying to silence a user");
}
if (parc < 3 || EmptyString(parv[2])) {
- /* PROTOCOL WARNING */
return need_more_params(sptr, "SILENCE");
}
/* Modeless Channels don't have topics */
if (IsModelessChannel(name))
{
- /* Protocol Violation? */
+ protocol_violation(sptr,"Attempted to topic modeless channel");
send_reply(sptr, ERR_CHANOPRIVSNEEDED, chptr->chname);
continue;
}
/* Ignore requests for topics from remote servers */
if (IsLocalChannel(name) && !MyUser(sptr))
- /* Protocol Violation warning here? */
+ protocol_violation(sptr,"Topic request");
continue;
do_settopic(sptr,cptr,chptr,topic);
if (hunt_server_cmd(sptr, CMD_VERSION, cptr, 0, ":%C", 1, parc, parv) ==
HUNTED_ISME)
{
- char featurebuf[512];
-
- sprintf_irc(featurebuf,FEATURES,FEATURESVALUES);
-
send_reply(sptr, RPL_VERSION, version, debugmode, me.name, serveropts);
- send_reply(sptr, RPL_ISUPPORT, featurebuf);
}
return 0;
if (BadPtr(message))
return need_more_params(sptr, "WALLOPS");
- if (!IsServer(sptr) && MyConnect(sptr) && !IsAnOper(sptr))
+ if (!IsAnOper(sptr))
{
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); /* XXX DEAD */
return 0;
+++ /dev/null
-/*
- * IRC - Internet Relay Chat, ircd/map.c
- * Copyright (C) 1994 Carlo Wood ( Run @ undernet.org )
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
- */
-#include "map.h"
-#include "client.h"
-#include "ircd.h"
-#include "ircd_reply.h"
-#include "list.h"
-#include "match.h"
-#include "numeric.h"
-#include "numnicks.h"
-#include "querycmds.h"
-#include "send.h"
-#include "struct.h"
-
-#include <stdio.h> /* sprintf */
-#include <string.h>
-
-void dump_map(struct Client *cptr, struct Client *server, char *mask, int prompt_length)
-{
- static char prompt[64];
- struct DLink *lp;
- char *p = &prompt[prompt_length];
- int cnt = 0;
-
- *p = '\0';
- if (prompt_length > 60)
- send_reply(cptr, RPL_MAPMORE, prompt, server->name);
- else {
- char lag[512];
- if (server->serv->lag>10000)
- lag[0]=0;
- else if (server->serv->lag<0)
- strcpy(lag,"(0s)");
- else
- sprintf(lag,"(%is)",server->serv->lag);
- send_reply(cptr, RPL_MAP, prompt, ((IsBurstOrBurstAck(server)) ? "*" : ""),
- server->name, lag, (server == &me) ? UserStats.local_clients :
- server->serv->clients);
- }
- if (prompt_length > 0)
- {
- p[-1] = ' ';
- if (p[-2] == '`')
- p[-2] = ' ';
- }
- if (prompt_length > 60)
- return;
- strcpy(p, "|-");
- for (lp = server->serv->down; lp; lp = lp->next)
- if (match(mask, lp->value.cptr->name))
- lp->value.cptr->flags &= ~FLAGS_MAP;
- else
- {
- lp->value.cptr->flags |= FLAGS_MAP;
- cnt++;
- }
- for (lp = server->serv->down; lp; lp = lp->next)
- {
- if ((lp->value.cptr->flags & FLAGS_MAP) == 0)
- continue;
- if (--cnt == 0)
- *p = '`';
- dump_map(cptr, lp->value.cptr, mask, prompt_length + 2);
- }
- if (prompt_length > 0)
- p[-1] = '-';
-}
-
-#if 0
-/*
- * m_map -- by Run
- *
- * parv[0] = sender prefix
- * parv[1] = server mask
- */
-int m_map(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
-{
- if (parc < 2)
- parv[1] = "*";
-
- dump_map(sptr, &me, parv[1], 0);
- sendto_one(sptr, rpl_str(RPL_MAPEND), me.name, parv[0]); /* XXX DEAD */
-
- return 0;
-}
-#endif /* 0 */
-
#include "ircd_chattr.h"
#include "ircd_reply.h"
#include "ircd_string.h"
-#include "map.h"
#include "msg.h"
#include "numeric.h"
#include "numnicks.h"
TOK_ERROR,
0, MAXPARA, MFLG_SLOW | MFLG_UNREG, 0,
/* UNREG, CLIENT, SERVER, OPER, SERVICE */
- { mr_error, m_ignore, ms_error, m_ignore, m_ignore }
+ { m_ignore, m_ignore, ms_error, m_ignore, m_ignore }
},
{
MSG_KILL,
TOK_PASS,
0, MAXPARA, MFLG_SLOW | MFLG_UNREG, 0,
/* UNREG, CLIENT, SERVER, OPER, SERVICE */
- { m_pass, m_registered, m_ignore, m_registered, m_ignore }
+ { mr_pass, m_registered, m_ignore, m_registered, m_ignore }
},
{
MSG_LUSERS,
int ii;
struct Message **msgtab_tok;
struct Message **msgtok;
-
+
for (i = 0; msg->cmd; ++i, ++msg)
continue;
qsort(msgtab, i, sizeof(struct Message),
* hunt_server() possiblites were becoming very messy. It now uses a
* switch() so as to be easier to read and update as params change.
* -Ghostwolf
+ *
+ * 2.10.11: Don't check for the oper limitation if it's not our local server.
+ * thusly once all the hubs have upgraded local opers will be able
+ * to remote stats anywhere on the network.
*/
int hunt_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[], char stat)
{
case 'M':
{
if (parc == 4)
- return hunt_server_cmd(sptr, CMD_STATS, cptr, 1, "%s %C :%s", 2, parc, parv);
+ return hunt_server_cmd(sptr, CMD_STATS, cptr, MyUser(sptr) ? 1 : 0, "%s %C :%s", 2, parc, parv);
else if (parc > 4)
- return hunt_server_cmd(sptr, CMD_STATS, cptr, 1, "%s %C %s :%s", 2, parc, parv);
+ return hunt_server_cmd(sptr, CMD_STATS, cptr, MyUser(sptr) ? 1 : 0, "%s %C %s :%s", 2, parc, parv);
else
- return hunt_server_cmd(sptr, CMD_STATS, cptr, 1, "%s :%C", 2, parc, parv);
+ return hunt_server_cmd(sptr, CMD_STATS, cptr, MyUser(sptr) ? 1 : 0, "%s :%C", 2, parc, parv);
}
/* oper only, standard # of params */
default:
- return hunt_server_cmd(sptr, CMD_STATS, cptr, 1, "%s :%C", 2, parc, parv);
+ return hunt_server_cmd(sptr, CMD_STATS, cptr, MyUser(sptr) ? 1 : 0, "%s :%C", 2, parc, parv);
}
}