Applied dcc-allow diff
authorMatthew Mondor <mmondor@pulsar-zone.net>
Thu, 13 Jan 2005 06:20:45 +0000 (06:20 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Thu, 13 Jan 2005 06:20:45 +0000 (06:20 +0000)
include/config.h
include/msg.h
include/struct.h
src/m_stats.c
src/s_misc.c
src/s_user.c
src/send.c

index 341b2cb..821e77c 100644 (file)
@@ -18,7 +18,7 @@
  *
  */
 
-/* $Id: config.h,v 1.1 2005/01/12 07:44:57 mmondor Exp $ */
+/* $Id: config.h,v 1.2 2005/01/13 06:20:44 mmondor Exp $ */
 
 #ifndef        __config_include__
 #define        __config_include__
 #define EXEMPT_LISTS
 #define INVITE_LISTS
 
+/* DCCALLOW
+ * Enable the DCCALLOW system. Has been included, but now you can
+ * disable it! :)
+ */
+#undef DCCALLOW
+
 /******************************************************************
  * STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP
  *
index 08910c7..77b3297 100644 (file)
@@ -19,7 +19,7 @@
  *
  */
 
-/* $Id: msg.h,v 1.1 2005/01/12 07:44:58 mmondor Exp $ */
+/* $Id: msg.h,v 1.2 2005/01/13 06:20:44 mmondor Exp $ */
 
 #ifndef        __msg_include__
 #define __msg_include__
 #define MSG_SQLINE   "SQLINE"          /* SQLINE */
 #define MSG_UNSQLINE "UNSQLINE"        /* UNSQLINE */
 #define MSG_BURST    "BURST"           /* BURST */
+#ifdef DCCALLOW
 #define MSG_DCCALLOW "DCCALLOW"                /* dccallow */
+#endif
 #define MSG_SGLINE   "SGLINE"           /* sgline */
 #define MSG_UNSGLINE "UNSGLINE"         /* unsgline */
 #define MSG_DKEY     "DKEY"            /* diffie-hellman negotiation */
@@ -211,7 +213,9 @@ extern int  m_watch(aClient *, aClient *, int, char **);
 extern int  m_sqline(aClient *, aClient *, int, char **);
 extern int  m_unsqline(aClient *, aClient *, int, char **);
 extern int  m_burst(aClient *, aClient *, int, char **);
+#ifdef DCCALLOW
 extern int  m_dccallow(aClient *, aClient *, int, char **);
+#endif
 extern int  m_sgline(aClient *, aClient *, int, char **);
 extern int  m_unsgline(aClient *, aClient *, int, char **);
 extern int  m_dkey(aClient *, aClient *, int, char **);
@@ -303,7 +307,9 @@ struct Message msgtab[] =
     {MSG_RAKILL,   m_rakill,   0, MAXPARA, 1, 0, 0, 0L}, 
     {MSG_SILENCE,  m_silence,  0, MAXPARA, 1, 0, 0, 0L },
     {MSG_WATCH, m_watch, 0, 1, 1, 0, 0, 0L },
+#ifdef DCCALLOW
     {MSG_DCCALLOW, m_dccallow, 0, 1, 1, 0, 0, 0L },
+#endif
     {MSG_SQLINE, m_sqline, 0, MAXPARA, 1, 0, 0, 0L},
     {MSG_UNSQLINE, m_unsqline, 0, MAXPARA, 1, 0, 0, 0L },
     {MSG_CAPAB, m_capab, 0, MAXPARA, 1, 1, 0, 0L},
index 523b93e..090efff 100644 (file)
@@ -20,7 +20,7 @@
  *
  */
 
-/* $Id: struct.h,v 1.2 2005/01/13 06:19:56 mmondor Exp $ */
+/* $Id: struct.h,v 1.3 2005/01/13 06:20:44 mmondor Exp $ */
 
 #ifndef        __struct_include__
 #define __struct_include__
@@ -131,11 +131,13 @@ typedef struct MotdItem aMotd;
 #define        MAXSILES        10
 #define        MAXSILELENGTH   128
 
+#ifdef DCCALLOW
 #define MAXDCCALLOW 5
 #define DCC_LINK_ME    0x01    /* This is my dcc allow */
 #define DCC_LINK_REMOTE 0x02    /* I need to remove these dcc allows from
                                 * these clients when I die
                                 */
+#endif
 
 #define        USERHOST_REPLYLEN       (NICKLEN+HOSTLEN+USERLEN+5)
 
@@ -289,10 +291,14 @@ typedef struct MotdItem aMotd;
 #define UMODE_h     0x20000     /* umode +h - Helper */
 #define UMODE_m     0x40000     /* umode +m - spambot notices */
 #define UMODE_R     0x80000     /* unmode +R - No non registered msgs */
+#ifdef DCCALLOW
 #define UMODE_e     0x100000    /* umode +e - oper notices for the above +D */
+#endif
 #define UMODE_x     0x200000    /* umode +x - Squelch with notice */
 #define UMODE_X     0x400000    /* umode +X - Squelch without notice */
+#ifdef DCCALLOW
 #define UMODE_D     0x800000    /* umode +D - Hidden dccallow umode */
+#endif
 #define UMODE_F     0x1000000   /* umode +F - no cptr->since message rate throttle */
 #define UMODE_j            0x2000000   /* umode +j - client rejection notices */
 #define UMODE_K     0x4000000   /* umode +K - U: lined server kill messages */
@@ -307,7 +313,9 @@ typedef struct MotdItem aMotd;
 #define DEBUG_LEV      5
 #define FLOOD_LEV      6
 #define SPAM_LEV       7
+#ifdef DCCALLOW
 #define DCCSEND_LEV    8
+#endif
 #define USKILL_LEV     9
 
 /* SEND_UMODES:
@@ -319,17 +327,30 @@ typedef struct MotdItem aMotd;
  */
 
 #define SEND_UMODES (UMODE_a|UMODE_i|UMODE_o|UMODE_r|UMODE_A|UMODE_I|UMODE_R)
+#ifdef DCCALLOW
 #define ALL_UMODES (SEND_UMODES|UMODE_b|UMODE_c|UMODE_d|UMODE_e|UMODE_f|\
                     UMODE_g|UMODE_h|UMODE_j|UMODE_k|UMODE_m|UMODE_n|UMODE_s|\
                     UMODE_w|UMODE_y|UMODE_F|UMODE_K|UMODE_O)
