Pārlūkot izejas kodu

1.0.08b Release

Bryan Drewery 23 gadi atpakaļ
vecāks
revīzija
786b6d7fa4

+ 30 - 0
Changelog

@@ -47,3 +47,33 @@
  Fixed msg_op to use cookieops when a channel is specified
  Fixed do_op to only send opline (+o-b) if nick is in channel ;)
  Removed cmd_pls_bot
+
+1.0.07
+ Recoded last checker and detect code
+ Recoded logging system, should stop some cpu usage loops..
+ Restructured a few commands to be hub only
+ Added cmd_botexec
+ Major file descripter bug *seems to be* fixed, caused "Too many connections" on bots.
+ Recoded some of the compression system (should fix fbsd)
+ Set channels to be default -fastop (to use cookieops)
+ cmd_config and cmd_botconfig are hub only now
+ Fixed getin system so bots will join keyed channels
+ Increased botnet pings from 30 seconds to 60 seconds
+ cmd_op no longer ops in channel the user is already opped in
+ Removed trailing period from cmd_pls_user and cmd_adduser to ward off confusion
+ Fixed bug in check_mypid which was the true culprit of the "Too many connections/open files" bug
+ Added cmd_bottcl
+ Renamed cmd_mtcl to cmd_nettcl
+ Cmds requiring +a no longer require perm owner status, reasoning: only a perm owner can give +a, so make sure you trust that user...
+ cmd_bind now requires +a
+ Fixed a major security flaw in msg_op (found by xmage)
+ Fixed cmd_help to output correctly
+
+1.0.08
+ Fixed do_op to not send +o-b if nick is not in channel
+ Fixed randservers to not spike cpu randomly
+ Added a few new kick msgs 
+ Added channel mode +/-manop, +manop will ALLOW manual op, -manop will punish for it based on !config manop
+ Added channel mode +/-private, a user needs chan flag +o (or global +n) to see/access chan (global ops cant access)
+ cmd_op reverted to op a nick even if already opped. (could fix a desync)
+ Fixed a cosmetic bug in cmd_help

+ 0 - 11
disabled_modules

@@ -1,11 +0,0 @@
-#  disabled_modules -- File which lists all Eggdrop modules that are
-#                      disabled by default.
-#
-#
-# Note:
-#   -  Lines which start with a '#' character are ignored.
-#   -  Every module name needs to be on its own line
-
-# Woobie only serves as an example for module programming. No need to
-# compile it for normal bots ...
-woobie

+ 0 - 8
misc/modconfig

@@ -106,9 +106,6 @@ mc_fmodules=${mc_bindir}/.modules
 #  List of all modules we have detected so far.
 mc_fknownmods=${mc_bindir}/.known_modules
 
-#  List of modules disabled by default
-mc_fdisabledmods=${mc_top_srcdir}/disabled_modules
-
 mc_mod_dir=${mc_srcdir}/mod
 
 mc_mod_bin_dir=${mc_bindir}/src/mod
@@ -269,12 +266,7 @@ xdetect-modules)
 				fi
 			fi
 		else
-			if (sed s/\ //g ${mc_fdisabledmods} 2>&1 | grep "^${mc_mod}\$" 1>&7 2>&1)
-			then
-				:
-			else
 				mc_new_mod_state=enabled
-			fi
 		fi
 		if test "${mc_new_mod_state}" = enabled; then
 			${mc_self_call} -q add ${mc_mod}

+ 2 - 3
pack.conf

@@ -1,8 +1,7 @@
-#DONT DISABLE: IRCNET, PSCLOAK, RANDSERVERS
-#DONT ENABLE LASTCHECK YET.
+#DONT DISABLE: IRCNET
 #ANTITRACE
 NODELAY
-#LASTCHECK
+LASTCHECK
 DCCPASS
 IRCNET
 RANDSERVERS

+ 9 - 20
src/botcmd.c

@@ -494,7 +494,7 @@ bot_infoq (int idx, char *par)
     realnick++;
   else
     realnick = par;
-  putlog (LOG_BOTS, "*", "#%s# botinfo", realnick);
+  putlog (LOG_BOTS, "@", "#%s# botinfo", realnick);
   now2 = now - online_since;
   s2[0] = 0;
   if (now2 > 86400)
@@ -991,27 +991,14 @@ bot_thisbot (int idx, char *par)
   strcpy (dcc[idx].nick, par);
 }
 static void
