Author: Isomer <isomer@coders.net>
authorPerry Lorier <isomer@undernet.org>
Tue, 1 May 2001 09:49:42 +0000 (09:49 +0000)
committerPerry Lorier <isomer@undernet.org>
Tue, 1 May 2001 09:49:42 +0000 (09:49 +0000)
Log message:

A few cleanups, let anyone /msg +k users without target limiting (are users
really going to spam X and euworld?  and if so, do they CARE?) this is so
if users are being flooded they can still /msg X to ban users, and if they
run out of targets on login they can still use X etc.  Oh, and made chkconf
compile so we can make install again.  Who knows if it actually *works*.

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

ChangeLog
ircd/chkconf.c
ircd/ircd_relay.c
ircd/m_invite.c
ircd/m_kill.c
ircd/m_notice.c
ircd/m_privmsg.c
ircd/s_err.c

index 7a8e2112323d782779a91d004e1cf2a7fe9f51d9..71b5b45fe3dcda68bc331890c791a965427a0433 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-04-23  Perry Lorier       <Isomer@coders.net>
+       * ircd/s_err.c: Suggested wording change.
+       * ircd/s_user.c: Users aren't target limited against +k users.
+       * ircd/chkconf.c: Made it compile again, who knows if it works, but
+               now I can at least make install
+        * various: Cleanups on m_*.c files.
+
+
 2001-04-23  Kevin L. Mitchell  <klmitch@mit.edu>
 
        * ircd/s_misc.c (exit_client): make netsplit server notice say the
index 1df62142d5a0a7c74add276e2192c688aee044e2..4414e725274efd10e0c9487025153a2332604710 100644 (file)
@@ -75,7 +75,7 @@ static struct ConfItem *chk_initconf(void);
 static struct ConnectionClass *get_class(int cn, int ism);
 
 static int numclasses = 0, *classarr = (int *)NULL, debugflag = 0;
-static char *chk_configfile = CPATH;
+static char *chk_configfile = "";
 static char nullfield[] = "";
 static char maxsendq[12];
 
