Author: Isomer <perry@coders.net>
authorPerry Lorier <isomer@undernet.org>
Mon, 20 Nov 2000 19:02:17 +0000 (19:02 +0000)
committerPerry Lorier <isomer@undernet.org>
Mon, 20 Nov 2000 19:02:17 +0000 (19:02 +0000)
Log message:

        * 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.

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@308 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

36 files changed:
ChangeLog
doc/example.conf
doc/rfc1459.unet
include/handlers.h
include/ircd_reply.h
include/map.h [deleted file]
ircd/Makefile.in
ircd/ircd_reply.c
ircd/m_away.c
ircd/m_burst.c
ircd/m_clearmode.c
ircd/m_connect.c
ircd/m_create.c
ircd/m_destruct.c
ircd/m_desynch.c
ircd/m_endburst.c
ircd/m_error.c
ircd/m_invite.c
ircd/m_join.c
ircd/m_kill.c
ircd/m_map.c
ircd/m_motd.c
ircd/m_notice.c
ircd/m_pass.c
ircd/m_pong.c
ircd/m_quit.c
ircd/m_rehash.c
ircd/m_rping.c
ircd/m_server.c
ircd/m_silence.c
ircd/m_topic.c
ircd/m_version.c
ircd/m_wallops.c
ircd/map.c [deleted file]
ircd/parse.c
ircd/s_stats.c

index 34c5891b4f4c3b1e48563d6a034772cb895a64e2..0af5a67c49213e57d85a26ec210792efbdcb900b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,26 @@
-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!
index 72f1a4908ed60f603793fd0b8c4f591fedbe3d33..aa29ead9a0390ad59ef5a4e50aec860a9bb51c9e 100644 (file)
@@ -185,6 +185,8 @@ I:*@193.37.*::*@*.london.ac.uk::10
 # 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
index 99794a6015cf5fcd74e8af60720c7526ed7e742a..84d106a03ae5c82acced5aec9fc769546c6c3c8c 100644 (file)
@@ -1632,7 +1632,8 @@ LINKS *.au                      ; list all servers which have a name
    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:
 
index 3889074befb0eac496c4bfd284385e80a84dc266..9b991d5fdfaf12d5873cdf764be24989d4749f35 100644 (file)
@@ -110,7 +110,7 @@ extern int m_notice(struct Client*, struct Client*, int, char*[]);
 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*[]);
index 91d48fb2731da14cbd5b317b5842082cd0d1c8a8..4ea9e5afec3eb359004657d5ccf45c04abfd6f20 100644 (file)
@@ -24,6 +24,7 @@
 
 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, ...);
diff --git a/include/map.h b/include/map.h
deleted file mode 100644 (file)
index 3b039f2..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * 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 */
index 93c367ed6100cc469baa4e6953ddb0252e56da54..1e955287f1f4183724929945a17bc4333cd36c5a 100644 (file)
@@ -150,7 +150,6 @@ SRC = \
        m_who.c \
        m_whois.c \
        m_whowas.c \
-       map.c \
        match.c \
        numnicks.c \
        opercmds.c \
@@ -375,7 +374,8 @@ ircd_reply.o: ircd_reply.c ../include/ircd_reply.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_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
@@ -591,8 +591,7 @@ m_map.o: m_map.c ../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/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 \
@@ -838,12 +837,6 @@ m_whowas.o: m_whowas.c ../include/client.h ../include/ircd_defs.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 \
@@ -864,18 +857,6 @@ packet.o: packet.c ../include/packet.h ../include/client.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
index 742923d442b312b5dff430ea6b8de45d481e1766..5e33b1bf932d926e1a43c41dafd1c8967256105c 100644 (file)
@@ -27,6 +27,7 @@
 #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;
 }
index db726ffce8c45998e0546db758ab8df2dc24ebcb..959508429cc80424f917605a9e254793285ab563 100644 (file)
@@ -141,7 +141,7 @@ int ms_away(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
    * 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);
index f966ca8b4d9253d767398a2ffbded1de903fc533..ceb8c9bbe3844771b04030042a2dfaf8cc02ec96 100644 (file)
@@ -151,7 +151,7 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
   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 "