-bot_hublog (int idx, char *par)
+bot_hublog (char *botnick, char *code, char *par)
 {
-  char *from;
 #ifdef HUB
   int type;
-#endif
-  int i;
-  from = newsplit (&par);
-  i = nextbot (from);
-  if (i != idx)
-    {
-      fake_alert (idx, "direction", from);
-      return;
-    }
-  botnet_send_hublog (idx, from, par);
-#ifdef HUB
   type = atoi (newsplit (&par));
-  putlog (type, "@", "(%s) %s", from, par);
+  putlog (type, "@", "(%s) %s", botnick, par);
 #endif
-}
-static void
+} static void
 bot_handshake (int idx, char *par)
 {
   struct userrec *u = get_user_by_handle (userlist, dcc[idx].nick);
@@ -1422,7 +1409,6 @@ botcmd_t C_bot[] = { {"a", (Function) bot_actchan}
 , {"f!", (Function) bot_filereject}
 , {"fr", (Function) bot_filereq}
 , {"fs", (Function) bot_filesend}
-, {"hl", (Function) bot_hublog}
 , {"hs", (Function) bot_handshake}
 , {"i", (Function) bot_idle}
 , {"i?", (Function) bot_infoq}
@@ -1454,8 +1440,11 @@ botcmd_t C_bot[] = { {"a", (Function) bot_actchan}
 , {NULL, NULL}
 };
 static cmd_t my_bot[] =
-  { {"mt", "", (Function) bot_mtcl, NULL}, {"r_mt", "", (Function) bot_rmtcl,
-					    NULL}, {NULL, NULL, NULL, NULL} };
+  { {"hl", "", (Function) bot_hublog, NULL}, {"mt", "", (Function) bot_mtcl,
+					      NULL}, {"r_mt", "",
+						      (Function) bot_rmtcl,
+						      NULL}, {NULL, NULL,
+							      NULL, NULL} };
 void
 init_botcmd ()
 {

+ 2 - 22
src/botmsg.c

@@ -1,13 +1,13 @@
 #include "main.h"
 #include "tandem.h"
 extern struct dcc_t *dcc;
-extern int dcc_total, tands, sgrab;
+extern int dcc_total, tands;
 extern char botnetnick[];
 extern time_t now;
 extern party_t *party;
 extern Tcl_Interp *interp;
 extern struct userrec *userlist;
-static char OBUF[1024];
+static char OBUF[sgrab - 110];
 static char tobase64array[64] =
   { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
@@ -452,26 +452,6 @@ botnet_send_zapf_broad (int idx, char *a, char *b, char *c)
     }
 }
 void
-botnet_send_hublog_f (int idx, char *a, char *b, int type)
-{
-  int l;
-  if (tands > 0)
-    {
-      l = simple_sprintf (OBUF, "hl %s %i %s\n", a, type, b);
-      send_tand_but (idx, OBUF, l);
-    }
-}
-void
-botnet_send_hublog (int idx, char *a, char *b)
-{
-  int l;
-  if (tands > 0)
-    {
-      l = simple_sprintf (OBUF, "hl %s %s\n", a, b);
-      send_tand_but (idx, OBUF, l);
-    }
-}
-void
 botnet_send_filereject (int idx, char *path, char *from, char *reason)
 {
   int l;

+ 4 - 4
src/chan.h

@@ -181,7 +181,7 @@ struct chanset_t
 #define CHAN_NOMOP 0x0080
 #define CHAN_REVENGE 0x0100
 #define CHAN_SECRET 0x0200
-#define CHAN_NOMDOP 0x0400
+#define CHAN_MANOP 0x0400
 #define CHAN_CYCLE 0x0800
 #define CHAN_DONTKICKOPS 0x1000
 #define CHAN_INACTIVE 0x2000
@@ -191,7 +191,7 @@ struct chanset_t
 #define CHAN_REVENGEBOT 0x20000
 #define CHAN_NODESYNCH 0x40000
 #define CHAN_FASTOP 0x80000
-#define CHAN_PUNISH 0x100000
+#define CHAN_PRIVATE 0x100000
 #define CHAN_ACTIVE 0x1000000
 #define CHAN_PEND 0x2000000
 #define CHAN_FLAGGED 0x4000000
@@ -243,10 +243,10 @@ struct chanset_t *findchan_by_dname (const char *name);
 #define channel_closed(chan) (chan->status & CHAN_CLOSED)
 #define channel_take(chan) (chan->status & CHAN_TAKE)
 #define channel_nomop(chan) (chan->status & CHAN_NOMOP)
-#define channel_nomdop(chan) (chan->status & CHAN_NOMDOP)
+#define channel_manop(chan) (chan->status & CHAN_MANOP)
 #define channel_voice(chan) (chan->status & CHAN_VOICE)
 #define channel_fastop(chan) (chan->status & CHAN_FASTOP)
-#define channel_punish(chan) (chan->status & CHAN_PUNISH)
+#define channel_private(chan) (chan->status & CHAN_PRIVATE)
 struct msgq_head
 {
   struct msgq *head;

+ 7 - 2
src/chanprog.c

@@ -216,9 +216,11 @@ tell_verbose_status (int idx)
       uni_t = un.sysname;
     }
 #endif
+#ifdef HUB
   i = count_users (userlist);
   dprintf (idx, "I am %s, running %s:  %d user%s (mem: %uk)\n", botnetnick,
 	   ver, i, i == 1 ? "" : "s", (int) (expected_memory () / 1024));
+#endif
   now2 = now - online_since;
   s[0] = 0;
   if (now2 > 86400)
@@ -265,7 +267,6 @@ tell_verbose_status (int idx)
 	   100.0 * ((float) cache_hit) / ((float) (cache_hit + cache_miss)));
   if (admin[0])
     dprintf (idx, "Admin: %s\n", admin);
-  dprintf (idx, "Config file: %s\n", configfile);
   dprintf (idx, "OS: %s %s\n", uni_t, vers_t);
   dprintf (idx, "%s %s\n", MISC_TCLLIBRARY,
 	   ((interp)
@@ -293,7 +294,9 @@ tell_settings (int idx)
   dprintf (idx, "Botnet Nickname: %s\n", botnetnick);
   if (firewall[0])
     dprintf (idx, "Firewall: %s, port %d\n", firewall, firewallport);
-  dprintf (idx, "Userfile: %s   Motd: %s\n", userfile, motdfile);
+#ifdef HUB
+  dprintf (idx, "Userfile: %s   \n", userfile);
+#endif
   dprintf (idx, "Directories:\n");
   dprintf (idx, "  Help    : %s\n", helpdir);
   dprintf (idx, "  Temp    : %s\n", tempdir);
@@ -301,8 +304,10 @@ tell_settings (int idx)
   build_flags (s, &fr, NULL);
   dprintf (idx, "%s [%s], %s: %s\n", MISC_NEWUSERFLAGS, s, MISC_NOTIFY,
 	   notify_new);
+#ifdef HUB
   if (owner[0])
     dprintf (idx, "%s: %s\n", MISC_PERMOWNER, owner);
+#endif
   for (i = 0; i < max_logs; i++)
     if (logs[i].filename != NULL)
       {

+ 145 - 129
src/cmds.c

@@ -22,7 +22,7 @@ extern unsigned long otraffic_irc, otraffic_irc_today, itraffic_irc,
   itraffic_unknown, itraffic_unknown_today;
 extern Tcl_Interp *interp;
 extern char botnetnick[], origbotname[], ver[], network[], owner[],
-  quit_msg[], dcc_prefix[], netpass[], botname[], *binname;
+  quit_msg[], dcc_prefix[], netpass[], botname[], *binname, egg_version[];
 extern time_t now, online_since;
 extern module_entry *module_list;
 extern struct cfg_entry CFG_MOTD;
@@ -32,40 +32,6 @@ static char *btos (unsigned long);
 mycmds cmds[500];
 int cmdi = 0;
 #ifdef HUB
-static int
-add_bot_hostmask (int idx, char *nick)
-{
-  struct chanset_t *chan;
-  for (chan = chanset; chan; chan = chan->next)
-    if (channel_active (chan))
-      {
-	memberlist *m = ismember (chan, nick);
-	if (m)
-	  {
-	    char s[UHOSTLEN];
-	    struct userrec *u;
-	    egg_snprintf (s, sizeof s, "%s!%s", m->nick, m->userhost);
-	    u = get_user_by_host (s);
-	    if (u)
-	      {
-		dprintf (idx,
-			 "(Can't add hostmask for %s because it matches %s)\n",
-			 nick, u->handle);
-		return 0;
-	      }
-	    if (strchr ("~^+=-", m->userhost[0]))
-	      egg_snprintf (s, sizeof s, "*!%s%s", strict_host ? "?" : "",
-			    m->userhost + 1);
-	    else
-	      egg_snprintf (s, sizeof s, "*!%s", m->userhost);
-	    dprintf (idx, "(Added hostmask for %s from %s)\n", nick,
-		     chan->dname);
-	    addhost_by_handle (nick, s);
-	    return 1;
-	  }
-      }
-  return 0;
-}
 static void
 tell_who (struct userrec *u, int idx, int chan)
 {
@@ -347,6 +313,8 @@ cmd_whom (struct userrec *u, int idx, char *par)
       answer_local_whom (idx, chan);
     }
 }
+
+#ifdef HUB
 void
 cmd_config (struct userrec *u, int idx, char *par)
 {
@@ -508,7 +476,6 @@ cmd_botconfig (struct userrec *u, int idx, char *par)
     dprintf (idx, STR ("  %s: (not set)\n"), cfgent->name);
 }
 
-#ifdef HUB
 #ifdef S_DCCPASS
 void
 cmd_cmdpass (struct userrec *u, int idx, char *par)
@@ -517,14 +484,6 @@ cmd_cmdpass (struct userrec *u, int idx, char *par)
   char *cmd = NULL, *pass = NULL;
   int i;
   putlog (LOG_CMDS, "*", "#%s# cmdpass ...", dcc[idx].nick);
-  if (!isowner (u->handle))
-    {
-      putlog (LOG_MISC, "*",
-	      STR ("%s attempted to set a command password - not perm owner"),
-	      dcc[idx].nick);
-      dprintf (idx, STR ("Perm owners only.\n"));
-      return;
-    }
   cmd = newsplit (&par);
   pass = newsplit (&par);
   if (!cmd[0] || par[0])
@@ -628,6 +587,13 @@ cmd_motd (struct userrec *u, int idx, char *par)
     }
 }
 static void
+cmd_about (struct userrec *u, int idx, char *par)
+{
+  dprintf (idx, "Wraith %s\n", egg_version);
+  dprintf (idx, "by: bryan\nwith beta testing/ideas from: SFC, xmage\n");
+  dprintf (idx,
+	   "credit goes to ievil/einride for ghost, which a lot of code in this pack is based off of..\n");
+} static void
 cmd_away (struct userrec *u, int idx, char *par)
 {
   if (strlen (par) > 60)
@@ -755,7 +721,7 @@ cmd_help (struct userrec *u, int idx, char *par)
   int i = 0, showall = 0, fnd = 0, n = 0, done = 0, first = 0, o = 0, end;
   struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
   char *fcats, *flag, temp[500];
-  sprintf (temp, "a|- a|a n|- n|n m|- m|m mo|o m|o o|o o|- i|- p|- -|-");
+  sprintf (temp, "a|- a|a n|- n|n m|- m|m mo|o m|o i|- o|o o|- p|- -|-");
   fcats = temp;
   Context;
   putlog (LOG_CMDS, "*", STR ("#%s# help %s"), dcc[idx].nick, par);
@@ -805,18 +771,20 @@ cmd_help (struct userrec *u, int idx, char *par)
 		{
 		  if (first)
 		    {
-		      dprintf (idx, "%s## DCC (%s)\n  ", end ? "" : "\n",
-			       flag);
-		      first = 0;
+		      dprintf (idx, "%s## DCC (%s)\n  ", "\n", flag);
+		    }
+		  if (end && !first)
+		    {
+		      dprintf (idx, STR ("\n  "));
 		    }
-		  end = 0;
 		  dprintf (idx, STR ("%-14.14s"), cmds[n].name);
+		  first = 0;
+		  end = 0;
 		  i++;
 		}
 	      if (i >= 5)
 		{
 		  end = 1;
-		  dprintf (idx, STR ("\n  "));
 		  i = 0;
 		}
 	    }
@@ -1111,9 +1079,11 @@ cmd_channels (struct userrec *u, int idx, char *par)
     {
       struct flag_record fr = { FR_CHAN | FR_GLOBAL, 0, 0, 0, 0 };
       get_user_flagrec (u, &fr, chan->dname);
-      if (glob_owner (fr)
-	  || ((glob_op (fr) || chan_op (fr))
-	      && !(chan_deop (fr) || glob_deop (fr))))
+      if ((!channel_private (chan)
+	   || (channel_private (chan) && (chan_op (fr) || glob_owner (fr))))
+	  && (glob_owner (fr)
+	      || ((glob_op (fr) || chan_op (fr))
+		  && !(chan_deop (fr) || glob_deop (fr)))))
 	{
 	  if (channel_inactive (chan))
 	    dprintf (idx, STR ("  %s (inactive)\n"), chan->dname);
@@ -2031,6 +2001,7 @@ check_dcc_attrs (struct userrec *u, int oatr)
 #ifdef HUB
 	  if (!(u->flags & (USER_HUBA)))
 	    {
+	      Context;
 	      dprintf (i, "-+- POOF! -+-\n");
 	      dprintf (i, "You no longer have hub access.\n\n");
 	      do_boot (i, botnetnick, "No hub access.\n\n");
@@ -2039,12 +2010,14 @@ check_dcc_attrs (struct userrec *u, int oatr)
 #ifdef LEAF
 	  if (issechub () && !(u->flags & (USER_HUBA)))
 	    {
+	      Context;
 	      dprintf (i, "-+- POOF! -+-\n");
 	      dprintf (i, "You no longer have hub/sechub access.\n\n");
 	      do_boot (i, botnetnick, "No hub/sechub access.\n\n");
 	    }
 	  if (ischanhub () && !(u->flags & (USER_CHUBA)))
 	    {
+	      Context;
 	      dprintf (i, "-+- POOF! -+-\n");
 	      dprintf (i, "You no longer have chanhub access.\n\n");
 	      do_boot (i, botnetnick, "No chanhub access.\n\n");
@@ -2053,6 +2026,7 @@ check_dcc_attrs (struct userrec *u, int oatr)
 	  if (!(u->flags & USER_PARTY) && (dcc[i].u.chat->channel != -1)
 	      && lostp)
 	    {
+	      Context;
 	      dprintf (i, "-+- POOF! -+-\n");
 	      dprintf (i, "You no longer have party line chat access.\n");
 	      dprintf (i, "Leaving chat mode...\n");
@@ -2707,13 +2681,17 @@ static void
 cmd_exec (struct userrec *u, int idx, char *par)
 {
   putlog (LOG_CMDS, "*", STR ("#%s# exec %s"), dcc[idx].nick, par);
+#ifdef LEAF
   if (!isowner (u->handle))
     {
-      putlog (LOG_WARN, "*", STR ("%s attempted 'exec'%s"), dcc[idx].nick,
+      putlog (LOG_WARN, "*", STR ("%s attempted 'exec' %s"), dcc[idx].nick,
 	      par);
-      dprintf (idx, STR ("exec is only available to permanent owners\n"));
+      dprintf (idx,
+	       STR
+	       ("exec is only available to permanent owners on leaf bots\n"));
       return;
     }
+#endif
   if (exec_str (u, idx, par))
     dprintf (idx, STR ("Exec completed\n"));
   else
@@ -2818,9 +2796,10 @@ cmd_color (struct userrec *u, int idx, char *par)
 {
   module_entry *me;
   char *type, *of;
-  dprintf (idx, "Usage: color <on/off> <mIRC/ANSI>\n");
+  putlog (LOG_CMDS, "*", "#%s# color %s", dcc[idx].nick, par);
   if (!par[0])
     {
+      dprintf (idx, "Usage: color <on/off> <mIRC/ANSI>\n");
       if (dcc[idx].status & STAT_COLOR)
 	dprintf (idx, "Color is currently on (%s).\n",
 		 dcc[idx].status & STAT_COLORM ? "mIRC" : "ANSI");
@@ -2834,6 +2813,7 @@ cmd_color (struct userrec *u, int idx, char *par)
     {
       if (!type)
 	{
+	  dprintf (idx, "Usage: color <on/off> <mIRC/ANSI>\n");
 	  return;
 	}
       if (!egg_strcasecmp (type, "mirc"))
@@ -3189,6 +3169,8 @@ cmd_page (struct userrec *u, int idx, char *par)
       (func[CONSOLE_DOSTORE]) (idx);
     }
 }
+
+#ifdef HUB
 static void
 cmd_tcl (struct userrec *u, int idx, char *msg)
 {
@@ -3205,18 +3187,11 @@ cmd_tcl (struct userrec *u, int idx, char *msg)
   else
     dumplots (idx, "Tcl error: ", interp->result);
 }
-
-#ifdef HUB
 static void
-cmd_mtcl (struct userrec *u, int idx, char *msg)
+cmd_nettcl (struct userrec *u, int idx, char *msg)
 {
   int code;
   char buf[2000];
-  if (!(isowner (dcc[idx].nick)) && (must_be_owner))
-    {
-      dprintf (idx, "What?  You need '%shelp'\n", dcc_prefix);
-      return;
-    }
   sprintf (buf, "mt %d %s", idx, msg);
   botnet_send_zapf_broad (-1, botnetnick, NULL, buf);
   debug1 ("tcl: evaluate (.tcl): %s", msg);
@@ -3227,6 +3202,19 @@ cmd_mtcl (struct userrec *u, int idx, char *msg)
     dumplots (idx, "Tcl error: ", interp->result);
 }
 static void
+cmd_bottcl (struct userrec *u, int idx, char *msg)
+{
+  char buf[2000], *bot;
+  if (!msg[0])
+    {
+      dprintf (idx, "Usage: bottcl <botnick> cmd\n");
+      return;
+    }
+  bot = newsplit (&msg);
+  sprintf (buf, "mt %d %s", idx, msg);
+  putbot (bot, buf);
+}
+static void
 cmd_newleaf (struct userrec *u, int idx, char *par)
 {
   char *handle, *host;
@@ -3281,11 +3269,6 @@ cmd_set (struct userrec *u, int idx, char *msg)
 {
   int code;
   char s[512];
-  if (!(isowner (dcc[idx].nick)) && (must_be_owner))
-    {
-      dprintf (idx, "What?  You need '%shelp'\n", dcc_prefix);
-      return;
-    }
   putlog (LOG_CMDS, "*", "#%s# set %s", dcc[idx].nick, msg);
   strcpy (s, "set ");
   if (!msg[0])
@@ -3444,8 +3427,8 @@ cmd_pls_user (struct userrec *u, int idx, char *par)
       set_user (&USERENTRY_PASS, u2, s);
       make_rand_str (s2, 17);
       set_user (&USERENTRY_SECPASS, u2, s2);
-      dprintf (idx, STR ("%s's password set to \002%s\002.\n"), handle, s);
-      dprintf (idx, STR ("%s's secpass set to \002%s\002.\n"), handle, s2);
+      dprintf (idx, STR ("%s's password set to \002%s\002\n"), handle, s);
+      dprintf (idx, STR ("%s's secpass set to \002%s\002\n"), handle, s2);
 #ifdef HUB
       write_userfile (idx);
 #endif
@@ -3915,7 +3898,10 @@ rcmd_pong (char *frombot, char *fromhand, char *fromidx, char *par)
       dprintf (i, STR ("Pong from %s: %i.%i seconds\n"), frombot, (tm / 100),
 	       (tm % 100));
     }
-} static void
+}
+
+#ifdef HUB
+static void
 cmd_botw (struct userrec *u, int idx, char *par)
 {
   char *tbot, tmp[128];
@@ -4000,6 +3986,25 @@ cmd_botps (struct userrec *u, int idx, char *par)
   botnet_send_cmd (botnetnick, tbot, dcc[idx].nick, idx, buf);
 }
 static void
+cmd_botexec (struct userrec *u, int idx, char *par)
+{
+  char *tbot, buf[1024];
+  putlog (LOG_CMDS, "*", STR ("#%s# botexec %s"), dcc[idx].nick, par);
+  tbot = newsplit (&par);
+  if (!tbot[0])
+    {
+      dprintf (idx, STR ("Usage: botexec <botname> [parameters]\n"));
+      return;
+    }
+  if (nextbot (tbot) < 0)
+    {
+      dprintf (idx, STR ("No such linked bot\n"));
+      return;
+    }
+  sprintf (buf, STR ("exec raw %s"), par);
+  botnet_send_cmd (botnetnick, tbot, dcc[idx].nick, idx, buf);
+}
+static void
 cmd_netps (struct userrec *u, int idx, char *par)
 {
   char buf[1024];
@@ -4064,7 +4069,7 @@ cmd_netlast (struct userrec *u, int idx, char *par)
   sprintf (buf, STR ("exec last %s"), par);
   botnet_send_cmd_broad (-1, botnetnick, dcc[idx].nick, idx, buf);
 }
-
+#endif
 void
 crontab_show (struct userrec *u, int idx)
 {
@@ -4233,6 +4238,10 @@ rcmd_exec (char *frombot, char *fromhand, char *fromidx, char *par)
     {
       sprintf (scmd, STR ("ps %s"), par);
     }
+  else if (!strcmp (cmd, STR ("raw")))
+    {
+      sprintf (scmd, STR ("%s"), par);
+    }
   else if (!strcmp (cmd, STR ("kill")))
     {
       sprintf (scmd, STR ("kill %s"), par);
@@ -4583,11 +4592,13 @@ cmd_whoami (struct userrec *u, int idx, char *par)
 #ifdef HUB
 {"addlog", "mo|o", (Function) cmd_addlog, NULL, NULL},
 #endif
-{"away", "", (Function) cmd_away, NULL, NULL}, {"back", "",
-						(Function) cmd_back, NULL,
-						NULL},
+{"about", "", (Function) cmd_about, NULL, NULL}, {"away", "",
+						  (Function) cmd_away, NULL,
+						  NULL}, {"back", "",
+							  (Function) cmd_back,
+							  NULL, NULL},
 #ifdef HUB
-{"backup", "m|m", (Function) cmd_backup, NULL, NULL}, {"binds", "m",
+{"backup", "m|m", (Function) cmd_backup, NULL, NULL}, {"binds", "a",
 						       (Function) cmd_binds,
 						       NULL, NULL}, {"boot",
 								     "m",
@@ -4605,13 +4616,12 @@ cmd_whoami (struct userrec *u, int idx, char *par)
 								 NULL, NULL},
   {"bots", "m", (Function) cmd_bots, NULL, NULL}, {"downbots", "m",
 						   (Function) cmd_downbots,
-						   NULL, NULL},
-#endif
-{"botconfig", "n", (Function) cmd_botconfig, NULL, NULL},
-#ifdef HUB
-{"bottree", "n", (Function) cmd_bottree, NULL, NULL}, {"chaddr", "a",
-						       (Function) cmd_chaddr,
-						       NULL, NULL},
+						   NULL, NULL}, {"bottree",
+								 "n",
+								 (Function)
+								 cmd_bottree,
+								 NULL, NULL},
+  {"chaddr", "a", (Function) cmd_chaddr, NULL, NULL},
 #endif
 {"chat", "", (Function) cmd_chat, NULL, NULL}, {"chattr", "m|m",
 						(Function) cmd_chattr, NULL,
@@ -4632,11 +4642,11 @@ cmd_whoami (struct userrec *u, int idx, char *par)
 #endif
 {"color", "", (Function) cmd_color, NULL, NULL}, {"comment", "m|m",
 						  (Function) cmd_comment,
-						  NULL, NULL}, {"config", "n",
-								(Function)
-								cmd_config,
-								NULL, NULL},
-  {"console", "mo|o", (Function) cmd_console, NULL, NULL},
+						  NULL, NULL},
+#ifdef HUB
+{"config", "n", (Function) cmd_config, NULL, NULL},
+#endif
+{"console", "mo|o", (Function) cmd_console, NULL, NULL},
 #ifdef HUB
 {"dccstat", "a", (Function) cmd_dccstat, NULL, NULL},
 #endif
@@ -4669,9 +4679,14 @@ cmd_whoami (struct userrec *u, int idx, char *par)
 							     cmd_motd, NULL,
 							     NULL},
 #ifdef HUB
-{"mtcl", "a", (Function) cmd_mtcl, NULL, NULL}, {"newleaf", "n",
-						 (Function) cmd_newleaf, NULL,
-						 NULL},
+{"nettcl", "a", (Function) cmd_nettcl, NULL, NULL}, {"bottcl", "a",
+						     (Function) cmd_bottcl,
+						     NULL, NULL}, {"newleaf",
+								   "n",
+								   (Function)
+								   cmd_newleaf,
+								   NULL,
+								   NULL},
 #endif
 {"newpass", "", (Function) cmd_newpass, NULL, NULL}, {"secpass", "",
 						      (Function) cmd_secpass,
@@ -4701,10 +4716,11 @@ cmd_whoami (struct userrec *u, int idx, char *par)
 								 (Function)
 								 cmd_strip,
 								 NULL, NULL},
-  {"su", "a", (Function) cmd_su, NULL, NULL}, {"tcl", "a", (Function) cmd_tcl,
-					       NULL, NULL},
+  {"su", "a", (Function) cmd_su, NULL, NULL},
 #ifdef HUB
-{"trace", "n", (Function) cmd_trace, NULL, NULL},
+{"tcl", "a", (Function) cmd_tcl, NULL, NULL}, {"trace", "n",
+					       (Function) cmd_trace, NULL,
+					       NULL},
 #endif
 {"traffic", "m", (Function) cmd_traffic, NULL, NULL}, {"unlink", "m",
 						       (Function) cmd_unlink,
@@ -4749,47 +4765,47 @@ cmd_whoami (struct userrec *u, int idx, char *par)
 								   cmd_botnick,
 								   NULL,
 								   NULL},
-  {"netnick", "m", (Function) cmd_netnick, NULL, NULL}, {"botw", "n",
-							 (Function) cmd_botw,
-							 NULL, NULL}, {"netw",
-								       "n",
-								       (Function)
-								       cmd_netw,
-								       NULL,
-								       NULL},
-  {"botps", "n", (Function) cmd_botps, NULL, NULL}, {"botkill", "n",
-						     (Function) cmd_botkill,
-						     NULL, NULL}, {"netps",
-								   "n",
-								   (Function)
-								   cmd_netps,
-								   NULL,
-								   NULL},
-  {"botlast", "n", (Function) cmd_botlast, NULL, NULL}, {"netlast", "n",
+  {"netnick", "m", (Function) cmd_netnick, NULL, NULL},
+#ifdef HUB
+{"botw", "n", (Function) cmd_botw, NULL, NULL}, {"netw", "n",
+						 (Function) cmd_netw, NULL,
+						 NULL}, {"botps", "n",
+							 (Function) cmd_botps,
+							 NULL, NULL},
+  {"botexec", "a", (Function) cmd_botexec, NULL, NULL}, {"botkill", "n",
 							 (Function)
-							 cmd_netlast, NULL,
-							 NULL}, {"netlag",
-								 "m",
+							 cmd_botkill, NULL,
+							 NULL}, {"netps", "n",
 								 (Function)
-								 cmd_netlag,
+								 cmd_netps,
 								 NULL, NULL},
-  {"botserver", "m", (Function) cmd_botserver, NULL, NULL}, {"netserver", "m",
+  {"botlast", "n", (Function) cmd_botlast, NULL, NULL}, {"netlast", "n",
+							 (Function)
+							 cmd_netlast, NULL,
+							 NULL},
+#endif
+{"netlag", "m", (Function) cmd_netlag, NULL, NULL}, {"botserver", "m",
+						     (Function) cmd_botserver,
+						     NULL, NULL},
+  {"netserver", "m", (Function) cmd_netserver, NULL, NULL}, {"botversion",
+							     "o",
 							     (Function)
-							     cmd_netserver,
+							     cmd_botversion,
 							     NULL, NULL},
-  {"botversion", "o", (Function) cmd_botversion, NULL, NULL}, {"netversion",
-							       "o",
+  {"netversion", "o", (Function) cmd_netversion, NULL, NULL}, {"userlist",
+							       "m",
 							       (Function)
-							       cmd_netversion,
+							       cmd_userlist,
 							       NULL, NULL},
-  {"userlist", "m", (Function) cmd_userlist, NULL, NULL}, {"ps", "n",
-							   (Function) cmd_ps,
-							   NULL, NULL},
-  {"last", "n", (Function) cmd_last, NULL, NULL}, {"exec", "a",
-						   (Function) cmd_exec, NULL,
-						   NULL}, {"w", "n",
-							   (Function) cmd_w,
-							   NULL, NULL},
+  {"ps", "n", (Function) cmd_ps, NULL, NULL}, {"last", "n",
+					       (Function) cmd_last, NULL,
+					       NULL}, {"exec", "a",
+						       (Function) cmd_exec,
+						       NULL, NULL}, {"w", "n",
+								     (Function)
+								     cmd_w,
+								     NULL,
+								     NULL},
   {"channels", "o", (Function) cmd_channels, NULL, NULL},
 #ifdef HUB
 {"hublevel", "a", (Function) cmd_hublevel, NULL, NULL}, {"lagged", "m",

+ 4 - 7
src/dcc.c

@@ -469,13 +469,10 @@ dcc_bot (int idx, char *code, int i)
   strip_telnet (dcc[idx].sock, code, &i);
   if (debug_output)
     {
-      if (code[0] != 'h' && code[1] != 'l' && code[2] != ' ')
-	{
-	  if (code[0] == 's')
-	    putlog (LOG_BOTSHARE, "@", "{%s} %s", dcc[idx].nick, code + 2);
-	  else
-	    putlog (LOG_BOTNET, "@", "[%s] %s", dcc[idx].nick, code);
-	}
+      if (code[0] == 's')
+	putlog (LOG_BOTSHARE, "@", "{%s} %s", dcc[idx].nick, code + 2);
+      else
+	putlog (LOG_BOTNET, "@", "[%s] %s", dcc[idx].nick, code);
     }
   msg = strchr (code, ' ');
   if (msg)

+ 2 - 0
src/dccutil.c

@@ -562,6 +562,7 @@ void
 do_boot (int idx, char *by, char *reason)
 {
   int files = (dcc[idx].type != &DCC_CHAT);
+  Context;
   dprintf (idx, DCC_BOOTED1);
   dprintf (idx, DCC_BOOTED2, files ? "file section" : "bot", by,
 	   reason[0] ? ": " : ".", reason);
@@ -577,6 +578,7 @@ do_boot (int idx, char *by, char *reason)
   check_tcl_chof (dcc[idx].nick, dcc[idx].sock);
   if ((dcc[idx].sock != STDOUT) || backgrd)
     {
+      Context;
       killsock (dcc[idx].sock);
       lostdcc (idx);
     }

+ 12 - 1
src/eggdrop.h

@@ -14,6 +14,7 @@
 #define BADHANDCHARS	"-,+*=:!.@#;$%&"
 #define MAX_BOTS 500
 #define SERVLEN 60
+#define sgrab 2011
 #define LANGDIR	"./.language"
 #define BASELANG "english"
 #define op_time_slack (CFG_OPTIMESLACK.gdata ? atoi(CFG_OPTIMESLACK.gdata) : 60)
@@ -347,9 +348,18 @@ struct dupwait_info
 #ifdef S_ANTITRACE
 #define DETECT_TRACE 2
 #endif
-#ifdef GSPROMISC
+#ifdef S_PROMISC
 #define DETECT_PROMISC 3
 #endif
+#ifdef S_PROCESSCHECK
+#define DETECT_PROCESS 4
+#endif
+#define DET_IGNORE 0
+#define DET_WARN 1
+#define DET_REJECT 2
+#define DET_DIE 3
+#define DET_SUICIDE 4
+#define DET_NOCHECK 5
 typedef struct
 {
   char *filename;
@@ -434,6 +444,7 @@ typedef struct
   char *outbuf;
   unsigned long outbuflen;
   int encstatus, oseed, iseed;
+  int gz;
   char okey[17];
   char ikey[17];
   unsigned long inbuflen;

+ 0 - 2
src/flags.h

@@ -19,9 +19,7 @@ struct flag_record
 #define ROLE_KICK_MDOP (role)
 #define ROLE_KICK_MEAN (role)
 #define DEFLAG_BADCOOKIE 1
-#ifdef G_MANUALOP
 #define DEFLAG_MANUALOP 2
-#endif
 #ifdef G_MEAN
 #define DEFLAG_MEAN_DEOP 3
 #define DEFLAG_MEAN_KICK 4

+ 113 - 26
src/main.c

@@ -51,11 +51,10 @@ extern log_t *logs;
 extern Tcl_Interp *interp;
 extern tcl_timer_t *timer, *utimer;
 extern jmp_buf alarmret;
-extern void check_last ();
 int role;
 int loading = 0;
-char egg_version[1024] = "1.0.06";
-int egg_numver = 1000600;
+char egg_version[1024] = "1.0.08b";
+int egg_numver = 1000801;
 time_t lastfork = 0;
 #ifdef HUB
 int my_port;
@@ -88,7 +87,6 @@ int do_restart = 0;
 int die_on_sighup = 0;
 int die_on_sigterm = 0;
 int resolve_timeout = 15;
-int sgrab = 2011;
 char quit_msg[1024];
 time_t now;
 extern struct cfg_entry CFG_FORKINTERVAL;
@@ -128,6 +126,15 @@ void
 fatal (const char *s, int recoverable)
 {
   int i;
+#ifdef LEAF
+  module_entry *me;
+  Context;
+  if ((me = module_find ("server", 0, 0)))
+    {
+      Function *func = me->funcs;
+      (func[SERVER_NUKESERVER]) (s);
+    }
+#endif
   putlog (LOG_MISC, "*", "* %s", s);
   flushlogs ();
   for (i = 0; i < dcc_total; i++)
@@ -446,7 +453,8 @@ eggAssert (const char *file, int line, const char *module)
 }
 #endif
 #ifdef LEAF
-#define PARSE_FLAGS "HhlinvP"
+static void gotspawn (char *);
+#define PARSE_FLAGS "nvPc"
 static void
 dtx_arg (int argc, char *argv[])
 {
@@ -470,6 +478,11 @@ dtx_arg (int argc, char *argv[])
 	      snprintf (myip, 121, "%s", p);
 	    }
 	  break;
+	case 'c':
+	  p = argv[optind];
+	  if (!localhub)
+	    gotspawn (p);
+	  break;
 	case 'H':
 	  if (localhub)
 	    break;
@@ -549,6 +562,8 @@ core_10secondly ()
 #endif
 	curcheck = 0;
       }
+  if (curcheck > 3)
+    curcheck = 0;
   Context;
   autolink_cycle (NULL);
 }
@@ -557,6 +572,7 @@ void
 do_fork ()
 {
   int xx;
+  Context;
   xx = fork ();
   if (xx == -1)
     return;
@@ -609,7 +625,6 @@ core_secondly ()
     }
   if ((cnt % 30) == 0)
     {
-      check_botnet_pings ();
       call_hook (HOOK_30SECONDLY);
       cnt = 0;
     }
@@ -619,6 +634,7 @@ core_secondly ()
       int i = 0;
       lastmin = (lastmin + 1) % 60;
       call_hook (HOOK_MINUTELY);
+      check_botnet_pings ();
       check_expired_ignores ();
       while (nowtm.tm_min != lastmin)
 	{
@@ -715,6 +731,7 @@ check_mypid ()
 	  bg_send_quit (BG_ABORT);
 	  exit (1);
 	}
+      fclose (fp);
     }
 }
 #endif
@@ -911,6 +928,74 @@ check_crontab ()
 	printf ("* Error writing crontab entry.\n");
     }
 }
+
+#ifdef LEAF
+static void
+gotspawn (char *filename)
+{
+  FILE *fp;
+  char templine[8192], *nick, *host, *ip, *temps;
+  if (!(fp = fopen (filename, "r")))
+    fatal ("Cannot read from local config (2)", 0);
+  check_static ("blowfish", blowfish_start);
+  Context;
+  module_load (ENCMOD);
+  while (fscanf (fp, "%[^\n]\n", templine) != EOF)
+    {
+      Context;
+      temps = (char *) decrypt_string (netpass, decryptit (templine));
+      nick = newsplit (&temps);
+      if (!nick)
+	fatal ("invalid config (2).", 0);
+      ip = newsplit (&temps);
+      if (!ip)
+	fatal ("invalid config (2).", 0);
+      host = newsplit (&temps);
+      if (!host && (ip[0] != '!'))
+	fatal ("invalid config (2).", 0);
+      if (ip[0] == '!')
+	{
+	  ip++;
+	  sprintf (natip, "%s", ip);
+	}
+      else
+	{
+	  snprintf (myip, 121, "%s", ip);
+	}
+      snprintf (origbotname, 10, "%s", nick);
+      if (host[0])
+	{
+	  if (host[0] == '+')
+	    {
+	      host++;
+	      sprintf (hostname6, "%s", host);
+	    }
+	  else
+	    {
+	      sprintf (hostname, "%s", host);
+	    }
+	}
+    }
+  fclose (fp);
+  unlink (filename);
+}
+static int
+spawnbot (char *bin, char *nick, char *ip, char *host)
+{
+  char buf[DIRMAX], bindir[DIRMAX], bufrun[DIRMAX];
+  FILE *fp;
+  sprintf (buf, "%s", bin);
+  sprintf (bindir, "%s", dirname (buf));
+  sprintf (buf, "%s/.%s", bindir, nick);
+  if (!(fp = fopen (buf, "w")))
+    fatal ("Cannot create spawnfiles...", 0);
+  lfprintf (fp, "%s %s %s\n", nick, ip, host[0] ? host : "");
+  fflush (fp);
+  fclose (fp);
+  sprintf (bufrun, "%s -c %s", bin, buf);
+  return system (bufrun);
+}
+#endif
 int
 main (int argc, char **argv)
 {
@@ -1033,7 +1118,7 @@ main (int argc, char **argv)
 	      if (strcmp (thepass, md5string))
 		fatal ("incorrect password.", 0);
 	      init_tcl (argc, argv);
-	      link_statics ();
+	      check_static ("blowfish", blowfish_start);
 	      Context;
 	      module_load (ENCMOD);
 	      if (!strcmp (argv[1], "-e"))
@@ -1103,6 +1188,7 @@ main (int argc, char **argv)
     {
       localhub = 1;
     }
+  init_tcl (argc, argv);
   if (argc)
     dtx_arg (argc, argv);
 #endif
@@ -1142,6 +1228,15 @@ main (int argc, char **argv)
   sprintf (cfile, "%s/conf", confdir);
 #endif
   chmod (cfile, S_IRUSR | S_IWUSR | S_IXUSR);
+#ifdef LEAF
+#ifdef S_PSCLOAK
+  on = 0;
+  strncpy (argv[0], progname (), strlen (argv[0]));
+  for (on = 1; on < argc; on++)
+    memset (argv[on], 0, strlen (argv[on]));
+#endif
+#endif
+  Context;
   init_settings ();
   init_language (1);
   init_dcc_max ();
@@ -1153,7 +1248,9 @@ main (int argc, char **argv)
   init_userrec ();
   if (backgrd)
     bg_prepare_split ();
+#ifndef LEAF
   init_tcl (argc, argv);
+#endif
   init_language (0);
   init_botcmd ();
   link_statics ();
@@ -1206,7 +1303,7 @@ main (int argc, char **argv)
 	      newsplit (&temps);
 	      Tcl_Eval (interp, temps);
 	    }
-	  else if (temps[0] != '#')
+	  else if (c[0] != '#')
 	    {
 	      i++;
 	      nick = newsplit (&temps);
@@ -1275,18 +1372,13 @@ main (int argc, char **argv)
 		      kill (xx, SIGCHLD);
 		      if (errno == ESRCH || (updating && !x))
 			{
-			  sprintf (buf2, "%s -l %s -i %s %s %s", binname,
-				   nick, ip, host[0] ? "-H" : "",
-				   host[0] ? host : "");
-			  if (system (buf2))
+			  if (spawnbot (binname, nick, ip, host))
 			    printf ("* Failed to spawn %s\n", nick);
 			}
 		    }
 		  else
 		    {
-		      sprintf (buf2, "%s -l %s -i %s -H %s", binname, nick,
-			       ip, host);
-		      if (system (buf2))
+		      if (spawnbot (binname, nick, ip, host))
 			printf ("* Failed to spawn %s\n", nick);
 		    }
 		}
@@ -1299,14 +1391,6 @@ main (int argc, char **argv)
       if (updating)
 	exit (0);
     }
-#endif
-#ifdef LEAF
-#ifdef S_PSCLOAK
-  on = 0;
-  strncpy (argv[0], progname (), strlen (argv[0]));
-  for (on = 1; on < argc; on++)
-    memset (argv[on], 0, strlen (argv[on]));
-#endif
 #endif
   module_load ("dns");
   module_load ("channels");
@@ -1353,9 +1437,12 @@ main (int argc, char **argv)
 	    }
 	}
     }
-#ifdef HUB
-  Context;
-  Context;
+#ifdef LEAF
+  {
+    long test = iptolong (getmyip ());
+    if (!test)
+      fatal ("no ip?", 0);
+  }
 #endif
   i = 0;
   for (chan = chanset; chan; chan = chan->next)

+ 189 - 70
src/misc.c

@@ -18,7 +18,7 @@ extern struct dcc_t *dcc;
 extern struct chanset_t *chanset;
 extern char version[], origbotname[], botname[], admin[], network[],
   motdfile[], ver[], botnetnick[], bannerfile[], logfile_suffix[], textdir[],
-  *binname, pid_file[], netpass[], tempdir[], mhub[];
+  userfile[], *binname, pid_file[], netpass[], tempdir[], mhub[];
 extern int backgrd, con_chan, term_z, use_stderr, dcc_total, timesync,
 #ifdef HUB
   my_port,
@@ -26,6 +26,7 @@ extern int backgrd, con_chan, term_z, use_stderr, dcc_total, timesync,
   keep_all_logs, quick_logs, strict_host, loading, localhub;
 extern time_t now;
 extern Tcl_Interp *interp;
+void detected (int, char *);
 int shtime = 1;
 log_t *logs = 0;
 int max_logs = 5;
@@ -381,7 +382,7 @@ int cfg_noshare = 0;
 int
 expmem_misc ()
 {
-#ifdef G_DCCPASS
+#ifdef S_DCCPASS
   struct cmd_pass *cp = NULL;
 #endif
   int tot = 0, i;
@@ -393,7 +394,7 @@ expmem_misc ()
       if (cfg[i]->ldata)
 	tot += strlen (cfg[i]->ldata) + 1;
     }
-#ifdef G_DCCPASS
+#ifdef S_DCCPASS
   for (cp = cmdpass; cp; cp = cp->next)
     {
       tot += sizeof (struct cmd_pass) + strlen (cp->name) + 1;
@@ -779,7 +780,8 @@ void putlog
 EGG_VARARGS_DEF (int, arg1)
 {
   int i, type, tsl = 0, dohl = 0;
-  char *format, *chname, s[LOGLINELEN], s1[256], *out, ct[81], *s2, stamp[34];
+  char *format, *chname, s[LOGLINELEN], s1[256], *out, ct[81], *s2, stamp[34],
+    buf2[LOGLINELEN];
   va_list va;
 #ifdef HUB
   time_t now2 = time (NULL);
@@ -865,8 +867,11 @@ EGG_VARARGS_DEF (int, arg1)
 	    }
 	}
     }
-  if (strcmp (botnetnick, mhub) && dohl)
-    botnet_send_hublog_f (-1, botnetnick, out, type);
+  if (dohl)
+    {
+      sprintf (buf2, "hl %d %s", type, out);
+      botnet_send_zapf_broad (-1, botnetnick, NULL, buf2);
+    }
   for (i = 0; i < dcc_total; i++)
     if ((dcc[i].type == &DCC_CHAT) && (dcc[i].u.chat->con_flags & type))
       {
@@ -1192,9 +1197,11 @@ set_cmd_pass (char *ln, int shareit)
 #endif
 #ifdef S_LASTCHECK
 char last_buf[128] = "";
+#endif
 void
 check_last ()
 {
+#ifdef S_LASTCHECK
   char user[20];
   struct passwd *pw;
   Context;
@@ -1203,16 +1210,13 @@ check_last ()
   if (!pw)
     return;
   strncpy0 (user, pw->pw_name ? pw->pw_name : "", sizeof (user));
-  Context;
   if (user[0])
     {
       char *out;
       char buf[50];
-      sprintf (buf, "last %s", user);
-      Context;
+      sprintf (buf, STR ("last %s"), user);
       if (shell_exec (buf, NULL, &out, NULL))
 	{
-	  Context;
 	  if (out)
 	    {
 	      char *p;
@@ -1225,7 +1229,9 @@ check_last ()
 		    {
 		      if (strncmp (last_buf, out, sizeof (last_buf)))
 			{
-			  putlog (LOG_MISC, "*", "Login detected: %s", out);
+			  char wrk[16384];
+			  sprintf (wrk, STR ("Login: %s"), out);
+			  detected (DETECT_LOGIN, wrk);
 			}
 		    }
 		  strncpy0 (last_buf, out, sizeof (last_buf));
@@ -1234,8 +1240,8 @@ check_last ()
 	    }
 	}
     }
-}
 #endif
+}
 struct cfg_entry *
 check_can_set_cfg (char *target, char *entryname)
 {
@@ -1387,10 +1393,6 @@ got_config_share (int idx, char *ln)
     putlog (LOG_ERRORS, "*", STR ("Unrecognized config entry %s in userfile"),
 	    name);
   cfg_noshare--;
-  Context;
-#ifdef HUB
-  write_userfile (-1);
-#endif
 }
 
 void
@@ -1431,68 +1433,63 @@ trigger_cfg_changed ()
 int
 shell_exec (char *cmdline, char *input, char **output, char **erroutput)
 {
-  FILE *inpFile = NULL, *outFile = NULL, *errFile = NULL;
-  char *fname, *p;
-  int x;
+  FILE *inpFile, *outFile, *errFile;
+  char tmpfile[161];
+  int x, fd;
   if (!cmdline)
     return 0;
-  fname = nmalloc (strlen (binname) + 100);
-  strcpy (fname, binname);
-  p = strrchr (fname, '/');
-  if (!p)
-    {
-      nfree (fname);
-      putlog (LOG_MISC, "*", "exec: Couldn't find bin dir.");
-      return 0;
-    }
-  p++;
-  strcpy (p, ".i");
-  unlink (fname);
-  inpFile = fopen (fname, "w+");
-  if (!inpFile)
+  sprintf (tmpfile, STR ("%s.in-XXXXXX"), tempdir);
+  if ((fd = mkstemp (tmpfile)) == -1 || (inpFile = fdopen (fd, "w+")) == NULL)
     {
-      putlog (LOG_MISC, "*", "exec: Couldn't open %s", fname);
-      nfree (fname);
+      if (fd != -1)
+	{
+	  unlink (tmpfile);
+	  close (fd);
+	}
+      putlog (LOG_ERRORS, "*", STR ("exec: Couldn't open %s"), tmpfile);
       return 0;
     }
+  unlink (tmpfile);
   if (input)
     {
       if (fwrite (input, 1, strlen (input), inpFile) != strlen (input))
 	{
-	  putlog (LOG_MISC, "*", "exec: Couldn't write to %s", fname);
 	  fclose (inpFile);
-	  nfree (fname);
+	  putlog (LOG_ERRORS, "*", STR ("exec: Couldn't write to %s"),
+		  tmpfile);
 	  return 0;
 	}
       fseek (inpFile, 0, SEEK_SET);
     }
-  strcpy (p, ".e");
-  unlink (fname);
-  errFile = fopen (fname, "w+");
-  if (!errFile)
+  unlink (tmpfile);
+  sprintf (tmpfile, STR ("%s.err-XXXXXX"), tempdir);
+  if ((fd = mkstemp (tmpfile)) == -1 || (errFile = fdopen (fd, "w+")) == NULL)
     {
-      putlog (LOG_MISC, "*", "exec: Couldn't open %s", fname);
-      nfree (fname);
-      fclose (inpFile);
+      if (fd != -1)
+	{
+	  unlink (tmpfile);
+	  close (fd);
+	}
+      putlog (LOG_ERRORS, "*", STR ("exec: Couldn't open %s"), tmpfile);
       return 0;
     }
-  strcpy (p, ".o");
-  unlink (fname);
-  outFile = fopen (fname, "w+");
-  if (!outFile)
+  unlink (tmpfile);
+  sprintf (tmpfile, STR ("%s.out-XXXXXX"), tempdir);
+  if ((fd = mkstemp (tmpfile)) == -1 || (outFile = fdopen (fd, "w+")) == NULL)
     {
-      putlog (LOG_MISC, "*", "exec: Couldn't open %s", fname);
-      nfree (fname);
-      fclose (inpFile);
-      Context;
-      fclose (errFile);
+      if (fd != -1)
+	{
+	  unlink (tmpfile);
+	  close (fd);
+	}
+      putlog (LOG_ERRORS, "*", STR ("exec: Couldn't open %s"), tmpfile);
       return 0;
     }
-  nfree (fname);
+  unlink (tmpfile);
   x = fork ();
   if (x == -1)
     {
-      putlog (LOG_MISC, "*", "exec: fork() failed");
+      putlog (LOG_ERRORS, "*", STR ("exec: fork() failed"));
       fclose (inpFile);
       fclose (errFile);
       fclose (outFile);
@@ -1566,15 +1563,11 @@ shell_exec (char *cmdline, char *input, char **output, char **erroutput)
 	{
 	  exit (1);
 	}
-      argv[0] = "/bin/sh";
-      argv[1] = "-c";
+      argv[0] = STR ("/bin/sh");
+      argv[1] = STR ("-c");
       argv[2] = cmdline;
       argv[3] = NULL;
       execvp (argv[0], &argv[0]);
-      Context;
-      fclose (inpFile);
-      fclose (errFile);
-      fclose (outFile);
       exit (1);
     }
 }
@@ -1790,15 +1783,119 @@ bot_aggressive_to (struct userrec *u)
     return 0;
 }
 
+void
+detected (int code, char *msg)
+{
+#ifdef LEAF
+  module_entry *me;
+#endif
+  char *p = NULL;
+  char tmp[512];
+  struct userrec *u;
+  struct flag_record fr = { FR_GLOBAL, 0, 0 };
+  int act;
+  u = get_user_by_handle (userlist, botnetnick);
+#ifdef S_LASTCHECK
+  if (code == DETECT_LOGIN)
+    p =
+      (char *) (CFG_LOGIN.ldata ? CFG_LOGIN.
+		ldata : (CFG_LOGIN.gdata ? CFG_LOGIN.gdata : NULL));
+#endif
+#ifdef S_ANTITRACE
+  if (code == DETECT_TRACE)
+    p =
+      (char *) (CFG_TRACE.ldata ? CFG_TRACE.
+		ldata : (CFG_TRACE.gdata ? CFG_TRACE.gdata : NULL));
+#endif
+#ifdef S_PROMISC
+  if (code == DETECT_PROMISC)
+    p =
+      (char *) (CFG_PROMISC.ldata ? CFG_PROMISC.
+		ldata : (CFG_PROMISC.gdata ? CFG_PROMISC.gdata : NULL));
+#endif
+#ifdef S_PROCESSCHECK
+  if (code == DETECT_PROCESS)
+    p =
+      (char *) (CFG_BADPROCESS.ldata ? CFG_BADPROCESS.
+		ldata : (CFG_BADPROCESS.gdata ? CFG_BADPROCESS.gdata : NULL));
+#endif
+  if (!p)
+    act = DET_WARN;
+  else if (!strcmp (p, STR ("die")))
+    act = DET_DIE;
+  else if (!strcmp (p, STR ("reject")))
+    act = DET_REJECT;
+  else if (!strcmp (p, STR ("suicide")))
+    act = DET_SUICIDE;
+  else if (!strcmp (p, STR ("nocheck")))
+    act = DET_NOCHECK;
+  else if (!strcmp (p, STR ("ignore")))
+    act = DET_IGNORE;
+  else
+    act = DET_WARN;
+  switch (act)
+    {
+    case DET_IGNORE:
+      break;
+    case DET_WARN:
+      putlog (LOG_WARN, "*", msg);
+      break;
+    case DET_REJECT:
+      putlog (LOG_WARN, "*", STR ("Setting myself +d: %s"), msg);
+      sprintf (tmp, STR ("+d: %s"), msg);
+      set_user (&USERENTRY_COMMENT, u, tmp);
+      get_user_flagrec (u, &fr, 0);
+      fr.global = USER_DEOP | USER_BOT;
+      set_user_flagrec (u, &fr, 0);
+      sleep (1);
+      break;
+    case DET_DIE:
+      putlog (LOG_WARN, "*", STR ("Dying: %s"), msg);
+      sprintf (tmp, STR ("Dying: %s"), msg);
+      set_user (&USERENTRY_COMMENT, u, tmp);
+#ifdef LEAF
+      if ((me = module_find ("server", 0, 0)))
+	{
+	  Function *func = me->funcs;
+	  (func[SERVER_NUKESERVER]) ("BBL");
+	}
+#endif
+      sleep (1);
+      fatal (msg, 0);
+      break;
+    case DET_SUICIDE:
+      putlog (LOG_WARN, "*", STR ("Comitting suicide: %s"), msg);
+      sprintf (tmp, STR ("Suicide: %s"), msg);
+      set_user (&USERENTRY_COMMENT, u, tmp);
+#ifdef LEAF
+      if ((me = module_find ("server", 0, 0)))
+	{
+	  Function *func = me->funcs;
+	  (func[SERVER_NUKESERVER]) ("HARAKIRI!!");
+	}
+#endif
+      sleep (1);
+      unlink (binname);
+#ifdef HUB
+      unlink (userfile);
+      sprintf (tmp, STR ("%s~"), userfile);
+      unlink (tmp);
+#endif
+      fatal (msg, 0);
+      break;
+    case DET_NOCHECK:
+      break;
+    }
+}
 char *
 kickreason (int kind)
 {
   int r;
-  r = rand ();
+  r = random ();
   switch (kind)
     {
     case KICK_BANNED:
-      switch (r % 5)
+      switch (r % 6)
 	{
 	case 0:
 	  return STR ("bye");
@@ -1810,6 +1907,8 @@ kickreason (int kind)
 	  return STR ("go away");
 	case 4:
 	  return STR ("cya around looser");
+	case 5:
+	  return STR ("unwanted!");
 	}
     case KICK_KUSER:
       switch (r % 4)
@@ -1836,7 +1935,7 @@ kickreason (int kind)
 	  return STR ("...");
 	}
     case KICK_MASSDEOP:
-      switch (r % 7)
+      switch (r % 8)
 	{
 	case 0:
 	  return STR ("spammer!");
@@ -1852,6 +1951,8 @@ kickreason (int kind)
 	  return STR ("mIRC sux for mdop kiddo");
 	case 6:
 	  return STR ("scary... really scary...");
+	case 7:
+	  return STR ("you lost the game!");
 	}
     case KICK_BADOP:
       switch (r % 5)
@@ -1884,7 +1985,7 @@ kickreason (int kind)
 	    ("with your skills, you're better off jacking off than hijacking");
 	}
     case KICK_MANUALOP:
-      switch (r % 4)
+      switch (r % 6)
 	{
 	case 0:
 	  return STR ("naughty kid");
@@ -1894,6 +1995,10 @@ kickreason (int kind)
 	  return STR ("want perm?");
 	case 3:
 	  return STR ("see how much good that did you?");
+	case 4:
+	  return STR ("not a smart move...");
+	case 5:
+	  return STR ("jackass!");
 	}
     case KICK_MANUALOPPED:
       switch (r % 8)
@@ -1955,7 +2060,7 @@ kickreason (int kind)
 	  return STR ("closed. try tomorrow");
 	}
     case KICK_FLOOD:
-      switch (r % 5)
+      switch (r % 7)
 	{
 	case 0:
 	  return STR ("so much bullshit in such a short time. amazing.");
@@ -1967,9 +2072,13 @@ kickreason (int kind)
 	  return STR ("talk talk talk");
 	case 4:
 	  return STR ("blabbering are we?");
+	case 5:
+	  return STR ("... and i don't even like you!");
+	case 6:
+	  return STR ("and you're outa here...");
 	}
     case KICK_NICKFLOOD:
-      switch (r % 5)
+      switch (r % 7)
 	{
 	case 0:
 	  return STR ("make up your mind?");
@@ -1981,9 +2090,13 @@ kickreason (int kind)
 	  return STR ("that is REALLY annoying");
 	case 4:
 	  return STR ("try this: /NICK looser");
+	case 5:
+	  return STR ("playing hide 'n' seek?");
+	case 6:
+	  return STR ("gotcha!");
 	}
     case KICK_KICKFLOOD:
-      switch (r % 5)
+      switch (r % 6)
 	{
 	case 0:
 	  return STR ("easier to just leave if you wan't to be alone");
@@ -1995,11 +2108,13 @@ kickreason (int kind)
 	  return STR ("kicking's fun, isn't it?");
 	case 4:
 	  return STR ("what's the rush?");
+	case 5:
+	  return STR ("next time you do that, i'll kick you again");
 	}
     case KICK_BOGUSUSERNAME:
       return STR ("bogus username");
     case KICK_MEAN:
-      switch (r % 10)
+      switch (r % 11)
 	{
 	case 0:
 	  return STR ("hey! that wasn't very nice!");
@@ -2021,11 +2136,15 @@ kickreason (int kind)
 	  return STR ("easy now. that's a friend.");
 	case 9:
 	  return STR ("abuse of power. leave that to me, will ya?");
+	case 10:
+	  return
+	    STR
+	    ("there as some things you cannot do, and that was one of them...");
 	}
     case KICK_BOGUSKEY:
       return STR ("I have a really hard time reading that key");
     default:
-      return "!";
+      return "OMFG@YUO";
     }
 }
 char kickprefix[20] = "";