+#else
+#define ALL_UMODES (SEND_UMODES|UMODE_b|UMODE_c|UMODE_d|UMODE_f|\
+                    UMODE_g|UMODE_h|UMODE_j|UMODE_k|UMODE_m|UMODE_n|UMODE_s|\
+                    UMODE_w|UMODE_y|UMODE_F|UMODE_K|UMODE_O)
+#endif
+
 
 /* modes users can set themselves */
 #define USER_UMODES (UMODE_i|UMODE_k|UMODE_w|UMODE_s|UMODE_R)
 
 /* modes only opers can have */
+#ifdef DCCALLOW
 #define OPER_UMODES (UMODE_a|UMODE_b|UMODE_c|UMODE_d|UMODE_e|UMODE_f|UMODE_g|\
                      UMODE_h|UMODE_j|UMODE_m|UMODE_n|UMODE_y|UMODE_A|UMODE_F|\
                      UMODE_K)
+#else
+#define OPER_UMODES (UMODE_a|UMODE_b|UMODE_c|UMODE_d|UMODE_f|UMODE_g|\
+                     UMODE_h|UMODE_j|UMODE_m|UMODE_n|UMODE_y|UMODE_A|UMODE_F|\
+                     UMODE_K)
+#endif
 
 #define        FLAGS_ID (FLAGS_DOID|FLAGS_GOTID)
 
@@ -350,7 +371,9 @@ typedef struct MotdItem aMotd;
 #define IsUmoden(x)             ((x)->umode & UMODE_n)
 #define IsUmodem(x)             ((x)->umode & UMODE_m)
 #define IsUmodeh(x)             ((x)->umode & UMODE_h)
+#ifdef DCCALLOW
 #define IsUmodee(x)             ((x)->umode & UMODE_e)