index a2946e081aebbd686257ffcdff3be1e2380cc103..ef2e10bb1891d494b14e54d0e3dc1f38e7cce77f 100644 (file)
@@ -265,8 +265,10 @@ ms_clearmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   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])))
index d30151d6e3dabb110a4a295be59cbda700ff50b0..3f7d6f972f1895b785395939cc4f1e59939e2fc5 100644 (file)
@@ -180,6 +180,12 @@ int ms_connect(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
                  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.
@@ -189,11 +195,18 @@ int ms_connect(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
                  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
    */
index 6333645ad15965a526aa03b45f25e188caea247d..e89afa39973ff2ae9886e04b3bd87a571222b8aa 100644 (file)
@@ -97,6 +97,7 @@
 #include "numeric.h"
 #include "numnicks.h"
 #include "s_debug.h"
+#include "s_user.h"
 #include "send.h"
 
 #include <assert.h>
@@ -117,14 +118,12 @@ int ms_create(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   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]);
 
@@ -138,11 +137,12 @@ int ms_create(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       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
    */
index c26aeaf338c7f192adc565ec1002f6a731356aea..c05e41e2eee3ce79a68bd23ecc7491d125cd8028 100644 (file)
@@ -120,11 +120,7 @@ int ms_destruct(struct Client* cptr, struct Client* sptr, int parc, char* parv[]
   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]))
index d2b2cd0bc6eac70c8662f7e9429332336f1a517a..eee568fd892fd4027e3dcc10fb08e133bd4c1049 100644 (file)
  */
 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;
 }
index ec42f725fa0d51ecc9b986d1fbcfdc81f8f080a1..c987428cbbfac02b77b7379d3c55ceb2e64f3bba 100644 (file)
@@ -119,10 +119,9 @@ int ms_end_of_burst(struct Client* cptr, struct Client* sptr, int parc, char* pa
 
   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);
index 7af17f44f18d80ce8538cf89143d016b078e23da..f7ad566a465e16f166f99dd3b463fc258430c674 100644 (file)
@@ -115,55 +115,6 @@ int ms_error(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   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);
index 47beba3cd217fc68ab91cb551a6959209bc6aeee..af90a34953f95a72665ad0bf73020b2cbacebdd5 100644 (file)
@@ -134,7 +134,7 @@ int m_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     send_reply(cptr, RPL_ENDOFINVITELIST);
     return 0;
   }
-
+  
   if (parc < 3 || EmptyString(parv[2]))
     return need_more_params(sptr, "INVITE");
 
@@ -232,22 +232,19 @@ int ms_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
      * 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]);
index 657bc4e7398c54abb4df031f022b3a532725da29..e6fea02fbb745d8204ccc55e5974c1fd80efd68e 100644 (file)
@@ -316,8 +316,7 @@ int ms_join(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
   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')
index b8dd10086e57d109563a00ee2494b147f6b88c85..4ed73db8e6c9ef4128f7866ca7732d43adf056d1 100644 (file)
@@ -176,8 +176,8 @@ int ms_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   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);
@@ -222,7 +222,7 @@ int ms_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
    * 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
@@ -337,7 +337,7 @@ int mo_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
    */
   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);
index e420ea161bb057dc5dc00f07de0ad4f0d3804b9d..77192e939892103bcb75746639002e8eddf7e2f2 100644 (file)
 #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