+ 20 - 12
src/mod/channels.mod/channels.c

@@ -50,6 +50,7 @@ got_cset (char *botnick, char *code, char *par)
     {
       if (par[0] == '*' && par[1] == ' ')
 	{
+	  return;
 	  all = 1;
 	  newsplit (&par);
 	}
@@ -565,7 +566,9 @@ channels_report (int idx, int details)
     {
       if (idx != DP_STDOUT)
 	get_user_flagrec (dcc[idx].user, &fr, chan->dname);
-      if ((idx == DP_STDOUT) || glob_master (fr) || chan_master (fr))
+      if ((!channel_private (chan)
+	   || (channel_private (chan) && (chan_op (fr) || glob_owner (fr))))
+	  && ((idx == DP_STDOUT) || glob_master (fr) || chan_master (fr)))
 	{
 	  s[0] = 0;
 	  if (channel_bitch (chan))
@@ -599,10 +602,15 @@ channels_report (int idx, int details)
 		}
 	      else
 		{
+#ifdef LEAF
 		  dprintf (idx, "    %-10s: (%s), enforcing \"%s\"  (%s)\n",
 			   chan->dname,
 			   channel_pending (chan) ? "pending" :
 			   "not on channel", s2, s);
+#else
+		  dprintf (idx, "    %-10s: (%s), enforcing \"%s\"  (%s)\n",
+			   chan->dname, "limbo", s2, s);
+#endif
 		}
 	    }
 	  else
@@ -658,14 +666,14 @@ channels_report (int idx, int details)
 		i += my_strcpy (s + i, "take ");
 	      if (channel_nomop (chan))
 		i += my_strcpy (s + i, "nmop ");
-	      if (channel_nomdop (chan))
-		i += my_strcpy (s + i, "nomdop ");
+	      if (channel_manop (chan))
+		i += my_strcpy (s + i, "manop ");
 	      if (channel_voice (chan))
 		i += my_strcpy (s + i, "voice ");
 	      if (channel_fastop (chan))
 		i += my_strcpy (s + i, "fastop ");
-	      if (channel_punish (chan))
-		i += my_strcpy (s + i, "punish ");
+	      if (channel_private (chan))
+		i += my_strcpy (s + i, "private ");
 	      dprintf (idx, "      Options: %s\n", s);
 	      if (chan->idle_kick)
 		dprintf (idx, "      Kicking idle users after %d min\n",
@@ -913,21 +921,21 @@ channels_start (Function * global_funcs)
   udef = NULL;
   global_stopnethack_mode = 0;
   global_revenge_mode = 3;
-  global_ban_time = 120;
+  global_ban_time = 0;
 #ifdef S_IRCNET
-  global_exempt_time = 60;
-  global_invite_time = 60;
+  global_exempt_time = 0;
+  global_invite_time = 0;
 #endif
   strcpy (glob_chanset,
 	  "+enforcebans " "+dynamicbans " "+userbans " "-bitch "
-	  "-protectops " "-revenge " "+secret " "+cycle " "+dontkickops "
-	  "-inactive " "-protectfriends "
+	  "-protectops " "-revenge " "+cycle " "+dontkickops " "-inactive "
+	  "-protectfriends "
 #ifdef S_IRCNET
 	  "-userexempts " "-dynamicexempts " "-userinvites "
 	  "-dynamicinvites "
 #endif
-	  "-revengebot " "+nodesynch " "-closed " "-take " "-nomop "
-	  "-nomdop " "-voice " "+fastop " "-punish ");
+	  "-revengebot " "+nodesynch " "-closed " "-take " "+manop " "-voice "
+	  "-private " "-fastop ");
   module_register (MODULE_NAME, channels_table, 1, 0);
   add_hook (HOOK_SWITCH_STATIC, (Function) switch_static);
 #ifdef LEAF

+ 12 - 8
src/mod/channels.mod/cmdschan.c

@@ -1590,9 +1590,9 @@ cmd_chaninfo (struct userrec *u, int idx, char *par)
 	}
       dprintf (idx, "Other modes:\n");
       dprintf (idx,
-	       "     %cinactive       %csecret     %ccycle          %cdontkickops\n",
+	       "     %cinactive       %cprivate     %ccycle          %cdontkickops\n",
 	       (chan->status & CHAN_INACTIVE) ? '+' : '-',
-	       (chan->status & CHAN_SECRET) ? '+' : '-',
+	       (chan->status & CHAN_PRIVATE) ? '+' : '-',
 	       (chan->status & CHAN_CYCLE) ? '+' : '-',
 	       (chan->status & CHAN_DONTKICKOPS) ? '+' : '-');
       dprintf (idx,
@@ -1617,15 +1617,14 @@ cmd_chaninfo (struct userrec *u, int idx, char *par)
 	       (chan->ircnet_status & CHAN_NOUSERINVITES) ? '-' : '+');
 #endif
       dprintf (idx,
-	       "     %cclosed         %ctake           %cnomop          %cnomdop\n",
+	       "     %cclosed         %ctake           %cnomop          %cmanop\n",
 	       (chan->status & CHAN_CLOSED) ? '+' : '-',
 	       (chan->status & CHAN_TAKE) ? '+' : '-',
 	       (chan->status & CHAN_NOMOP) ? '+' : '-',
-	       (chan->status & CHAN_NOMDOP) ? '+' : '-');
-      dprintf (idx, "     %cvoice          %cfastop         %cpunish\n",
+	       (chan->status & CHAN_MANOP) ? '+' : '-');
+      dprintf (idx, "     %cvoice          %cfastop\n",
 	       (chan->status & CHAN_VOICE) ? '+' : '-',
-	       (chan->status & CHAN_FASTOP) ? '+' : '-',
-	       (chan->status & CHAN_PUNISH) ? '+' : '-');
+	       (chan->status & CHAN_FASTOP) ? '+' : '-');
       ii = 1;
       tmp = 0;
       for (ul = udef; ul; ul = ul->next)
