do not kick net riders if channel keys match; do kick them if they try
authorMichael Poole <mdpoole@troilus.org>
Tue, 27 Jul 2004 15:06:09 +0000 (15:06 +0000)
committerMichael Poole <mdpoole@troilus.org>
Tue, 27 Jul 2004 15:06:09 +0000 (15:06 +0000)
to ride past +r; fix a yacc syntax error

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

ChangeLog
ircd/ircd_parser.y
ircd/m_burst.c

index 9957d3798a2283aadac765fe7ddbc70713bbfc45..b734c950b7633028893ed0c96e14668897ecfac9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2004-07-27  Michael Poole <mdpoole@troilus.org>
+
+       * ircd/m_burst.c: Add new netride_modes() function to check
+       which modes could be used in a net.ride.  Use this instead
+       of the old check for just +i or +k.
+       (Based on patches by beware and pomac.)
+
+2004-07-25  Michael Poole <mdpoole@troilus.org>
+
+       * ircd/ircd_parser.y: Remove redundant semicolon; it causes
+       errors on some versions of yacc.
+
 2004-07-21  Michael Poole <mdpoole@troilus.org>
 
        * include/client.h, ircd/ircd_auth.c, ircd/ircd_crypt_smd5.c,
index 86ac91abacee9da6a46ff725aa6812d379debf4f..ca58bf3fc93c807a6f35bde0da0c5fd903c7b8cc 100644 (file)
@@ -1017,7 +1017,7 @@ iauthblock: IAUTH '{'
   MyFree(pass);
   MyFree(host);
   pass = host = NULL;
-}
+};
 
 iauthitems: iauthitem iauthitems | iauthitem;
 iauthitem: iauthpass | iauthhost | iauthport | iauthconnfreq | iauthtimeout | error;
index c03a6c004bcfc5ab16d2b5dc30b57de86dee3929..55e628ea0b7aa7d4b5100d995e46cbce6a21fafb 100644 (file)
 #include <string.h>
 #include <ctype.h>
 
+static int
+netride_modes(int parc, char **parv, const char *curr_key)
+{
+  char *modes = parv[0];
+  int result = 0;
+
+  assert(modes && modes[0] == '+');
+  while (*modes) {
+    switch (*modes++) {
+    case 'i':
+      result |= MODE_INVITEONLY;
+      break;
+    case 'k':
+      if (strcmp(curr_key, *++parv))
+        result |= MODE_KEY;
+      break;
+    case 'l':
+      ++parv;
+      break;
+    case 'r':
+      result |= MODE_REGONLY;
+      break;
+    }
+  }
+  return result;
+}
+
 /*
  * ms_burst - server message handler
  *
@@ -200,9 +227,11 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
      */
     for (param = 3; param < parc; param++)
     {
+      int check_modes;
       if (parv[param][0] != '+')
         continue;
-      if (strchr(parv[param], 'i') || strchr(parv[param], 'k'))
+      check_modes = netride_modes(parc - param, parv + param, chptr->mode.key);
+      if (check_modes)
       {
         /* Clear any outstanding rogue invites */
         mode_invite_clear(chptr);
@@ -211,6 +240,11 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
           nmember = member->next_member;
           if (!MyUser(member->user) || IsZombie(member))
             continue;
+          /* Kick as netrider if key mismatch *or* remote channel is +i
+           * *or* remote channel is +r and user has no account.
+           */
+          if ((check_modes == MODE_REGONLY) && IsAccount(member->user))
+            continue;
           sendcmdto_serv_butone(&me, CMD_KICK, NULL, "%H %C :Net Rider", chptr, member->user);
           sendcmdto_channel_butserv_butone(&me, CMD_KICK, chptr, NULL, 0, "%H %C :Net Rider", chptr, member->user);
           make_zombie(member, member->user, &me, &me, chptr);