index 3b03a516f8829c3ee1a5ece29e901b4fc114ac7c..966a8b6556680a3c626c7fca119c8bfae6358702 100644 (file)
 #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>
 
 /*
@@ -123,6 +125,7 @@ int m_motd(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   struct TRecord *ptr;
   int count;
   struct MotdItem *temp;
+  int class = get_client_class(sptr);
 
 #ifdef NODEFAULTMOTD
   int no_motd;
@@ -142,30 +145,25 @@ int m_motd(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     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);
index 202297248c8904db994bbb9796503216f14dcb56..1ecc8858c54e8974b308806a86920c035f09b635 100644 (file)
@@ -167,7 +167,7 @@ int ms_notice(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     /*
      * 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];
   /*
index 2087118d6b2400dddb256f744238d431e75b6ef7..c436ec8c2ff90fb2ea52b963c17832bf2400c3bd 100644 (file)
@@ -97,7 +97,7 @@
 /*
  * 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;
 
@@ -108,6 +108,12 @@ int m_pass(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   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;
 }
index bed24122bfa8d9f0ff8d31c6d73b68835544230e..64a4e81f45cf98964473a45f70c6f651349084b2 100644 (file)
@@ -124,7 +124,7 @@ int ms_pong(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
      */
     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];
index bc490389bbad0cd661f95d54977453663937f822..3c45f887fd322f5e087e989d5e0c5ae4851fc9ba 100644 (file)
@@ -92,6 +92,7 @@
 #include "ircd_string.h"
 #include "struct.h"
 #include "s_misc.h"
+#include "ircd_reply.h"
 
 #include <assert.h>
 #include <string.h>
@@ -140,10 +141,14 @@ int ms_quit(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   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
index 0d2358a8f4ead5420cf30f1799593a263be5bd71..de38a9cd1ab30ba67d08bc4573af2d593f54e9b8 100644 (file)
 
 /*
  * 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[])
 {
index 905dbf565474de3de673f36d6e05e1b700a9e572..4fdabd6d2f0e51d603c4519269156bd3b914743e 100644 (file)
@@ -160,9 +160,6 @@ int ms_rping(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   }
   else {
     if (parc < 3) {
-      /*
-       * PROTOCOL ERROR
-       */
       return need_more_params(sptr, "RPING");
     }
     /*
index b0af144cbd227808ed90f75bb60822e8d5603415..9c072dc879ade2d08b1339c120688fb2328ca38e 100644 (file)
@@ -157,7 +157,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 
   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];
index 25867e9fb44d3f0457435841ad027f05b59b4ee0..6451d981c72bfb3582ece667338d2db7338d79a5 100644 (file)
@@ -170,12 +170,9 @@ int ms_silence(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   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");
   }
 
index 2b7756e64ab67342d8f8ec134930fd31e9a6bada..300536eaa875c616571d7bd9bfc1cdd2e46b6316 100644 (file)
@@ -220,13 +220,13 @@ int ms_topic(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     /* 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);
index b78279156888bd337fe3d662fe495e4a19dd1e8a..b1b3f24a952ec44df5417ca7769b425e4005eae9 100644 (file)
@@ -160,12 +160,7 @@ int ms_version(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   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;
index 2e5ad2feaacf11e39c822bfd93edde9a81dd52eb..865fed8625b27f22c0328ba3cd8a9741cad68d29 100644 (file)
@@ -148,7 +148,7 @@ int m_wallops(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
   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;
diff --git a/ircd/map.c b/ircd/map.c
deleted file mode 100644 (file)
index 07b7c68..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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 */
-
index b2c7657338d51dd936b7a78d38968f15a8991acf..7fb9571954dc73335d728507b2639c0a07c60229 100644 (file)
@@ -29,7 +29,6 @@
 #include "ircd_chattr.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
-#include "map.h"
 #include "msg.h"
 #include "numeric.h"
 #include "numnicks.h"
@@ -207,7 +206,7 @@ struct Message msgtab[] = {
     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,
@@ -312,7 +311,7 @@ struct Message msgtab[] = {
     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,
@@ -707,7 +706,7 @@ void initmsgtree(void)
   int ii;
   struct Message **msgtab_tok;
   struct Message **msgtok;
-
+  
   for (i = 0; msg->cmd; ++i, ++msg)
     continue;
   qsort(msgtab, i, sizeof(struct Message),
index 87591d9e1e4af738b3058c1a47d80343b91a7aee..f23339279b450d0d1e13b252f4ae884ca94faa43 100644 (file)
@@ -170,6 +170,10 @@ void report_deny_list(struct Client* to)
  * 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)
 {
@@ -201,16 +205,16 @@ int hunt_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[],
     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);
   }
 }