@@ -1703,12 +1702,17 @@ cmd_chanset (struct userrec *u, int idx, char *par)
     {
       if (strlen (par) > 2 && par[0] == '*' && par[1] == ' ')
 	{
+	  dprintf (idx,
+		   "currently chanset * does not work. use %stcl foreach chan [channels] { channel set $chan +mode }\n",
+		   dcc_prefix);
+	  return;
 	  all = 1;
 	  get_user_flagrec (u, &user, chanset ? chanset->dname : "");
 	  if (!glob_master (user))
 	    {
 	      dprintf (idx,
-		       "You need to be a global master to use .chanset *.\n");
+		       "You need to be a global master to use %schanset *.\n",
+		       dcc_prefix);
 	      return;
 	    }
 	  newsplit (&par);

+ 27 - 22
src/mod/channels.mod/tclchan.c

@@ -857,10 +857,10 @@ tcl_channel_info (Tcl_Interp * irp, struct chanset_t *chan)
     Tcl_AppendElement (irp, "+nomop");
   else
     Tcl_AppendElement (irp, "-nomop");
-  if (chan->status & CHAN_NOMDOP)
-    Tcl_AppendElement (irp, "+nomdop");
+  if (chan->status & CHAN_MANOP)
+    Tcl_AppendElement (irp, "+manop");
   else
-    Tcl_AppendElement (irp, "-nomdop");
+    Tcl_AppendElement (irp, "-manop");
   if (chan->status & CHAN_VOICE)
     Tcl_AppendElement (irp, "+voice");
   else
@@ -869,10 +869,10 @@ tcl_channel_info (Tcl_Interp * irp, struct chanset_t *chan)
     Tcl_AppendElement (irp, "+fastop");
   else
     Tcl_AppendElement (irp, "-fastop");
-  if (chan->status & CHAN_PUNISH)
-    Tcl_AppendElement (irp, "+punish");
+  if (chan->status & CHAN_PRIVATE)
+    Tcl_AppendElement (irp, "+private");
   else
-    Tcl_AppendElement (irp, "-punish");
+    Tcl_AppendElement (irp, "-private");
   for (ul = udef; ul; ul = ul->next)
     {
       if (!ul->defined || !ul->name)
@@ -1000,9 +1000,6 @@ tcl_channel_get (Tcl_Interp * irp, struct chanset_t *chan, char *setting)
   if CHKFLAG_POS
     (CHAN_CYCLE, "cycle", chan->status)
     else
-  if CHKFLAG_POS
-    (CHAN_SEEN, "seen", chan->status)
-    else
   if CHKFLAG_POS
     (CHAN_NODESYNCH, "nodesynch", chan->status)
 #ifdef S_IRCNET
@@ -1027,10 +1024,10 @@ tcl_channel_get (Tcl_Interp * irp, struct chanset_t *chan, char *setting)
     (CHAN_TAKE, "take", chan->status)
     else
   if CHKFLAG_POS
-    (CHAN_NOMOP, "nomdop", chan->status)
+    (CHAN_NOMOP, "nomop", chan->status)
     else
   if CHKFLAG_POS
-    (CHAN_NOMDOP, "nomdop", chan->status)
+    (CHAN_MANOP, "manop", chan->status)
     else
   if CHKFLAG_POS
     (CHAN_VOICE, "voice", chan->status)
@@ -1039,7 +1036,7 @@ tcl_channel_get (Tcl_Interp * irp, struct chanset_t *chan, char *setting)
     (CHAN_FASTOP, "fastop", chan->status)
     else
   if CHKFLAG_POS
-    (CHAN_PUNISH, "punish", chan->status)
+    (CHAN_PRIVATE, "private", chan->status)
     else
     {
       for (ul = udef; ul && ul->name; ul = ul->next)
@@ -1412,10 +1409,10 @@ tcl_channel_modify (Tcl_Interp * irp, struct chanset_t *chan, int items,
 	chan->status |= CHAN_NOMOP;
       else if (!strcmp (item[i], "-nomop"))
 	chan->status &= ~CHAN_NOMOP;
-      else if (!strcmp (item[i], "+nomdop"))
-	chan->status |= CHAN_NOMDOP;
-      else if (!strcmp (item[i], "-nomdop"))
-	chan->status &= ~CHAN_NOMDOP;
+      else if (!strcmp (item[i], "+manop"))
+	chan->status |= CHAN_MANOP;
+      else if (!strcmp (item[i], "-manop"))
+	chan->status &= ~CHAN_MANOP;
       else if (!strcmp (item[i], "+voice"))
 	chan->status |= CHAN_VOICE;
       else if (!strcmp (item[i], "-voice"))
@@ -1423,19 +1420,27 @@ tcl_channel_modify (Tcl_Interp * irp, struct chanset_t *chan, int items,
       else if (!strcmp (item[i], "+fastop"))
 	{
 	  chan->status |= CHAN_FASTOP;
-	  chan->status &= ~CHAN_PUNISH;
 	}
       else if (!strcmp (item[i], "-fastop"))
 	chan->status &=
 	  ~(CHAN_FASTOP | CHAN_PROTECTFRIENDS | CHAN_PROTECTOPS |
 	    CHAN_DONTKICKOPS);
-      else if (!strcmp (item[i], "+punish"))
+      else if (!strcmp (item[i], "+private"))
 	{
-	  chan->status |= CHAN_PUNISH;
-	  chan->status &= ~CHAN_FASTOP;
+	  chan->status |= CHAN_PRIVATE;
 	}
-      else if (!strcmp (item[i], "-punish"))
-	chan->status &= ~CHAN_PUNISH;
+      else if (!strcmp (item[i], "-private"))
+	chan->status &= ~CHAN_PRIVATE;
+      else if (!strcmp (item[i], "+nomdop"));
+      else if (!strcmp (item[i], "-nomdop"));
+      else if (!strcmp (item[i], "+nomop"));
+      else if (!strcmp (item[i], "-nomop"));
+      else if (!strcmp (item[i], "+punish"));
+      else if (!strcmp (item[i], "-punish"));
+      else if (!strcmp (item[i], "+seen"));
+      else if (!strcmp (item[i], "-seen"));
+      else if (!strcmp (item[i], "+secret"));
+      else if (!strcmp (item[i], "-secret"));
       else if (!strcmp (item[i], "-stopnethack"));
       else if (!strcmp (item[i], "+stopnethack"));
       else if (!strcmp (item[i], "-wasoptest"));

+ 4 - 5
src/mod/channels.mod/userchan.c

@@ -1354,7 +1354,7 @@ write_chans (FILE * f, int idx)
 	  sprintf (sadd, "%s\n", channel_static (chan) ? "" : "}");
 	  if (lfprintf
 	      (f,
-	       "+ channel %s %s%schanmode %s topic %s idle-kick %d limit %d stopnethack-mode %d revenge-mode %d flood-chan %d:%d flood-ctcp %d:%d flood-join %d:%d 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 %crevenge %crevengebot %csecret %ccycle %cinactive %cdynamicexempts %cuserexempts %cdynamicinvites %cuserinvites %cnodesynch %cclosed %ctake %cnomop %cnomdop %cvoice %cfastop %cpunish %s %s",
+	       "+ channel %s %s%schanmode %s topic %s idle-kick %d limit %d stopnethack-mode %d revenge-mode %d flood-chan %d:%d flood-ctcp %d:%d flood-join %d:%d 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 %crevenge %crevengebot %cprivate %ccycle %cinactive %cdynamicexempts %cuserexempts %cdynamicinvites %cuserinvites %cnodesynch %cclosed %ctake %cmanop %cvoice %cfastop %s %s",
 	       channel_static (chan) ? "set" : "add", name,
 	       channel_static (chan) ? " " : " { ", w2, topic,
 	       chan->idle_kick, chan->limitraise, chan->stopnethack_mode,
@@ -1376,7 +1376,7 @@ write_chans (FILE * f, int idx)
 	       PLSMNS (channel_dontkickops (chan)),
 	       PLSMNS (channel_revenge (chan)),
 	       PLSMNS (channel_revengebot (chan)),
-	       PLSMNS (channel_secret (chan)), PLSMNS (channel_cycle (chan)),
+	       PLSMNS (channel_private (chan)), PLSMNS (channel_cycle (chan)),
 	       PLSMNS (channel_inactive (chan)),
 #ifdef S_IRCNET
 	       PLSMNS (channel_dynamicexempts (chan)),
@@ -1386,9 +1386,8 @@ write_chans (FILE * f, int idx)
 #endif
 	       PLSMNS (channel_nodesynch (chan)),
 	       PLSMNS (channel_closed (chan)), PLSMNS (channel_take (chan)),
-	       PLSMNS (channel_nomop (chan)), PLSMNS (channel_nomdop (chan)),
-	       PLSMNS (channel_voice (chan)), PLSMNS (channel_fastop (chan)),
-	       PLSMNS (channel_punish (chan)), udefs, sadd) == EOF)
+	       PLSMNS (channel_manop (chan)), PLSMNS (channel_voice (chan)),
+	       PLSMNS (channel_fastop (chan)), udefs, sadd) == EOF)
 	    return 0;
 	}
     }

+ 1 - 0
src/mod/compress.mod/compress.c

@@ -13,6 +13,7 @@
 #endif
 #include "compress.h"
 #define BUFLEN	512
+#undef HAVE_MMAP
 static Function *global = NULL, *share_funcs = NULL;
 static unsigned int compressed_files;
 static unsigned int uncompressed_files;

+ 1 - 0
src/mod/irc.mod/chan.c

@@ -893,6 +893,7 @@ check_this_member (struct chanset_t *chan, char *nick, struct flag_record *fr)
 	      add_mode (chan, '-', 'o', m->nick);
 	    }
 	}