@@ -103,7 +103,7 @@ char *rpl_str(int numeric)
 
 int main(int argc, char *argv[])
 {
-  const char *dpath = DPATH;
+  const char *dpath = "./";
   chk_configfile = "ircd.conf";
 
   while (argc > 1)
index 3eebe2cf9e3178d43c4d58b5a3e99d75de3b8d0b..32f2df0a61e9758aa2f3c3b3e43b85e01256b51c 100644 (file)
@@ -244,7 +244,8 @@ void relay_private_message(struct Client* sptr, const char* name, const char* te
     send_reply(sptr, ERR_NOSUCHNICK, name);
     return;
   }
-  if (check_target_limit(sptr, acptr, cli_name(acptr), 0) ||
+  if (!IsChannelService(acptr) &&
+      check_target_limit(sptr, acptr, cli_name(acptr), 0) ||
       is_silenced(sptr, acptr))
     return;
 
@@ -271,7 +272,8 @@ void relay_private_notice(struct Client* sptr, const char* name, const char* tex
 
   if (0 == (acptr = FindUser(name)))
     return;
-  if (check_target_limit(sptr, acptr, cli_name(acptr), 0) ||
+  if (!IsChannelService(acptr) && 
+      check_target_limit(sptr, acptr, cli_name(acptr), 0) ||
       is_silenced(sptr, acptr))
     return;
   /*
index 43ef8f5d84cdfa3e71e0ce5353748b5a6953d4b7..ae9be8271b7c6172fe87b0d2d245a503ca6f8b60 100644 (file)
@@ -240,6 +240,7 @@ int ms_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     /*
      * should have been handled upstream, ignore it.
      */
+    protocol_violation(sptr,"Too few arguments to invite");
     return need_more_params(sptr,"INVITE");
   }
   if ('#' != *parv[2]) {
@@ -286,135 +287,3 @@ int ms_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 }
 
 
-#if 0
-/*
- * m_invite
- *
- *   parv[0] - sender prefix
- *   parv[1] - user to invite
- *   parv[2] - channel name
- *
- * - INVITE now is accepted only if who does it is chanop (this of course
- *   implies that channel must exist and he must be on it).
- *
- * - On the other side it IS processed even if channel is NOT invite only
- *   leaving room for other enhancements like inviting banned ppl.  -- Nemesi
- *
- * - Invite with no parameters now lists the channels you are invited to.
- *                                                         - Isomer 23 Oct 99
- */
-int m_invite(struct Client* cptr, struct Client *sptr, int parc, char *parv[])
-{
-  struct Client *acptr;
-  struct Channel *chptr;
-  
-  if (parc < 2 ) { 
-    /*
-     * list the channels you have an invite to.
-     */
-    struct SLink *lp;
-    for (lp = sptr->user->invited; lp; lp = lp->next)
-      sendto_one(cptr, rpl_str(RPL_INVITELIST), me.name, cptr->name, /* XXX DEAD */
-                lp->value.chptr->chname);
-    sendto_one(cptr, rpl_str(RPL_ENDOFINVITELIST), me.name, cptr->name); /* XXX DEAD */
-    return 0;
-  }
-
-  if (parc < 3 || *parv[2] == '\0')
-    return need_more_params(sptr, "INVITE");
-
-  if (!(acptr = FindUser(parv[1])))
-  {
-    sendto_one(sptr, err_str(ERR_NOSUCHNICK), me.name, parv[0], parv[1]); /* XXX DEAD */
-    return 0;
-  }
-
-  if (is_silenced(sptr, acptr))
-    return 0;
-
-  if (MyUser(sptr))
-    clean_channelname(parv[2]);
-  else if (IsLocalChannel(parv[2]))
-    return 0;
-
-  if (*parv[2] == '0' || !IsChannelName(parv[2]))
-    return 0;
-
-  if (!(chptr = FindChannel(parv[2])))
-  {
-    if (IsModelessChannel(parv[2]) || IsLocalChannel(parv[2]))
-    {
-      sendto_one(sptr, err_str(ERR_NOTONCHANNEL), me.name, parv[0], parv[2]); /* XXX DEAD */
-      return 0;
-    }
-
-    /* Do not disallow to invite to non-existant #channels, otherwise they
-       would simply first be created, causing only MORE bandwidth usage. */
-    if (MyConnect(sptr))
-    {
-      if (check_target_limit(sptr, acptr, acptr->name, 0))
-        return 0;
-
-      sendto_one(sptr, rpl_str(RPL_INVITING), me.name, parv[0], /* XXX DEAD */
-          acptr->name, parv[2]);
-
-      if (acptr->user->away)
-        sendto_one(sptr, rpl_str(RPL_AWAY), me.name, parv[0], /* XXX DEAD */
-            acptr->name, acptr->user->away);
-    }
-
-    sendto_prefix_one(acptr, sptr, ":%s INVITE %s :%s", parv[0], /* XXX DEAD */
-        acptr->name, parv[2]);
-
-    return 0;
-  }
-
-  if (!find_channel_member(sptr, chptr))
-  {
-    sendto_one(sptr, err_str(ERR_NOTONCHANNEL), me.name, parv[0], /* XXX DEAD */
-        chptr->chname);
-    return 0;
-  }
-
-  if (find_channel_member(acptr, chptr))
-  {
-    sendto_one(sptr, err_str(ERR_USERONCHANNEL), /* XXX DEAD */
-        me.name, parv[0], acptr->name, chptr->chname);
-    return 0;
-  }
-
-  if (MyConnect(sptr))
-  {
-    if (!is_chan_op(sptr, chptr))
-    {
-      sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED), /* XXX DEAD */
-          me.name, parv[0], chptr->chname);
-      return 0;
-    }
-
-    /* If we get here, it was a VALID and meaningful INVITE */
-
-    if (check_target_limit(sptr, acptr, acptr->name, 0))
-      return 0;
-
-    sendto_one(sptr, rpl_str(RPL_INVITING), me.name, parv[0], /* XXX DEAD */
-        acptr->name, chptr->chname);
-
-    if (acptr->user->away)
-      sendto_one(sptr, rpl_str(RPL_AWAY), me.name, parv[0], /* XXX DEAD */
-          acptr->name, acptr->user->away);
-  }
-
-  if (MyConnect(acptr)) {
-    add_invite(acptr, chptr);
-  sendto_prefix_one(acptr, sptr, ":%s INVITE %s :%s", parv[0], /* XXX DEAD */
-      acptr->name, chptr->chname);
-  }
-  else
-    sendto_highprot_butone(acptr, 10, "%s%s " TOK_INVITE " %s :%s", /* XXX DEAD */
-       NumNick(sptr), acptr->name, chptr->chname);
-
-  return 0;
-}
-#endif /* 0 */
-
index 730d54029aa255339075e090f0ff81594a907b36..f7b8bf26165dc6bbbbc0a9138935f2e4e52e1212 100644 (file)
@@ -131,8 +131,10 @@ int ms_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
    * XXX - a server sending less than 3 params could really desync
    * things
    */
-  if (parc < 3)
+  if (parc < 3) {
+    protocol_violation(sptr,"Too few arguments for KILL");
     return need_more_params(sptr, "KILL");
+  }
 
   user = parv[1];
   path = parv[parc - 1];        /* Either defined or NULL (parc >= 3) */
@@ -346,228 +348,3 @@ int mo_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 
   return exit_client(cptr, victim, sptr, buf);
 }