+#endif
 #define IsUmodej(x)            ((x)->umode & UMODE_j)
 #define        IsUmodeK(x)             ((x)->umode & UMODE_K)
 #define        IsUmodek(x)             ((x)->umode & UMODE_k)
@@ -369,7 +392,9 @@ typedef struct MotdItem aMotd;
 #define SendSkillNotice(x)     ((x)->umode & UMODE_k)
 #define SendSUkillNotice(x)    ((x)->umode & UMODE_K)
 #define SendSpyNotice(x)       ((x)->umode & UMODE_y)
+#ifdef DCCALLOW
 #define SendDCCNotice(x)       ((x)->umode & UMODE_e)
+#endif
 #define SendFloodNotice(x)      ((x)->umode & UMODE_f)
 #define SendSpamNotice(x)       ((x)->umode & UMODE_m)
 #define SendDebugNotice(x)     ((x)->umode & UMODE_d)
@@ -394,8 +419,10 @@ typedef struct MotdItem aMotd;
 #define        DoingDNS(x)             ((x)->flags & FLAGS_DOINGDNS)
 #define        DoingAuth(x)            ((x)->flags & FLAGS_AUTH)
 #define        NoNewLine(x)            ((x)->flags & FLAGS_NONL)
+#ifdef DCCALLOW
 #define SeenDCCNotice(x)        ((x)->umode & UMODE_D)
 #define SetDCCNotice(x)         ((x)->umode |= UMODE_D)
+#endif
 
 #define SetNegoServer(x)       ((x)->flags |= FLAGS_SERV_NEGO)
 #define IsNegoServer(x)                ((x)->flags & FLAGS_SERV_NEGO)
@@ -422,7 +449,9 @@ typedef struct MotdItem aMotd;
 #define ClearUmodeb(x)          ((x)->umode &= ~UMODE_b)
 #define ClearUmoden(x)          ((x)->umode &= ~UMODE_n)
 #define ClearUmodeh(x)          ((x)->umode &= ~UMODE_h)
+#ifdef DCCALLOW
 #define ClearUmodee(x)          ((x)->umode &= ~UMODE_e)
+#endif
 #define ClearUmodej(x)         ((x)->umode &= ~UMODE_j)
 #define ClearUmodeK(x)         ((x)->umode &= ~UMODE_K)
 #define ClearUmodek(x)         ((x)->umode &= ~UMODE_k)
@@ -789,7 +818,9 @@ struct User
      */
     Link       *silence;      /* chain of silenced users */
     LOpts         *lopt;     /* Saved /list options */
+#ifdef DCCALLOW
     Link       *dccallow;     /* chain of dcc send allowed users */
+#endif
 #if (RIDICULOUS_PARANOIA_LEVEL>=1)
     char       *real_oper_host;
     char       *real_oper_username;
index 079e4d3..86da888 100644 (file)
@@ -19,7 +19,7 @@
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-/* $Id: m_stats.c,v 1.1 2005/01/12 07:44:56 mmondor Exp $ */
+/* $Id: m_stats.c,v 1.2 2005/01/13 06:20:45 mmondor Exp $ */
 
 #include "struct.h"
 #include "common.h"
@@ -392,8 +392,10 @@ count_memory(aClient *cptr, char *nick)
     int         ch = 0;
     int         usi = 0;        /* users invited */
     int         usc = 0;        /* users in channels */
+#ifdef DCCALLOW
     int         usdm = 0;       /* dccallow local */
     int         usdr = 0;       /* dccallow remote */