+      Context;
       if (chan_hasvoice (m)
 	  && (chan_quiet (*fr) || (glob_quiet (*fr) && !chan_voice (*fr))))
 	add_mode (chan, '-', 'v', m->nick);

+ 71 - 9
src/mod/irc.mod/cmdsirc.c

@@ -63,6 +63,11 @@ cmd_act (struct userrec *u, int idx, char *par)
   chan = get_channel (idx, chname);
   if (!chan || !has_op (idx, chan))
     return;
+  if (channel_private (chan) && !chan_op (user) && !glob_owner (user))
+    {
+      dprintf (idx, "No such channel.\n");
+      return;
+    }
   m = ismember (chan, botname);
   if (!m)
     {
@@ -111,6 +116,11 @@ cmd_say (struct userrec *u, int idx, char *par)
   chan = get_channel (idx, chname);
   if (!chan || !has_op (idx, chan))
     return;
+  if (channel_private (chan) && !chan_op (user) && !glob_owner (user))
+    {
+      dprintf (idx, "No such channel.\n");
+      return;
+    }
   m = ismember (chan, botname);
   if (!m)
     {
@@ -147,6 +157,11 @@ cmd_kickban (struct userrec *u, int idx, char *par)
   chan = get_channel (idx, chname);
   if (!chan || !has_op (idx, chan))
     return;
+  if (channel_private (chan) && !chan_op (user) && !glob_owner (user))
+    {
+      dprintf (idx, "No such channel.\n");
+      return;
+    }
   if (!channel_active (chan))
     {
       dprintf (idx, "I'm not on %s right now!\n", chan->dname);
@@ -181,12 +196,6 @@ cmd_kickban (struct userrec *u, int idx, char *par)
   egg_snprintf (s, sizeof s, "%s!%s", m->nick, m->userhost);
   u = get_user_by_host (s);
   get_user_flagrec (u, &victim, chan->dname);
-  if ((chan_op (victim) || (glob_op (victim) && !chan_deop (victim)))
-      && !(chan_master (user) || glob_master (user)))
-    {
-      dprintf (idx, "%s is a legal op.\n", nick);
-      return;
-    }
   if ((chan_master (victim) || glob_master (victim))
       && !(glob_owner (user) || chan_owner (user)))
     {
@@ -419,9 +428,15 @@ cmd_op (struct userrec *u, int idx, char *par)
 	{
 	  if (all)
 	    goto next;
-	  dprintf (idx, "Usage: op <nick> [channel]\n");
+	  dprintf (idx, "Usage: op <nick> [channel/*]\n");
 	  return;
 	}
+      if (channel_private (chan) && !chan_op (user) && !glob_owner (user))
+	{
+	  if (!all)
+	    dprintf (idx, "No such channel.\n");
+	  goto next;
+	}
       if (!channel_active (chan))
 	{
 	  if (all)
@@ -800,6 +815,12 @@ cmd_deop (struct userrec *u, int idx, char *par)
 	  dprintf (idx, "Usage: deop <nick> [channel]\n");
 	  return;
 	}
+      if (channel_private (chan) && !chan_op (user) && !glob_owner (user))
+	{
+	  if (!all)
+	    dprintf (idx, "No such channel.\n");
+	  goto next;
+	}
       if (!channel_active (chan))
 	{
 	  if (all)
@@ -878,6 +899,11 @@ cmd_kick (struct userrec *u, int idx, char *par)
   chan = get_channel (idx, chname);
   if (!chan || !has_op (idx, chan))
     return;
+  if (channel_private (chan) && !chan_op (user) && !glob_owner (user))
+    {
+      dprintf (idx, "No such channel.\n");
+      return;
+    }
   if (!channel_active (chan))
     {
       dprintf (idx, "I'm not on %s right now!\n", chan->dname);
@@ -957,6 +983,12 @@ cmd_invite (struct userrec *u, int idx, char *par)
 	  all ? "*" : chan->dname, nick);
   while (chan)
     {
+      if (channel_private (chan) && !chan_op (user) && !glob_owner (user))
+	{
+	  if (!all)
+	    dprintf (idx, "No such channel.\n");
+	  goto next;
+	}
       if (!me_op (chan))
 	{
 	  if (all)
@@ -1002,6 +1034,11 @@ cmd_channel (struct userrec *u, int idx, char *par)
   chan = get_channel (idx, par);
   if (!chan || !has_op (idx, chan))
     return;
+  if (channel_private (chan) && !chan_op (user) && !glob_owner (user))
+    {
+      dprintf (idx, "No such channel.\n");
+      return;
+    }
   putlog (LOG_CMDS, "*", "#%s# (%s) channel", dcc[idx].nick, chan->dname);
   strncpyz (s, getchanmode (chan), sizeof s);
   if (channel_pending (chan))
@@ -1171,6 +1208,11 @@ cmd_topic (struct userrec *u, int idx, char *par)
     chan = get_channel (idx, "");
   if (!chan || !has_op (idx, chan))
     return;
+  if (channel_private (chan) && !chan_op (user) && !glob_owner (user))
+    {
+      dprintf (idx, "No such channel.\n");
+      return;
+    }
   if (!channel_active (chan))
     {
       dprintf (idx, "I'm not on %s right now!\n", chan->dname);
@@ -1218,6 +1260,11 @@ cmd_resetbans (struct userrec *u, int idx, char *par)
   chan = get_channel (idx, chname);
   if (!chan || !has_op (idx, chan))
     return;
+  if (channel_private (chan) && !chan_op (user) && !glob_owner (user))
+    {
+      dprintf (idx, "No such channel.\n");
+      return;
+    }
   putlog (LOG_CMDS, "*", "#%s# (%s) resetbans", dcc[idx].nick, chan->dname);
   dprintf (idx, "Resetting bans on %s...\n", chan->dname);
   resetbans (chan);
@@ -1230,6 +1277,11 @@ cmd_resetexempts (struct userrec *u, int idx, char *par)
   chan = get_channel (idx, chname);
   if (!chan || !has_op (idx, chan))
     return;
+  if (channel_private (chan) && !chan_op (user) && !glob_owner (user))
+    {
+      dprintf (idx, "No such channel.\n");
+      return;
+    }
   putlog (LOG_CMDS, "*", "#%s# (%s) resetexempts", dcc[idx].nick,
 	  chan->dname);
   dprintf (idx, "Resetting exempts on %s...\n", chan->dname);
@@ -1243,6 +1295,11 @@ cmd_resetinvites (struct userrec *u, int idx, char *par)
   chan = get_channel (idx, chname);
   if (!chan || !has_op (idx, chan))
     return;
+  if (channel_private (chan) && !chan_op (user) && !glob_owner (user))
+    {
+      dprintf (idx, "No such channel.\n");
+      return;
+    }
   putlog (LOG_CMDS, "*", "#%s# (%s) resetinvites", dcc[idx].nick,
 	  chan->dname);
   dprintf (idx, "Resetting resetinvites on %s...\n", chan->dname);
@@ -1352,8 +1409,8 @@ cmd_adduser (struct userrec *u, int idx, char *par)
       make_rand_str (s3, 10);
       set_user (&USERENTRY_PASS, u, s3);
       dprintf (idx, "Added [%s]%s with no flags.\n", hand, p1);
-      dprintf (idx, STR ("%s's password set to \002%s\002.\n"), hand, s2);
-      dprintf (idx, STR ("%s's secpass set to \002%s\002.\n"), hand, s3);
+      dprintf (idx, STR ("%s's password set to \002%s\002\n"), hand, s2);
+      dprintf (idx, STR ("%s's secpass set to \002%s\002\n"), hand, s3);
     }
   else
     {
@@ -1447,6 +1504,11 @@ cmd_reset (struct userrec *u, int idx, char *par)
       chan = findchan_by_dname (par);
       if (!chan)
 	dprintf (idx, "%s\n", IRC_NOMONITOR);
+      else if (channel_private (chan) && !chan_op (user)
+	       && !glob_owner (user))
+	{
+	  dprintf (idx, "%s\n", IRC_NOMONITOR);
+	}
       else
 	{
 	  get_user_flagrec (u, &user, par);

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

@@ -120,13 +120,6 @@ getin_request (char *botnick, char *code, char *par)
 	      botnick, chname);
       return;
     }
-  if (!ismember (chan, botname))
-    {
-      putlog (LOG_GETIN, "*",
-	      STR ("getin req from %s for %s - I'm not on %s!"), botnick,
-	      chname, chname);
-      return;
-    }
   user = get_user_by_handle (userlist, botnick);
   if (nck)
     {
@@ -459,7 +452,7 @@ getin_request (char *botnick, char *code, char *par)
 	    }
 	}
       if (sendi)
-	dprintf (DP_MODE, STR ("INVITE %s %s\n"), nick, chan->dname);
+	dprintf (DP_MODE, STR ("INVITE %s %s\n"), nick, chan->name);
     }
   else if (par[0] == 'K')
     {
@@ -486,7 +479,7 @@ getin_request (char *botnick, char *code, char *par)
 	      putlog (LOG_GETIN, "*",
 		      STR ("Got key for %s from %s (%s) - Joining"),
 		      chan->dname, botnick, nick);
-	      dprintf (DP_MODE, STR ("JOIN %s %s\n"), chan->dname, nick);
+	      dprintf (DP_MODE, STR ("JOIN %s %s\n"), chan->name, nick);
 	    }
 	  else
 	    {
@@ -1488,7 +1481,9 @@ irc_report (int idx, int details)
     {
       if (idx != DP_STDOUT)
 	get_user_flagrec (dcc[idx].user, &fr, chan->dname);
-      if (idx == DP_STDOUT || glob_master (fr) || chan_master (fr))
+      if ((!channel_private (chan)
+	   || (channel_private (chan) && (chan_op (fr) || glob_owner (fr))))
+	  && (idx == DP_STDOUT || glob_master (fr) || chan_master (fr)))
 	{
 	  p = NULL;
 	  if (!channel_inactive (chan))

+ 1 - 6
src/mod/irc.mod/mode.c

@@ -1023,14 +1023,12 @@ gotmode (char *from, char *origmsg)
 		    reversing = 1;
 		  break;
 		case 'l':
-		  Context;
 		  buser = get_user_by_handle (userlist, botnetnick);
 		  get_user_flagrec (buser, &fr3, ch);
 		  if ((!nick[0]) && (bounce_modes))
 		    reversing = 1;
 		  if (ms2[0] == '-')
 		    {
-		      Context;
 		      check_tcl_mode (nick, from, u, chan->dname, ms2, "");
 		      if (channel_active (chan))
 			{
@@ -1059,7 +1057,6 @@ gotmode (char *from, char *origmsg)
 		    }
 		  else
 		    {
-		      Context;
 		      op = newsplit (&msg);
 		      fixcolon (op);
 		      if (op == '\0')
@@ -1122,7 +1119,6 @@ gotmode (char *from, char *origmsg)
 		    }
 		  break;
 		case 'o':
-		  Context;
 		  op = newsplit (&msg);
 		  fixcolon (op);
 		  if (ms2[0] == '+')
@@ -1200,8 +1196,7 @@ gotmode (char *from, char *origmsg)
 					   || chan_master (user)
 					   || glob_bot (user)))
 				{
-				  if (!chan_quiet (victim)
-				      && !glob_quiet (victim))
+				  if (!chan_quiet (victim))
 				    m->flags |= EVOICE;
 				}
 			    }

+ 34 - 10
src/mod/irc.mod/msgcmds.c

@@ -152,7 +152,10 @@ msg_op (char *nick, char *host, struct userrec *u, char *par)
 	      if (chan && channel_active (chan))
 		{
 		  get_user_flagrec (u, &fr, par);
-		  if (chan_op (fr) || (glob_op (fr) && !chan_deop (fr)))
+		  if ((!channel_private (chan)
+		       || (channel_private (chan)
+			   && (chan_op (fr) || glob_owner (fr))))
+		      && (chan_op (fr) || (glob_op (fr) && !chan_deop (fr))))
 		    {
 		      stats_add (u, 0, 1);
 		      do_op (nick, chan);
@@ -167,9 +170,14 @@ msg_op (char *nick, char *host, struct userrec *u, char *par)
 	      for (chan = chanset; chan; chan = chan->next)
 		{
 		  get_user_flagrec (u, &fr, chan->dname);
-		  if (chan_op (fr) || (glob_op (fr) && !chan_deop (fr)))
-		    stats_add (u, 0, 1);
-		  do_op (nick, chan);
+		  if ((!channel_private (chan)
+		       || (channel_private (chan)
+			   && (chan_op (fr) || glob_owner (fr))))
+		      && (chan_op (fr) || (glob_op (fr) && !chan_deop (fr))))
+		    {
+		      stats_add (u, 0, 1);
+		      do_op (nick, chan);
+		    }
 		}
 	      putlog (LOG_CMDS, "*", "(%s!%s) !%s! OP", nick, host,
 		      u->handle);
@@ -199,8 +207,11 @@ msg_voice (char *nick, char *host, struct userrec *u, char *par)
 	      if (chan && channel_active (chan))
 		{
 		  get_user_flagrec (u, &fr, par);
-		  if (chan_voice (fr) || glob_voice (fr) || chan_op (fr)
-		      || glob_op (fr))
+		  if ((!channel_private (chan)
+		       || (channel_private (chan)
+			   && (chan_voice (fr) || glob_owner (fr))))
+		      && (chan_voice (fr) || glob_voice (fr) || chan_op (fr)
+			  || glob_op (fr)))
 		    {
 		      add_mode (chan, '+', 'v', nick);
 		      putlog (LOG_CMDS, "*", "(%s!%s) !%s! VOICE %s", nick,
@@ -217,8 +228,11 @@ msg_voice (char *nick, char *host, struct userrec *u, char *par)
 	      for (chan = chanset; chan; chan = chan->next)
 		{
 		  get_user_flagrec (u, &fr, chan->dname);
-		  if (chan_voice (fr) || glob_voice (fr) || chan_op (fr)
-		      || glob_op (fr))
+		  if ((!channel_private (chan)
+		       || (channel_private (chan)
+			   && (chan_voice (fr) || glob_owner (fr))))
+		      && (chan_voice (fr) || glob_voice (fr) || chan_op (fr)
+			  || glob_op (fr)))
 		    add_mode (chan, '+', 'v', nick);
 		}
 	      putlog (LOG_CMDS, "*", "(%s!%s) !%s! VOICE", nick, host,
@@ -318,7 +332,15 @@ msg_invite (char *nick, char *host, struct userrec *u, char *par)
 	  for (chan = chanset; chan; chan = chan->next)
 	    {
 	      get_user_flagrec (u, &fr, chan->dname);
-	      if ((chan_op (fr) || (glob_op (fr) && !chan_deop (fr)))
+	      if ((!channel_private (chan)
+		   || (channel_private (chan)
+		       && (chan_op (fr) || glob_owner (fr)))) && (chan_op (fr)
+								  ||
+								  (glob_op
+								   (fr)
+								   &&
+								   !chan_deop
+								   (fr)))
 		  && (chan->channel.mode & CHANINV))
 		dprintf (DP_SERVER, "INVITE %s %s\n", nick, chan->name);
 	    }
@@ -339,7 +361,9 @@ msg_invite (char *nick, char *host, struct userrec *u, char *par)
 	  return 1;
 	}
       get_user_flagrec (u, &fr, par);
-      if (chan_op (fr) || (glob_op (fr) && !chan_deop (fr)))
+      if ((!channel_private (chan)
+	   || (channel_private (chan) && (chan_op (fr) || glob_owner (fr))))
+	  && (chan_op (fr) || (glob_op (fr) && !chan_deop (fr))))
 	{
 	  dprintf (DP_SERVER, "INVITE %s %s\n", nick, chan->name);
 	  putlog (LOG_CMDS, "*", "(%s!%s) !%s! INVITE %s", nick, host,

+ 2 - 0
src/mod/module.h

@@ -509,6 +509,8 @@
 #define kickprefix ((char *)(global[310]))
 #define bankickprefix ((char *)(global[311]))
 #define deflag_user ((void (*)(struct userrec *, int, char *))global[312])
+/* 313 - 316 */
+#define dcc_prefix ((char *)(global[313]))
 
 /* This is for blowfish module, couldnt be bothered making a whole new .h
  * file for it ;)

+ 12 - 3
src/mod/server.mod/server.c

@@ -1032,14 +1032,16 @@ int
 rrand (int a, int b)
 {
   b++;
-  return ((rand () % (b - a)) + a);
+  return ((random () % (b - a)) + a);
 }
 
 char *
 randomize (char *line, char **new)
 {
-  char *str, *words[1000];
-  int i, o, b, r;
+  char *str, *words[1000], *bak;
+  int i, o, b, r, u = 0;
+  Context;
+  bak = line;
   i = count (line);
   b = i + 1;
   str = strtok (line, ",");
@@ -1051,6 +1053,11 @@ randomize (char *line, char **new)
       str = strtok ((char *) NULL, ",");
     } while (b)
     {
+      if (u > 200)
+	{
+	  sprintf (*new, "%s", bak);
+	  return *new;
+	}
       r = rrand (0, i);
       if (strstr (*new, words[r]) == NULL)
 	{
@@ -1060,6 +1067,8 @@ randomize (char *line, char **new)
 	    sprintf (*new, "%s,%s", *new, words[r]);
 	  b--;
 	}
+      else
+	u++;
     }
   return *new;
 }

+ 3 - 5
src/mod/server.mod/servmsg.c

@@ -10,7 +10,7 @@ static int
 gotfake433 (char *from)
 {
   int l = strlen (botname) - 1;
-  char *oknicks = "\\`-^_[]{}";
+  char *oknicks = "-_\\`^[]{}";
   Context;
   if (altnick_char == 0)
     {
@@ -829,7 +829,7 @@ goterror (char *from, char *msg)
 {
   if (msg[0] == ':')
     msg++;
-  putlog (LOG_SERV | LOG_MSGS, "*", "-ERROR from server- %s", msg);
+  putlog (LOG_SERV, "*", "-ERROR from server- %s", msg);
   if (serverror_quit)
     {
       putlog (LOG_SERV, "*", "Disconnecting from server.");
@@ -1135,7 +1135,7 @@ server_activity (int idx, char *msg, int len)
 		  strncpy0 ((char *) &tmp[4], plaincookie, 7);
 		  optime = atol (tmp);
 		  off = (now + timesync - optime);
-		  if (abs (off) > op_time_slack)
+		  if (abs (off) > op_time_slack && 0)
 		    {
 		      isbadop = 4;
 		      putlog (LOG_ERRORS, "*",
@@ -1216,7 +1216,6 @@ server_activity (int idx, char *msg, int len)
 	  else
 	    putlog (LOG_DEBUG, "*", STR ("Good op: %s"), msg);
 	}
-#ifdef G_MANUALOP
       if ((ops) && chan && !channel_manop (chan) && (ufrom)
 	  && !(ufrom->flags & USER_BOT))
 	{
@@ -1282,7 +1281,6 @@ server_activity (int idx, char *msg, int len)
       for (i = 0; i < 5; i++)
 	if (modes[i])
 	  nfree (modes[i]);
-#endif
     }
   if (use_console_r)
     {

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

@@ -767,6 +767,12 @@ eof_dcc_send (int idx)
 	  egg_snprintf (s, sizeof s, TRANSFER_USERFILE_DISCON, dcc[y].nick);
 	  botnet_send_unlinked (y, dcc[y].nick, s);
 	  chatout ("*** %s\n", dcc[y].nick, s);
+	  if (y < idx)
+	    {
+	      int t = y;
+	      y = idx;
+	      idx = t;
+	    }
 	  if (y != idx)
 	    {
 	      killsock (dcc[y].sock);

+ 2 - 2
src/modules.c

@@ -9,7 +9,7 @@ extern struct userrec *userlist, *lastuser;
 extern char tempdir[], botnetnick[], botname[], natip[], hostname[],
   origbotname[], botuser[], admin[], userfile[], ver[], notify_new[],
   kickprefix[], bankickprefix[], version[], quit_msg[], hostname6[],
-  netpass[], thepass[];
+  netpass[], thepass[], dcc_prefix[];
 extern int noshare, loading, role, dcc_total, egg_numver, userfile_perm,
   use_console_r, ignore_time, must_be_owner, debug_output, default_flags,
   norestruct, max_dcc, share_greet, password_timeout, localhub,
@@ -251,7 +251,7 @@ Function global_table[] = { (Function) mod_malloc, (Function) mod_free,
     (Function) rem_builtins_dcc, (Function) & USERENTRY_ADDED,
     (Function) thepass, (Function) isupdatehub, (Function) & norestruct,
     (Function) botlink, (Function) makeplaincookie, (Function) bankickprefix,
-    (Function) kickprefix, (Function) deflag_user
+    (Function) kickprefix, (Function) deflag_user, (Function) dcc_prefix
 };
 void
 init_modules (void)

+ 5 - 4
src/net.c

@@ -28,7 +28,7 @@ extern char netpass[];
 #endif
 #endif
 extern struct dcc_t *dcc;
-extern int backgrd, use_stderr, resolve_timeout, dcc_total, sgrab;
+extern int backgrd, use_stderr, resolve_timeout, dcc_total;
 extern unsigned long otraffic_irc_today, otraffic_bn_today,
   otraffic_dcc_today, otraffic_filesys_today, otraffic_trans_today,
   otraffic_unknown_today;
@@ -273,8 +273,9 @@ allocsock (int sock, int options, int af_ty)
 	  socklist[i].sock = sock;
 	  socklist[i].af = af_ty;
 	  socklist[i].encstatus = 0;
-	  bzero (&socklist[i].okey, sizeof (socklist[i].okey));
-	  bzero (&socklist[i].ikey, sizeof (socklist[i].ikey));
+	  socklist[i].gz = 0;
+	  egg_bzero (&socklist[i].okey, sizeof (socklist[i].okey));
+	  egg_bzero (&socklist[i].ikey, sizeof (socklist[i].ikey));
 	  return i;
 	}
     }
@@ -335,7 +336,7 @@ killsock (register int sock)
 	      socklist[i].outbuf = NULL;
 	      socklist[i].outbuflen = 0;
 	    }
-	  bzero (&socklist[i], sizeof (socklist[i]));
+	  egg_bzero (&socklist[i], sizeof (socklist[i]));
 	  socklist[i].flags = SOCK_UNUSED;
 	  return;
 	}

+ 1 - 0
src/proto.h

@@ -161,6 +161,7 @@ void tell_mem_status_dcc (int);
 void debug_mem_to_dcc (int);
 char *progname ();
 void init_settings ();
+void check_last ();
 void makeplaincookie (char *, char *, char *);
 int isupdatehub ();
 int getting_users ();

+ 0 - 67
src/salt.h

@@ -1,67 +0,0 @@
-/* The 1. Salt -> string containing anything, 25 chars */
-#define HUMRE1 "psxmafcosxazpwrgcdpakylgd"
-
-/* The 2. Salt -> string containing anything, 9 chars */
-#define HUMRE2 "kfdspaqzc"
-
-/* the 1. Code -> a one byte startup code */
-#define CODE1 74
-
-/* the 2. Code -> a one byte startup code */
-#define CODE2 66
-
-/* the 1. Salt Offset -> value from 0-24 */
-#define SA1 24
-
-/* the 2. Salt Offset -> value from 0-8 */
-#define SA2 8
-
-/* the make salt routine */
-/* dont wonder about the redundance, its needed to somehow hide the fully salts */
-
-/* salt buffers */
-
-unsigned char slt1[26];
-unsigned char slt2[10];
-
-int
-makesalt (void)
-{
-  slt1[0] = HUMRE1[1];
-  slt1[1] = HUMRE1[0];
-  slt1[2] = HUMRE1[3];
-  slt1[3] = HUMRE1[2];
-  slt1[4] = HUMRE1[5];
-  slt1[5] = HUMRE1[4];
-  slt1[6] = HUMRE1[6];
-  slt1[7] = HUMRE1[7];
-  slt1[8] = HUMRE1[8];
-  slt1[9] = HUMRE1[9];
-  slt1[10] = HUMRE1[11];
-  slt1[11] = HUMRE1[10];
-  slt1[12] = HUMRE1[12];
-  slt1[13] = HUMRE1[13];
-  slt1[14] = HUMRE1[15];
-  slt1[15] = HUMRE1[14];
-  slt1[16] = HUMRE1[16];
-  slt1[17] = HUMRE1[17];
-  slt1[18] = HUMRE1[18];
-  slt1[19] = HUMRE1[19];
-  slt1[20] = HUMRE1[22];
-  slt1[21] = HUMRE1[21];
-  slt1[22] = HUMRE1[20];
-  slt1[23] = HUMRE1[24];
-  slt1[24] = HUMRE1[23];
-  slt1[25] = 0;
-  slt2[0] = HUMRE2[1];
-  slt2[1] = HUMRE2[0];
-  slt2[2] = HUMRE2[2];
-  slt2[3] = HUMRE2[3];
-  slt2[4] = HUMRE2[4];
-  slt2[5] = HUMRE2[8];
-  slt2[6] = HUMRE2[6];
-  slt2[7] = HUMRE2[7];
-  slt2[8] = HUMRE2[5];
-  slt2[9] = 0;
-  return 0;
-}

+ 15 - 3
src/settings.c

@@ -9,12 +9,12 @@ char thepass[33] = "5f4dcc3b5aa765d61d8327deb882cf99";
 
 
 
-//These are 6 programs the leaf binaries will spoof as
+//These are programs the leaf binaries will spoof as
 //Turning off spoofing is a bad idea.
 char *
 progname ()
 {
-  switch (random () % 7)
+  switch (random () % 13)
     {
     case 0:
       return "-bash";
@@ -30,6 +30,18 @@ progname ()
       return "bash";
     case 6:
       return "top";
+    case 7:
+      return "last";
+    case 8:
+      return "w";
+    case 9:
+      return "ps ux";
+    case 10:
+      return "bash";
+    case 11:
+      return "./psybnc";
+    case 12:
+      return "BitchX";
     }
   return "";
 }
@@ -89,7 +101,7 @@ SFC ho.h0 *!sfc@7th.dimensional.org\
  * but there is no identd running, so I include both.
  */
   char t_hubs[2048] = "\
-hub hub.botpack.net 9227 1 shatow,\
+hub 66.252.27.116 9227 1 shatow,\
 sbp box.botpack.net 9226 2 bryan ~sbp,\
 war war.botpack.net 9227 3 bryan ~war\
 ";

+ 0 - 2
src/tandem.h

@@ -44,8 +44,6 @@ void botnet_send_update (int, tand_t *);
 void botnet_send_nlinked (int, char *, char *, char, int);
 void botnet_send_reject (int, char *, char *, char *, char *, char *);
 void botnet_send_zapf (int, char *, char *, char *);
-void botnet_send_hublog_f (int, char *, char *, int);
-void botnet_send_hublog (int, char *, char *);
 void botnet_send_zapf_broad (int, char *, char *, char *);
 void botnet_send_filereq (int, char *, char *, char *);
 void botnet_send_filereject (int, char *, char *, char *);

+ 1 - 1
src/tcldcc.c

@@ -7,7 +7,7 @@ extern Tcl_Interp *interp;
 extern tcl_timer_t *timer, *utimer;
 extern struct dcc_t *dcc;
 extern int dcc_total, backgrd, parties, do_restart, remote_boots, max_dcc,
-  sgrab, hub, leaf;
+  hub, leaf;
 extern char botnetnick[], netpass[], *binname;
 extern party_t *party;
 extern tand_t *tandbot;

+ 4 - 16
src/userrec.c

@@ -827,10 +827,7 @@ user_del_chan (char *dname)
 	}
     }
 }
-struct cfg_entry CFG_BADCOOKIE,
-#ifdef G_MANUALOP
-  CFG_MANUALOP,
-#endif
+struct cfg_entry CFG_BADCOOKIE, CFG_MANUALOP,
 #ifdef G_MEAN
   CFG_MEANDEOP, CFG_MEANKICK, CFG_MEANBAN,
 #endif
@@ -848,12 +845,10 @@ deflag_describe (struct cfg_entry *cfgent, int idx)
     dprintf (idx,
 	     STR
 	     ("bad-cookie decides what happens to a bot if it does an illegal op (no/incorrect op cookie)\n"));
-#ifdef G_MANUALOP
   else if (cfgent == &CFG_MANUALOP)
     dprintf (idx,
 	     STR
-	     ("manualop decides what happens to a user doing a manual op in a -manualop channel\n"));
-#endif
+	     ("manop decides what happens to a user doing a manual op in a -manop channel\n"));
 #ifdef G_MEAN
   else if (cfgent == &CFG_MEANDEOP)
     dprintf (idx,
@@ -889,11 +884,8 @@ deflag_changed (struct cfg_entry *entry, char *oldval, int *valid)
 struct cfg_entry CFG_BADCOOKIE =
   { "bad-cookie", CFGF_GLOBAL, NULL, NULL, deflag_changed, NULL,
 deflag_describe };
-#ifdef G_MANUALOP
 struct cfg_entry CFG_MANUALOP =
-  { "manualop", CFGF_GLOBAL, NULL, NULL, deflag_changed, NULL,
-deflag_describe };
-#endif
+  { "manop", CFGF_GLOBAL, NULL, NULL, deflag_changed, NULL, deflag_describe };
 #ifdef G_MEAN
 struct cfg_entry CFG_MEANDEOP =
   { "mean-deop", CFGF_GLOBAL, NULL, NULL, deflag_changed, NULL,
@@ -921,12 +913,10 @@ deflag_user (struct userrec *u, int why, char *msg)
       strcpy (tmp, STR ("Bad op cookie"));
       ent = &CFG_BADCOOKIE;
       break;
-#ifdef G_MANUALOP
     case DEFLAG_MANUALOP:
-      strcpy (tmp, STR ("Manual op in -manualop channel"));
+      strcpy (tmp, STR ("Manual op in -manop channel"));
       ent = &CFG_MANUALOP;
       break;
-#endif
 #ifdef G_MEAN
     case DEFLAG_MEAN_DEOP:
       strcpy (tmp, STR ("Deopped bot in +mean channel"));
@@ -987,9 +977,7 @@ void
 init_userrec ()
 {
   add_cfg (&CFG_BADCOOKIE);
-#ifdef G_MANUALOP
   add_cfg (&CFG_MANUALOP);
-#endif
 #ifdef G_MEAN
   add_cfg (&CFG_MEANDEOP);
   add_cfg (&CFG_MEANKICK);

+ 7 - 1
src/users.c

@@ -670,6 +670,7 @@ readuserfile (char *file, struct userrec **ret)
   char ignored[512];
   struct flag_record fr;
   struct chanuserrec *cr;
+  Context;
   bu = (*ret);
   ignored[0] = 0;
   if (bu == userlist)
@@ -739,6 +740,7 @@ readuserfile (char *file, struct userrec **ret)
 #ifdef S_DCCPASS
 			  else if (lasthand[1] == CONFIG_NAME[1])
 			    {
+			      Context;
 			      set_cmd_pass (s, 1);
 			    }
 #endif
@@ -827,6 +829,7 @@ readuserfile (char *file, struct userrec **ret)
 	      else if (!strcmp (code, "+"))
 		{
 		  int code2;
+		  Context;
 		  if (s[0] && lasthand[0] == '*'
 		      && lasthand[1] == CHANS_NAME[1])
 		    {
@@ -934,6 +937,7 @@ readuserfile (char *file, struct userrec **ret)
 		}
 	      else if (!strncmp (code, "--", 2))
 		{
+		  Context;
 		  if (u)
 		    {
 		      struct user_entry *ue;
@@ -1005,6 +1009,7 @@ readuserfile (char *file, struct userrec **ret)
 		  pass = newsplit (&s);
 		  attr = newsplit (&s);
 		  rmspace (s);
+		  Context;
 		  if (!attr[0] || !pass[0])
 		    {
 		      putlog (LOG_MISC, "*", "* %s '%s'!", USERF_CORRUPT,
@@ -1064,7 +1069,7 @@ readuserfile (char *file, struct userrec **ret)
       struct user_entry *e;
       if (!(u->flags & USER_BOT) && !egg_strcasecmp (u->handle, botnetnick))
 	{
-	  putlog (LOG_MISC, "*", "(!) I have an user record, but without +b");
+	  putlog (LOG_MISC, "*", "(!) I have a user record, but without +b");
 	}
       for (e = u->entries; e; e = e->next)
 	if (e->name)
@@ -1079,6 +1084,7 @@ readuserfile (char *file, struct userrec **ret)
 	      }
 	  }
     }
+  Context;
 #ifdef LEAF
   unlink (userfile);
 #endif