-
-#if 0
-/*
- * m_kill
- *
- * parv[0] = sender prefix
- * parv[1] = kill victim
- * parv[parc-1] = kill path
- */
-int m_kill(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
-{
-  struct Client* acptr;
-  const char*    inpath = get_client_name(cptr, HIDE_IP);
-  char*          user;
-  char*          path;
-  char*          killer;
-  int            chasing = 0;
-  char           buf[BUFSIZE];
-  char           buf2[BUFSIZE];
-
-  if (parc < 3 || *parv[1] == '\0')
-    return need_more_params(sptr, parv[0], "KILL");
-
-  user = parv[1];
-  path = parv[parc - 1];        /* Either defined or NULL (parc >= 3) */
-
-#ifdef        OPER_KILL
-  if (!IsPrivileged(cptr))
-  {
-    sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); /* XXX DEAD */
-    return 0;
-  }
-#else
-  if (!IsServer(cptr))
-  {
-    sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); /* XXX DEAD */
-    return 0;
-  }
-#endif
-  if (IsAnOper(cptr))
-  {
-    if (EmptyString(path))
-      return need_more_params(sptr, parv[0], "KILL");
-
-    if (strlen(path) > TOPICLEN)
-      path[TOPICLEN] = '\0';
-  }
-
-  if (MyUser(sptr))
-  {
-    if (!(acptr = FindClient(user)))
-    {
-      /*
-       * If the user has recently changed nick, we automaticly
-       * rewrite the KILL for this new nickname--this keeps
-       * servers in synch when nick change and kill collide
-       */
-      if (!(acptr = get_history(user, (long)15)))
-      {
-        sendto_one(sptr, err_str(ERR_NOSUCHNICK), me.name, parv[0], user); /* XXX DEAD */
-        return 0;
-      }
-      sendto_one(sptr, ":%s NOTICE %s :Changed KILL %s into %s", /* XXX DEAD */
-          me.name, parv[0], user, acptr->name);
-      chasing = 1;
-    }
-  }
-  else if (!(acptr = findNUser(user)))
-  {
-    if (IsUser(sptr))
-      sendto_one(sptr, /* XXX DEAD */
-          "%s NOTICE %s%s :KILL target disconnected before I got him :(",
-          NumServ(&me), NumNick(sptr));
-    return 0;
-  }
-  if (!MyConnect(acptr) && IsLocOp(cptr))
-  {
-    sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); /* XXX DEAD */
-    return 0;
-  }
-  if (IsServer(acptr) || IsMe(acptr))
-  {
-    sendto_one(sptr, err_str(ERR_CANTKILLSERVER), me.name, parv[0]); /* XXX DEAD */
-    return 0;
-  }
-
-  /* if the user is +k, prevent a kill from local user */
-  if (IsChannelService(acptr) && MyUser(sptr))
-  {
-    sendto_one(sptr, err_str(ERR_ISCHANSERVICE), me.name, /* XXX DEAD */
-        parv[0], "KILL", acptr->name);
-    return 0;
-  }
-
-#ifdef        LOCAL_KILL_ONLY
-  if (MyConnect(sptr) && !MyConnect(acptr))
-  {
-    sendto_one(sptr, ":%s NOTICE %s :Nick %s isnt on your server", /* XXX DEAD */
-        me.name, parv[0], acptr->name);
-    return 0;
-  }
-#endif
-  if (!IsServer(cptr))
-  {
-    /*
-     * The kill originates from this server, initialize path.
-     * (In which case the 'path' may contain user suplied
-     * explanation ...or some nasty comment, sigh... >;-)
-     *
-     * ...!operhost!oper
-     * ...!operhost!oper (comment)
-     */
-    inpath = cptr->sockhost;
-
-    if (!EmptyString(path))
-    {
-      sprintf_irc(buf,
-          "%s%s (%s)", cptr->name, IsOper(sptr) ? "" : "(L)", path);
-      path = buf;
-    }
-    else
-      path = cptr->name;
-  }
-  else if (EmptyString(path))
-    path = "*no-path*";                /* Bogus server sending??? */
-  /*
-   * Notify all *local* opers about the KILL (this includes the one
-   * originating the kill, if from this server--the special numeric
-   * reply message is not generated anymore).
-   *
-   * Note: "acptr->name" is used instead of "user" because we may
-   *       have changed the target because of the nickname change.
-   */
-  if (IsLocOp(sptr) && !MyConnect(acptr))
-  {
-    sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); /* XXX DEAD */
-    return 0;
-  }
-  sendto_op_mask(IsServer(sptr) ? SNO_SERVKILL : SNO_OPERKILL, /* XXX DEAD */
-      "Received KILL message for %s. From %s Path: %s!%s",
-      acptr->name, parv[0], inpath, path);
-#if defined(USE_SYSLOG) && defined(SYSLOG_KILL)
-  if (MyUser(acptr))
-  {                                /* get more infos when your local
-                                   clients are killed -- _dl */
-    if (IsServer(sptr))
-      ircd_log(L_TRACE, /* XXX DEAD */
-          "A local client %s!%s@%s KILLED from %s [%s] Path: %s!%s)",
-          acptr->name, acptr->user->username, acptr->user->host,
-          parv[0], sptr->name, inpath, path);
-    else
-      ircd_log(L_TRACE, /* XXX DEAD */
-          "A local client %s!%s@%s KILLED by %s [%s!%s@%s] (%s!%s)",
-          acptr->name, acptr->user->username, acptr->user->host,
-          parv[0], sptr->name, sptr->user->username, sptr->user->host,
-          inpath, path);
-  }
-  else if (IsOper(sptr))
-    ircd_log(L_TRACE, "KILL From %s For %s Path %s!%s", /* XXX DEAD */
-        parv[0], acptr->name, inpath, path);
-#endif
-  /*
-   * And pass on the message to other servers. Note, that if KILL
-   * was changed, the message has to be sent to all links, also
-   * back.
-   * Suicide kills are NOT passed on --SRB
-   */
-  if (!MyConnect(acptr) || !MyConnect(sptr) || !IsAnOper(sptr))
-  {
-    sendto_highprot_butone(cptr, 10, ":%s " TOK_KILL " %s%s :%s!%s", /* XXX DEAD */
-        parv[0], NumNick(acptr), inpath, path);
-    /* We *can* have crossed a NICK with this numeric... --Run */
-    /* Note the following situation:
-     *  KILL SAA -->       X
-     *  <-- S NICK ... SAA | <-- SAA QUIT <-- S NICK ... SAA <-- SQUIT S
-     * Where the KILL reaches point X before the QUIT does.
-     * This would then *still* cause an orphan because the KILL doesn't reach S
-     * (because of the SQUIT), the QUIT is ignored (because of the KILL)
-     * and the second NICK ... SAA causes an orphan on the server at the
-     * right (which then isn't removed when the SQUIT arrives).
-     * Therefore we still need to detect numeric nick collisions too.
-     */
-    if (MyConnect(acptr) && IsServer(cptr))
-      sendto_one(cptr, "%s " TOK_KILL " %s%s :%s!%s (Ghost5)", /* XXX DEAD */
-          NumServ(&me), NumNick(acptr), inpath, path);
-    acptr->flags |= FLAGS_KILLED;
-  }
-
-  /*
-   * Tell the victim she/he has been zapped, but *only* if
-   * the victim is on current server--no sense in sending the
-   * notification chasing the above kill, it won't get far
-   * anyway (as this user don't exist there any more either)
-   */
-  if (MyConnect(acptr))
-    sendto_prefix_one(acptr, sptr, ":%s KILL %s :%s!%s", /* XXX DEAD */
-        parv[0], acptr->name, inpath, path);
-  /*
-   * Set FLAGS_KILLED. This prevents exit_one_client from sending
-   * the unnecessary QUIT for this. (This flag should never be
-   * set in any other place)
-   */
-  if (MyConnect(acptr) && MyConnect(sptr) && IsAnOper(sptr))
-    sprintf_irc(buf2, "Local kill by %s (%s)", sptr->name,
-        EmptyString(parv[parc - 1]) ? sptr->name : parv[parc - 1]);
-  else
-  {
-    if ((killer = strchr(path, ' ')))
-    {
-      while (*killer && *killer != '!')
-        killer--;
-      if (!*killer)
-        killer = path;
-      else
-        killer++;
-    }
-    else
-      killer = path;
-    sprintf_irc(buf2, "Killed (%s)", killer);
-  }
-  return exit_client(cptr, acptr, sptr, buf2);
-}
-
-#endif /* 0 */
-
index f7de7c390ab44fe532e74d0cc31545858f9de2c9..8610da35516cbda82ba5783d02e1002f71032552 100644 (file)
@@ -328,7 +328,8 @@ static int m_message(struct Client *cptr, struct Client *sptr,
         acptr = 0;
       if (acptr)
       {
-        if (MyUser(sptr) && check_target_limit(sptr, acptr, acptr->name, 0))
+        if (MyUser(sptr) && !IsChannelService(acptr) && 
+           check_target_limit(sptr, acptr, acptr->name, 0))
           continue;
         if (!is_silenced(sptr, acptr))
         {
index fc351e7b2fa82210428fc3c3196511e1adb27ed3..09b5a4477401b21b64ee2236d6c4f532b0c8cb2b 100644 (file)
@@ -325,7 +325,8 @@ static int m_message(struct Client *cptr, struct Client *sptr,
         acptr = 0;
       if (acptr)
       {
-        if (MyUser(sptr) && check_target_limit(sptr, acptr, acptr->name, 0))
+        if (MyUser(sptr) && !IsChannelService(acptr) && 
+           check_target_limit(sptr, acptr, acptr->name, 0))
           continue;
         if (!is_silenced(sptr, acptr))
         {
index 002a9485b5eccc4279719c49fe11def92fc285b5..07ee89b9efcc560a1c2241393a5df1420dc1c4b5 100644 (file)
@@ -1001,7 +1001,7 @@ static Numeric replyTable[] = {
 /* 483 */
   { ERR_CANTKILLSERVER, ":You cant kill a server!", "483" },
 /* 484 */
-  { ERR_ISCHANSERVICE, "%s %s :Cannot kill, kick or deop channel service", "484" },
+  { ERR_ISCHANSERVICE, "%s %s :Cannot kill, kick or deop a network service", "484" },
 /* 485 */
   { 0 },
 /* 486 */