+#endif
     int         uss = 0;        /* silenced users */
     int         aw = 0;         /* aways set */
     int         number_servers_cached;  /* number of servers cached by
@@ -481,6 +483,7 @@ count_memory(aClient *cptr, char *nick)
             for (link = acptr->user->channel; link;
                  link = link->next)
                 usc++;
+#ifdef DCCALLOW
             for (link = acptr->user->dccallow; link;
                  link = link->next)
             {
@@ -489,6 +492,7 @@ count_memory(aClient *cptr, char *nick)
                 else
                     usdr++;
             }
+#endif
             for (link = acptr->user->silence; link;
                  link = link->next)
                 uss++;
@@ -562,7 +566,11 @@ count_memory(aClient *cptr, char *nick)
                * free_cloneents->elemsPerBlock;
     cloneallocsz = clonealloc * free_cloneents->elemSize;
 
+#ifdef DCCALLOW
     totallinks = lcc + usi +  uss + usc + chi + wle + fludlink + usdm + usdr;
+#else
+    totallinks = lcc + usi +  uss + usc + chi + wle + fludlink;
+#endif
 
     sendto_one(cptr, ":%s %d %s :Memory Use Summary",
                me.name, RPL_STATSDEBUG, nick);
@@ -587,9 +595,11 @@ count_memory(aClient *cptr, char *nick)
                chi * sizeof(Link));
     sendto_one(cptr, ":%s %d %s :   UserChannels %d(%d)",
                me.name, RPL_STATSDEBUG, nick, usc, usc * sizeof(Link));
+#ifdef DCCALLOW
     sendto_one(cptr, ":%s %d %s :   DCCAllow Local %d(%d) Remote %d(%d)",
                me.name, RPL_STATSDEBUG, nick, usdm, usdm * sizeof(Link),
                usdr, usdr * sizeof(Link));
+#endif
     sendto_one(cptr, ":%s %d %s :   WATCH entries %d(%d)",
                me.name, RPL_STATSDEBUG, nick, wle, wle*sizeof(Link));
     sendto_one(cptr, ":%s %d %s :   Fludees %d(%d)",
index 6ddfe4c..ee7dc69 100644 (file)
@@ -21,7 +21,7 @@
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-/* $Id: s_misc.c,v 1.1 2005/01/12 07:44:57 mmondor Exp $ */
+/* $Id: s_misc.c,v 1.2 2005/01/13 06:20:45 mmondor Exp $ */
 
 #include <sys/time.h>
 #include "struct.h"
@@ -329,6 +329,7 @@ my_name_for_link(char *name, aConnect *aconn)
     return namebuf;
 }
 
+#ifdef DCCALLOW
 int remove_dcc_references(aClient *sptr)
 {  
     aClient *acptr;
@@ -372,6 +373,7 @@ int remove_dcc_references(aClient *sptr)
     }
     return 0;
 }  
+#endif
 
 /*
  * NOQUIT
@@ -414,7 +416,9 @@ exit_one_client_in_split(aClient *cptr, aClient *dead, char *reason)
     if (cptr->ip.s_addr)
         clones_remove(cptr);
 
+#ifdef DCCALLOW
     remove_dcc_references(cptr);
+#endif
 
     del_from_client_hash_table(cptr->name, cptr); 
 
@@ -800,7 +804,9 @@ exit_one_client(aClient *cptr, aClient *sptr, aClient *from, char *comment)
             /* Clean up silences */
             while ((lp = sptr->user->silence)) 
                 del_silence(sptr, lp->value.cp);
+#ifdef DCCALLOW
             remove_dcc_references(sptr);
+#endif
             /* again, this is all that is needed */
         }
     }
index 797048d..2db04b5 100644 (file)
@@ -21,7 +21,7 @@
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-/* $Id: s_user.c,v 1.2 2005/01/13 06:19:56 mmondor Exp $ */
+/* $Id: s_user.c,v 1.3 2005/01/13 06:20:45 mmondor Exp $ */
 
 #include "struct.h"
 #include "common.h"
@@ -73,7 +73,9 @@ int  user_modes[] =
     UMODE_k, 'k',
     UMODE_y, 'y',
     UMODE_d, 'd',
+#ifdef DCCALLOW
     UMODE_e, 'e',
+#endif
     UMODE_g, 'g',
     UMODE_b, 'b',
     UMODE_a, 'a',
@@ -120,8 +122,9 @@ int         spam_num = MAX_JOIN_LEAVE_COUNT;
 #define CTCP_NONE       0
 #define CTCP_YES        1
 #define CTCP_DCC        2
+#ifdef DCCALLOW
 #define CTCP_DCCSEND    3
