Kaynağa Gözat

Removed userflag +f (friend), it's a major security flaw. Flood-exempt is +x.

svn: 85
Bryan Drewery 23 yıl önce
ebeveyn
işleme
6895be4ca9

+ 1 - 2
src/chan.h

@@ -233,7 +233,7 @@ struct chanset_t {
 #define CHAN_DONTKICKOPS    0x1000	   /* never kick +o flag people -arthur2 */
 #define CHAN_INACTIVE       0x2000	   /* no irc support for this channel
                                          - drummer                           */
-#define CHAN_PROTECTFRIENDS 0x4000	   /* re-op any +f people who get deop'd */
+#define CHAN_               0x4000	   /* unused */
 #define CHAN_VOICE          0x8000	   /* a bot +y|y will voice *, except +q */
 #define CHAN_SEEN           0x10000
 #define CHAN_REVENGEBOT     0x20000	   /* revenge on actions against the bot */
@@ -279,7 +279,6 @@ struct chanset_t *findchan_by_dname(const char *name);
 #define channel_dynamicbans(chan) (chan->status & CHAN_DYNAMICBANS)
 #define channel_nouserbans(chan) (chan->status & CHAN_NOUSERBANS)
 #define channel_protectops(chan) (chan->status & CHAN_PROTECTOPS)
-#define channel_protectfriends(chan) (chan->status & CHAN_PROTECTFRIENDS)
 #define channel_autovoice(chan) (0)
 #define channel_dontkickops(chan) (chan->status & CHAN_DONTKICKOPS)
 #define channel_secret(chan) (chan->status & CHAN_SECRET)

+ 3 - 3
src/chanprog.c

@@ -453,7 +453,7 @@ void load_internal_users()
         break;
       case 4:
 	if (!get_user_by_handle(userlist, hand)) {
-	  userlist = adduser(userlist, hand, "none", "-", USER_BOT | USER_OP | USER_FRIEND);
+	  userlist = adduser(userlist, hand, "none", "-", USER_BOT | USER_OP);
 /* no thanks.
           if (atoi(hublevel) < 999 && strcmp(hand, origbotname)) {
             u = get_user_by_handle(userlist, hand);
@@ -537,7 +537,7 @@ void load_internal_users()
 	  strncat(owner, ",", 120);
 	strncat(owner, hand, 120);
 	if (!get_user_by_handle(userlist, hand)) {
-	  userlist = adduser(userlist, hand, "none", "-", USER_ADMIN | USER_OWNER | USER_MASTER | USER_FRIEND | USER_OP | USER_PARTY | USER_HUBA | USER_CHUBA);
+	  userlist = adduser(userlist, hand, "none", "-", USER_ADMIN | USER_OWNER | USER_MASTER | USER_OP | USER_PARTY | USER_HUBA | USER_CHUBA);
 	  u = get_user_by_handle(userlist, hand);
 	  set_user(&USERENTRY_PASS, u, pass);
 	  while (hosts) {
@@ -609,7 +609,7 @@ void chanprog()
 
   if (!(u = get_user_by_handle(userlist, botnetnick))) {
     /* I need to be on the userlist... doh. */
-    userlist = adduser(userlist, botnetnick, STR("none"), "-", USER_BOT | USER_OP | USER_FRIEND);
+    userlist = adduser(userlist, botnetnick, STR("none"), "-", USER_BOT | USER_OP );
     u = get_user_by_handle(userlist, botnetnick);
     bi = user_malloc(sizeof(struct bot_addr));
 

+ 1 - 1
src/cmds.c

@@ -2887,7 +2887,7 @@ static void cmd_newleaf(struct userrec *u, int idx, char *par)
     else if (strchr(BADHANDCHARS, handle[0]) != NULL)
       dprintf(idx, STR("You can't start a botnick with '%c'.\n"), handle[0]);
     else {
-      userlist = adduser(userlist, handle, STR("none"), "-", USER_BOT | USER_FRIEND | USER_OP);
+      userlist = adduser(userlist, handle, STR("none"), "-", USER_BOT | USER_OP);
       u1 = get_user_by_handle(userlist, handle);
       bi = user_malloc(sizeof(struct bot_addr));
 

+ 2 - 2
src/dcc.c

@@ -34,7 +34,7 @@ extern Tcl_Interp	*interp;
 extern time_t		 now;
 extern int		 egg_numver, connect_timeout, conmask, backgrd,
 			 max_dcc, default_flags, debug_output,
-			 ignore_time, par_telnet_flood;
+			 ignore_time;
 extern char		 botnetnick[], ver[], origbotname[], notify_new[];
 
 
@@ -1190,7 +1190,7 @@ static int detect_telnet_flood(char *floodhost)
   struct flag_record fr = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
 
   get_user_flagrec(get_user_by_host(floodhost), &fr, NULL);
-  if (!flood_telnet_thr || (glob_friend(fr) && !par_telnet_flood))
+  if (!flood_telnet_thr || glob_noflood(fr))
     return 0;			/* No flood protection */
   if (egg_strcasecmp(lasttelnethost, floodhost)) {	/* New... */
     strcpy(lasttelnethost, floodhost);

+ 1 - 3
src/flags.h

@@ -63,7 +63,7 @@ struct flag_record {
 #define USER_CHANHUB       0x00000004 /* c  bot is a chanhub    */
 #define USER_DEOP          0x00000008 /* d  user is global de-op              */
 #define USER_EXEMPT        0x00000010 /* e  exempted from stopnethack         */
-#define USER_FRIEND        0x00000020 /* f  user is global friend             */
+#define USER_F             0x00000020 /* f  unused             */
 #define USER_G             0x00000040 /* g  unused                            */
 #define USER_H             0x00000080 /* h  unused                            */
 #define USER_HUBA          0x00000100 /* i  access to HUBS        */
@@ -156,8 +156,6 @@ struct flag_record {
 #define glob_wasoptest(x)		((x).global & USER_WASOPTEST)
 #define chan_quiet(x)			((x).chan & USER_QUIET)
 #define glob_quiet(x)			((x).global & USER_QUIET)
-#define chan_friend(x)			((x).chan & USER_FRIEND)
-#define glob_friend(x)			((x).global & USER_FRIEND)
 #define glob_party(x)			((x).global & USER_PARTY)
 #define glob_hilite(x) 			((x).global & USER_HIGHLITE)
 #define chan_exempt(x)			((x).chan & USER_EXEMPT)

+ 0 - 3
src/mod/channels.mod/channels.c

@@ -663,8 +663,6 @@ static void channels_report(int idx, int details)
 	  i += my_strcpy(s + i, "bitch ");
 	if (channel_protectops(chan))
 	  i += my_strcpy(s + i, "protectops ");
-	if (channel_protectfriends(chan))
-	  i += my_strcpy(s + i, "protectfriends ");
 	if (channel_dontkickops(chan))
 	  i += my_strcpy(s + i, "dontkickops ");
 	if (channel_revenge(chan))
@@ -1037,7 +1035,6 @@ char *channels_start(Function * global_funcs)
 	 "+cycle "
 	 "+dontkickops "
 	 "-inactive "
-	 "-protectfriends "
 	 "+userexempts "
 	 "-dynamicexempts "
 	 "+userinvites "

+ 1 - 2
src/mod/channels.mod/cmdschan.c

@@ -1501,9 +1501,8 @@ static void cmd_chaninfo(struct userrec *u, int idx, char *par)
 	    (chan->status & CHAN_PRIVATE) ? '+' : '-',
 	    (chan->status & CHAN_CYCLE) ? '+' : '-',
 	    (chan->status & CHAN_DONTKICKOPS) ? '+' : '-');
-    dprintf(idx, "     %cprotectops     %cprotectfriends %crevenge        %crevengebot\n",
+    dprintf(idx, "     %cprotectops     %crevenge        %crevengebot\n",
 	    (chan->status & CHAN_PROTECTOPS) ? '+' : '-',
-	    (chan->status & CHAN_PROTECTFRIENDS) ? '+' : '-',
 	    (chan->status & CHAN_REVENGE) ? '+' : '-',
 	    (chan->status & CHAN_REVENGEBOT) ? '+' : '-');
     dprintf(idx, "     %cbitch          %cnodesynch\n",

+ 3 - 10
src/mod/channels.mod/tclchan.c

@@ -782,10 +782,6 @@ static int tcl_channel_info(Tcl_Interp * irp, struct chanset_t *chan)
     Tcl_AppendElement(irp, "+protectops");
   else
     Tcl_AppendElement(irp, "-protectops");
-  if (chan->status & CHAN_PROTECTFRIENDS)
-    Tcl_AppendElement(irp, "+protectfriends");
-  else
-    Tcl_AppendElement(irp, "-protectfriends");
   if (chan->status & CHAN_DONTKICKOPS)
     Tcl_AppendElement(irp, "+dontkickops");
   else
@@ -938,7 +934,6 @@ static int tcl_channel_get(Tcl_Interp * irp, struct chanset_t *chan, char *setti
   else if CHKFLAG_NEG(CHAN_NOUSERBANS,     "userbans",       chan->status)
   else if CHKFLAG_POS(CHAN_BITCH,          "bitch",          chan->status)
   else if CHKFLAG_POS(CHAN_PROTECTOPS,     "protectops",     chan->status)
-  else if CHKFLAG_POS(CHAN_PROTECTFRIENDS, "protectfriends", chan->status)
   else if CHKFLAG_POS(CHAN_DONTKICKOPS,    "dontkickops",    chan->status)
   else if CHKFLAG_POS(CHAN_INACTIVE,       "inactive",       chan->status)
   else if CHKFLAG_POS(CHAN_REVENGE,        "revenge",        chan->status)
@@ -1243,10 +1238,6 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan,
       chan->status |= CHAN_PROTECTOPS;
     else if (!strcmp(item[i], "-protectops"))
       chan->status &= ~CHAN_PROTECTOPS;
-    else if (!strcmp(item[i], "+protectfriends"))
-      chan->status |= CHAN_PROTECTFRIENDS;
-    else if (!strcmp(item[i], "-protectfriends"))
-      chan->status &= ~CHAN_PROTECTFRIENDS;
     else if (!strcmp(item[i], "+dontkickops"))
       chan->status |= CHAN_DONTKICKOPS;
     else if (!strcmp(item[i], "-dontkickops"))
@@ -1319,7 +1310,7 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan,
       chan->status |= CHAN_FASTOP;
     }
     else if (!strcmp(item[i], "-fastop"))
-      chan->status &= ~(CHAN_FASTOP | CHAN_PROTECTFRIENDS | CHAN_PROTECTOPS | CHAN_DONTKICKOPS);
+      chan->status &= ~(CHAN_FASTOP | CHAN_PROTECTOPS | CHAN_DONTKICKOPS);
     else if (!strcmp(item[i], "+private")) {
       chan->status |= CHAN_PRIVATE;
     }
@@ -1332,6 +1323,8 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan,
     else if (!strcmp(item[i], "-nomdop"))  ;
     else if (!strcmp(item[i], "+nomop"))  ;
     else if (!strcmp(item[i], "-nomop"))  ;
+    else if (!strcmp(item[i], "+protectfriends"))  ;
+    else if (!strcmp(item[i], "-protectfriends"))  ;
     else if (!strcmp(item[i], "+punish"))  ;
     else if (!strcmp(item[i], "-punish"))  ;
     else if (!strcmp(item[i], "+seen"))  ;

+ 1 - 2
src/mod/channels.mod/userchan.c

@@ -1337,7 +1337,7 @@ flood-kick %d:%d flood-deop %d:%d flood-nick %d:%d \
 ban-time %d \
 exempt-time %d invite-time %d \
 %cenforcebans %cdynamicbans %cuserbans %cbitch \
-%cprotectops %cprotectfriends %cdontkickops \
+%cprotectops %cdontkickops \
 %crevenge %crevengebot %cprivate \
 %ccycle %cinactive \
 %cdynamicexempts %cuserexempts %cdynamicinvites %cuserinvites \
@@ -1375,7 +1375,6 @@ exempt-time %d invite-time %d \
 	PLSMNS(!channel_nouserbans(chan)),
 	PLSMNS(channel_bitch(chan)),
 	PLSMNS(channel_protectops(chan)),
-	PLSMNS(channel_protectfriends(chan)),
 	PLSMNS(channel_dontkickops(chan)),
 	PLSMNS(channel_revenge(chan)),
 	PLSMNS(channel_revengebot(chan)),

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

@@ -1207,10 +1207,6 @@ static void cmd_channel(struct userrec *u, int idx, char *par)
         atrflag = 'V';
       else if (chan_voice(user))
         atrflag = 'v';
-      else if (glob_friend(user))
-        atrflag = 'F';
-      else if (chan_friend(user))
-        atrflag = 'f';
       else if (glob_kick(user))
         atrflag = 'K';
       else if (chan_kick(user))

+ 5 - 12
src/mod/irc.mod/irc.c

@@ -636,10 +636,8 @@ static int want_to_revenge(struct chanset_t *chan, struct userrec *u,
 
   get_user_flagrec(u, &fr, chan->dname);
 
-  /* Kickee is not a friend? */
-  if (!chan_friend(fr) && !glob_friend(fr) &&
-      /* ... and they didn't kick themself? */
-      rfc_casecmp(badnick, victim)) {
+  /* Kickee didn't kick themself? */
+  if (rfc_casecmp(badnick, victim)) {
     /* They kicked me? */
     if (mevictim) {
       /* ... and I'm allowed to take revenge? <snicker> */
@@ -651,11 +649,8 @@ static int want_to_revenge(struct chanset_t *chan, struct userrec *u,
 
       get_user_flagrec(u2, &fr2, chan->dname);
       /* Protecting friends? */
-      if ((channel_protectfriends(chan) &&
-	   /* ... and victim is valid friend? */
-	   (chan_friend(fr2) || (glob_friend(fr2) && !chan_deop(fr2)))) ||
-	  /* ... or protecting ops */
-	  (channel_protectops(chan) &&
+      /* Protecting ops? */
+      if ((channel_protectops(chan) &&
 	   /* ... and kicked is valid op? */
 	   (chan_op(fr2) || (glob_op(fr2) && !chan_deop(fr2)))))
 	return 1;
@@ -1190,9 +1185,7 @@ static void check_expired_chanstuff()
 	      sprintf(s, "%s!%s", m->nick, m->userhost);
 	      get_user_flagrec(m->user ? m->user : get_user_by_host(s),
 			       &fr, chan->dname);
-              if (!(glob_bot(fr) || glob_friend(fr) ||
-                  (glob_op(fr) && !glob_deop(fr)) ||
-                   chan_friend(fr) || chan_op(fr))) {
+              if (!(glob_bot(fr) || (glob_op(fr) && !glob_deop(fr)) || chan_op(fr))) {
 		dprintf(DP_SERVER, "KICK %s %s :%sidle %d min\n", chan->name,
 			m->nick, kickprefix, chan->idle_kick);
 		m->flags |= SENTKICK;

+ 3 - 7
src/mod/irc.mod/mode.c

@@ -589,9 +589,6 @@ static void got_deop(struct chanset_t *chan, char *nick, char *from,
       if (channel_protectops(chan) && (glob_master(victim) || chan_master(victim) ||
 	       glob_op(victim) || chan_op(victim)))
 	ok = 0;
-      else if (channel_protectfriends(chan) && (glob_friend(victim) ||
-	       chan_friend(victim)))
-	ok = 0;
     }
 
     /* do we want to reop victim? */
@@ -673,8 +670,8 @@ static void got_ban(struct chanset_t *chan, char *nick, char *from, char *who)
 	    get_user_flagrec(u, &victim, chan->dname);
           if (channel_private(chan) && !glob_bot(victim) && !chan_op(victim) && !glob_owner(victim))
             goto skip;
-          if ((glob_friend(victim) || (glob_op(victim) && !chan_deop(victim)) ||
-              chan_friend(victim) || chan_op(victim)) && !glob_master(user) &&
+          if (((glob_op(victim) && !chan_deop(victim)) ||
+              chan_op(victim)) && !glob_master(user) &&
               !glob_bot(user) && !chan_master(user) && !isexempted(chan, s1)) {
                 if (target_priority(chan, m, 0))
 		  add_mode(chan, '-', 'b', who);
@@ -935,8 +932,7 @@ Context;
       if (m)
 	m->last = now;
       if (channel_active(chan) && m && me_op(chan) &&
-	  !(glob_friend(user) || chan_friend(user) ||
-	  (channel_dontkickops(chan) && (chan_op(user) || (glob_op(user) &&
+	  !((channel_dontkickops(chan) && (chan_op(user) || (glob_op(user) &&
 	  !chan_deop(user)))))) {
 	if (chan_fakeop(m)) {
 	  putlog(LOG_MODES, ch, CHAN_FAKEMODE, ch);

+ 1 - 1
src/mod/module.h

@@ -457,7 +457,7 @@
 /* 277 - 280 */
 #define ischanhub ((int (*)(void))global[277])
 #define rand_dccresp ((char *(*)(void))global[278])
-/* 279 unused*
+/* 279 unused */
 #ifdef LEAF
 #define listen_all ((int (*)(int, int))global[280])
 #endif

+ 1 - 1
src/mod/server.mod/servmsg.c

@@ -340,7 +340,7 @@ static int detect_flood(char *floodnick, char *floodhost, char *from, int which)
 
   u = get_user_by_host(from);
   atr = u ? u->flags : 0;
-  if (atr & (USER_BOT | USER_FRIEND))
+  if (atr & (USER_BOT))
     return 0;
 
   if (isauthed(floodhost) > -1) 

+ 0 - 3
src/tcl.c

@@ -67,8 +67,6 @@ int	    max_dcc = 200;		/* needs at least 4 or 5 just to
 					   get started. 20 should be enough   */
 int	    quick_logs = 1;		/* quick write logs? (flush them
 					   every min instead of every 5	      */
-int	    par_telnet_flood = 0;       /* trigger telnet flood for +f
-					   ppl? - dw			      */
 int	    quiet_save = 1;             /* quiet-save patch by Lucas	      */
 int	    strtot = 0;
 int 	    handlen = HANDLEN;
@@ -507,7 +505,6 @@ static tcl_ints def_tcl_ints[] =
   {"allow-dk-cmds",		&allow_dk_cmds,		0},
   {"resolve-timeout",		&resolve_timeout,	0},
   {"must-be-owner",		&must_be_owner,		1},
-  {"paranoid-telnet-flood",	&par_telnet_flood,	0},
   {"use-exempts",		&use_exempts,		0},			/* Jason/drummer */
   {"use-invites",		&use_invites,		0},			/* Jason/drummer */
   {"quiet-save",		&quiet_save,		0},			/* Lucas */