Browse Source

* DISABLED: invite hijack detection and cmd_iop
These features although awesome, were not finishsed and would require
another week at least to finish, and I'd rather just wait until they
are finished and release with 1.2.2


svn: 1699

Bryan Drewery 21 years ago
parent
commit
4c15df5b1a
5 changed files with 27 additions and 6 deletions
  1. 4 2
      doc/UPDATES
  2. 10 3
      src/mod/irc.mod/chan.c
  3. 4 0
      src/mod/irc.mod/cmdsirc.c
  4. 6 0
      src/mod/irc.mod/irc.c
  5. 3 1
      src/mod/irc.mod/irc.h

+ 4 - 2
doc/UPDATES

@@ -1,5 +1,7 @@
 This is a summary of ChangeLog basically.
 
+Lines prefixxed with '-' were disabled before release and are not finishsed.
+
 1.2.1
 
 * No longer reading in /etc/hosts, still reading .hosts though
@@ -41,8 +43,8 @@ This is a summary of ChangeLog basically.
 * WHO parsing was redundant and had a ton of inner loops per line, fixed.
 * Fixed a problem with leaf bots not chosing a hub when only 1 was set.
 * Fixed cmd_channel showing a user as an op in a +private chan where they might have not access.
-* Added cmd_iop which will invite the specified nick to a chan and then auto-op them upon joining (does a userhost)
-* Added hijacked invite detection based on server invite notices.
+- Added cmd_iop which will invite the specified nick to a chan and then auto-op them upon joining (does a userhost)
+- Added hijacked invite detection based on server invite notices.
 * Added an action when a bot performs an invite, including username and full address.
 * No longer making the bot fatal() if it cannot open a new socket.
 * Fixed NAT bug for botlinks.

+ 10 - 3
src/mod/irc.mod/chan.c

@@ -1266,6 +1266,7 @@ void recheck_channel(struct chanset_t *chan, int dobans)
   stacking--;
 }
 
+#ifdef CACHE
 /* got 302: userhost
  * <server> 302 <to> :<nick??user@host>
  */
@@ -1383,7 +1384,7 @@ static int got341(char *from, char *msg)
   dprintf(DP_DUMP, "PRIVMSG %s :ALERT! \002%s was invited via a hijacked connection/process.\002\n", chan->name, nick);
   return 0;
 }
-
+#endif /* CACHE */
 
 /* got 324: mode status
  * <server> 324 <to> <channel> <mode>
@@ -2369,8 +2370,9 @@ static int gotjoin(char *from, char *chname)
 	    m->flags |= SENTKICK;
 	  }
 	}
-        cache_t *cache = cache_find(nick);
         bool op = 0;
+#ifdef CACHE
+        cache_t *cache = cache_find(nick);
 
         if (cache) {
           cache_chan_t *cchan = NULL;
@@ -2390,6 +2392,7 @@ static int gotjoin(char *from, char *chname)
             }
           }
         }
+#endif /* CACHE */
         if (!splitjoin && !chan_hasop(m) && (op || (dovoice(chan) && chk_autoop(fr, chan)))) {
           do_op(m->nick, chan, 1, 0);
         }
@@ -2722,11 +2725,13 @@ static int gotquit(char *from, char *msg)
       dprintf(DP_SERVER, "NICK %s\n", origbotname);
     }
   }
+#ifdef CACHE
   /* see if they were in our cache at all */
   cache_t *cache = cache_find(nick);
 
   if (cache) 
     cache_del(nick, cache);
+#endif /* CACHE */
 
   return 0;
 }
@@ -3001,9 +3006,11 @@ static int gotnotice(char *from, char *msg)
 
 static cmd_t irc_raw[] =
 {
+#ifdef CACHE
   {"302",       "",     (Function) got302,      "irc:302"},
-  {"324",	"",	(Function) got324,	"irc:324"},
   {"341",       "",     (Function) got341,      "irc:341"},
+#endif /* CACHE */
+  {"324",	"",	(Function) got324,	"irc:324"},
   {"352",	"",	(Function) got352,	"irc:352"},
   {"354",	"",	(Function) got354,	"irc:354"},
   {"315",	"",	(Function) got315,	"irc:315"},

+ 4 - 0
src/mod/irc.mod/cmdsirc.c

@@ -1239,10 +1239,12 @@ static void cmd_invite(int idx, char *par)
   do_invite(idx, par, 0);
 }
 