-
+#endif
 
 /*
  * cptr:
@@ -1110,6 +1113,7 @@ register_user(aClient *cptr, aClient *sptr, char *nick, char *username)
     return 0;
 }
 
+#ifdef DCCALLOW
 char *exploits_2char[] =
 {
     "js",
@@ -1308,6 +1312,7 @@ check_dccsend(aClient *from, aClient *to, char *msg)
     }
     return 0;
 }
+#endif /* DCCALLOW */
 
 /*
  * check target limit: message target rate limiting
@@ -1407,9 +1412,11 @@ check_for_ctcp(char *str, char **dccptr)
         {
             if(dccptr)
                 *dccptr = p;
+#ifdef DCCALLOW
             if(myncmp(p+3, " SEND", 5) == 0)
                 return CTCP_DCCSEND;
             else
+#endif
                 return CTCP_DCC;
         }
         if (myncmp(++p, "ACTION", 6) != 0)
@@ -1543,7 +1550,9 @@ m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int notice)
                     case CTCP_NONE:
                         break;
 
+#ifdef DCCALLOW
                     case CTCP_DCCSEND:
+#endif
                     case CTCP_DCC:
                         sendto_one(sptr, ":%s NOTICE %s :You may not send a"
                                    " DCC command to a channel (%s)", 
@@ -1618,6 +1627,7 @@ m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int notice)
                         case CTCP_NONE:
                             break;
                     
+#ifdef DCCALLOW
                         case CTCP_DCCSEND:
 #ifdef FLUD
                             if (check_for_flud(sptr, acptr, NULL, 1))
@@ -1626,6 +1636,7 @@ m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int notice)
                             if(check_dccsend(sptr, acptr, dccmsg))
                                 continue;
                             break;
+#endif
                     
                         default:
 #ifdef FLUD
@@ -3674,6 +3685,7 @@ m_silence(aClient *cptr,aClient *sptr,int parc,char *parv[])
     return 0;
 }
 
+#ifdef DCCALLOW
 static int 
 add_dccallow(aClient *sptr, aClient *optr)
 {
@@ -3906,3 +3918,4 @@ m_dccallow(aClient *cptr, aClient *sptr, int parc, char *parv[])
     
     return 0;
 }
+#endif /* DCCALLOW */
index 871ba9f..f6f494c 100644 (file)
@@ -18,7 +18,7 @@
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-/* $Id: send.c,v 1.1 2005/01/12 07:44:57 mmondor Exp $ */
+/* $Id: send.c,v 1.2 2005/01/13 06:20:45 mmondor Exp $ */
 
 #include "struct.h"
 #include "common.h"
@@ -1236,9 +1236,11 @@ void sendto_ops_lev(int lev, char *pattern, ...)
           tmsg = "Flood";
           break;
 
+#ifdef DCCALLOW
        case DCCSEND_LEV:
           tmsg = "DCCAllow";
           break;
+#endif
 
        default:
           tmsg = "Notice";
@@ -1273,10 +1275,12 @@ void sendto_ops_lev(int lev, char *pattern, ...)
                 if (!SendSpyNotice(cptr) || !IsAnOper(cptr))
                     continue;
                 break;
+#ifdef DCCALLOW
             case DCCSEND_LEV:
                 if (!SendDCCNotice(cptr) || !IsAnOper(cptr))
                     continue;
                 break;
+#endif
             case FLOOD_LEV:
                 if (!SendFloodNotice(cptr) || !IsAnOper(cptr))
                     continue;
@@ -1759,9 +1763,11 @@ void sendto_realops_lev(int lev, char *pattern, ...)
           tmsg = "Flood";
           break;
 
+#ifdef DCCALLOW
        case DCCSEND_LEV:
           tmsg = "DCCAllow";
           break;
+#endif
 
        default:
           tmsg = "Notice";
@@ -1795,10 +1801,12 @@ void sendto_realops_lev(int lev, char *pattern, ...)
                 if (!SendSpyNotice(cptr))
                     continue;
                 break;
+#ifdef DCCALLOW
             case DCCSEND_LEV:
                 if (!SendDCCNotice(cptr))
                     continue;
                 break;
+#endif
             case FLOOD_LEV:
                 if (!SendFloodNotice(cptr))
                     continue;