+#ifdef CACHE
 static void cmd_iop(int idx, char *par)
 {
   do_invite(idx, par, 1);
 }
+#endif /* CACHE */
 
 static void cmd_authed(int idx, char *par)
 {
@@ -1693,7 +1695,9 @@ static cmd_t irc_dcc[] =
   {"getkey",            "o|o",   (Function) cmd_getkey,         NULL},
   {"find",		"",	 (Function) cmd_find,		NULL},
   {"invite",		"o|o",	 (Function) cmd_invite,		NULL},
+#ifdef CACHE
   {"iop",		"o|o",	 (Function) cmd_iop,		NULL},
+#endif /* CACHE */
   {"kick",		"o|o",	 (Function) cmd_kick,		NULL},
   {"kickban",		"o|o",	 (Function) cmd_kickban,	NULL},
   {"mdop",              "n|n",	 (Function) cmd_mdop,		NULL},

+ 6 - 0
src/mod/irc.mod/irc.c

@@ -36,7 +36,9 @@
 #define PRIO_DEOP 1
 #define PRIO_KICK 2
 
+#ifdef CACHE
 static cache_t *irccache = NULL;
+#endif /* CACHE */
 
 static int net_type = 0;
 static time_t wait_split = 300;    /* Time to wait for user to return from
@@ -111,6 +113,7 @@ void notice_invite(struct chanset_t *chan, char *handle, char *nick, char *uhost
     chan->name, fhandle, nick, uhost ? "!" : "", uhost ? uhost : "", chan->dname, op ? ops : "");
 }
 
+#ifdef CACHE
 static cache_t *cache_new(char *nick)
 {
   cache_t *cache = (cache_t *) my_calloc(1, sizeof(cache_t));
@@ -203,9 +206,11 @@ static void cache_debug(void)
       dprintf(DP_MODE, "PRIVMSG #wraith :%s %d %d %d\n", cchan->dname, cchan->ban, cchan->invite, cchan->invited);
   }
 }
+#endif /* CACHE */
 
 static void cache_invite(struct chanset_t *chan, char *nick, char *host, char *handle, bool op, bool bot)
 {
+#ifdef CACHE
   cache_t *cache = NULL;
 
   if ((cache = cache_find(nick)) == NULL)
@@ -240,6 +245,7 @@ static void cache_invite(struct chanset_t *chan, char *nick, char *host, char *h
   /* if we have a uhost already, it's safe to invite them */
   cchan->invited = 1;
   cchan->invite = 0;
+#endif /* CACHE */
   dprintf(DP_SERVER, "INVITE %s %s\n", nick, chan->name);
 }
 

+ 3 - 1
src/mod/irc.mod/irc.h

@@ -21,6 +21,7 @@ enum { BC_NOCOOKIE = 1, BC_SLACK, BC_HASH };
 
 #ifdef MAKING_IRC
 
+#ifdef CACHE
 typedef struct cache_chan_b {
   struct cache_chan_b *next;
   bool invite;		/* set to invite on userhost */
@@ -49,11 +50,12 @@ static void cache_chan_del(char *, char *);
 //static cache_chan_t *cache_chan_find(cache_t *, char *, char *);
 static void cache_chan_find(cache_t *, cache_chan_t *, char *, char *);
 static cache_chan_t *cache_chan_add(cache_t *, char *);
-static void cache_invite(struct chanset_t *, char *, char *, char *, bool, bool);
 static cache_t *cache_find(char *);
 static cache_t *cache_new(char *);
 static void cache_del(char *, cache_t *);
 static void cache_debug(void);
+#endif /* CACHE */
+static void cache_invite(struct chanset_t *, char *, char *, char *, bool, bool);
 
 static int check_bind_pubc(char *, char *, char *, struct userrec *, char *, char *);
 static char *makecookie(char *, char *);