diff -urNd operstats-0.1.6/dist/operstats.conf operstats-0.2.0/dist/operstats.conf --- operstats-0.1.6/dist/operstats.conf Tue May 8 18:25:28 2001 +++ operstats-0.2.0/dist/operstats.conf Wed May 23 05:06:19 2001 @@ -15,7 +15,7 @@ # Format: Info operstats.server.name Server Description # This is required. -Info operstats.example.net OperStats v0.1.6 +Info operstats.example.net OperStats v0.2.0 # Connection Information: Where should we connect to? # Note: The 'name.of.uplink' is important for sanity checks in JUPE. @@ -93,6 +93,14 @@ SyncTime 20m +# Do you want to log the DataBase Syncs? Normally you won't need this; +# it'll just cause excessive logging. If you think some of your DB entries +# might be causing crashes, turn this on to see if it crashes during an +# update. +# Comment to disable. + +#LogUpdates + # How often should we PING the servers on the network to # keep an up to date lag count? Note that under most circumstances, # the servers on your network will be PINGed virtually at the same time, @@ -126,9 +134,9 @@ #SnoopChan #Snoop -# Should the pseudo clients join a channel? This could be the same as your Snoop -# channel, or something different. They'll join this channel and op themselves.. -# Nothing more. +# Should the pseudo clients join a channel? This could be the same as your +# Snoop channel, or something different. They'll join this channel and op +# themselves, nothing more. # Comment to disable. #JoinChan #Services @@ -162,7 +170,7 @@ LearnAKills -# Do you want OperStats to forget AKills placed from other services? +# Do you want OperStats to forget AKills removed from other services? # Comment to disable. ForgetAKills @@ -173,9 +181,10 @@ # this was 5, each user would be allowed 5 connections. If a 6th connected, # it would be killed. If this is not set, there will be no clone detection. # -# IMPORTANT: If you turn this on, make sure you set a Trigger for your -# Services and any other hostnames that exceed this number! Otherwise -# OperStats will kill those hosts upon linking. You've been warned. +# IMPORTANT: If you turn this on, make sure you set a Trigger or an +# Exception for your Services and any other hostnames that exceed this +# number! Otherwise OperStats will kill those hosts upon linking. You've +# been warned. # # Comment to disable. @@ -213,14 +222,6 @@ # Comment to disable. StampLogons - -# Do you want to log the DataBase Syncs? Normally you won't need this; -# it'll just cause excessive logging. If you think some of your DB entries -# might be causing crashes, turn this on to see if it crashes during an -# update. -# Comment to disable. - -LogUpdates # Do you want OperStats to generate an HTML list of channels? A script # included in misc/ can cp this file to another directory for you (See diff -urNd operstats-0.1.6/doc/CHANGES operstats-0.2.0/doc/CHANGES --- operstats-0.1.6/doc/CHANGES Mon May 21 20:24:42 2001 +++ operstats-0.2.0/doc/CHANGES Sat May 26 03:47:27 2001 @@ -1,3 +1,17 @@ +OperStats -- v0.2.0 - skold +----- + +* TLD and TimeZone files are now loaded, thus enabling related features. +* Fixed OS CLONES output. +* Fixed INJECT executing the injected command twice. +* user@* akills no longer become *@* (eep!) - Reported by IpAddress +* Updated makeconf to actually make valid confs.. +* Fixed several problems with the SETTINGS command. +* Removed 'is now SRA' globop. +* The GlobalNoticer now replies to PING and VERSION CTCPs. +* Fixed a number of options not being rehashed properly. +* All data files are now written with proper file permissions. (600) + OperStats -- v0.1.6 - skold ----- diff -urNd operstats-0.1.6/doc/UPGRADING operstats-0.2.0/doc/UPGRADING --- operstats-0.1.6/doc/UPGRADING Tue May 8 18:34:33 2001 +++ operstats-0.2.0/doc/UPGRADING Wed Dec 31 16:00:00 1969 @@ -1,20 +0,0 @@ - -OperStats Upgrade notes ------ - -If you are upgrading from a version of OperStats before 0.1.5, there are -several things to consider: - -* You will need to remove your statserv.db. The format of this DB has - changed since previous versions. - -If you are upgrading from OperStats 0.1.5, you will need to make some -changes to your conf file: - -* The OperServ and StatServ directives have been changed to OperatorService - and StatisticalService. Hence, your lines should now read like this: - - OperatorService OperServ service example.net +io IRC Operator Service - StatisticalService StatServ service example.net +i Statistical Service - ------ diff -urNd operstats-0.1.6/inc/extern.h operstats-0.2.0/inc/extern.h --- operstats-0.1.6/inc/extern.h Tue May 15 07:23:01 2001 +++ operstats-0.2.0/inc/extern.h Tue May 22 19:53:00 2001 @@ -157,6 +157,7 @@ E MSG *msglist; E Trigger *triggerlist; E Exception *exceptionlist; +E void globalnoticer (const char *source, char *buf); E void operserv (const char *source, char *buf); E int check_akill (const char *nick, const char *user, const char *host, const char *real); E void load_os_dbase (void); diff -urNd operstats-0.1.6/inc/operstats.h operstats-0.2.0/inc/operstats.h --- operstats-0.1.6/inc/operstats.h Mon May 14 08:21:50 2001 +++ operstats-0.2.0/inc/operstats.h Sat May 26 03:41:40 2001 @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include diff -urNd operstats-0.1.6/inc/response.h operstats-0.2.0/inc/response.h --- operstats-0.1.6/inc/response.h Mon May 14 09:57:15 2001 +++ operstats-0.2.0/inc/response.h Tue May 22 19:48:01 2001 @@ -144,7 +144,6 @@ /* Shared replies */ #define SH_NOW_SRA "You are now recognized as an SRA." -#define SH_NOW_SRA_GLOBOP "SRA -- %s!%s@%s is now SRA." #define SH_NO_LONGER_SRA "You are no longer an SRA." #define SH_FAILED_AUTH "Failed AUTH attempt by %s!%s@%s" #define SH_SHUTTING_DOWN "OperStats terminating by request of %s: %s" @@ -173,6 +172,7 @@ #define SH_SETTINGS_STAMPLOGON "LogonMSG Date-Stamping : %s" #define SH_SETTINGS_LAGGLOBAL "GlobOp on Lag : %s" #define SH_SETTINGS_LAGTHRESH "Lag Threshold : %s" +#define SH_SETTINGS_DETECTION "Clone Detection : %s" #define SH_SETTINGS_CLONES "Max connections per user : %d" #define SH_SETTINGS_CLONEKILLS "Max clone kills per host : %d" #define SH_SETTINGS_RESTART "WaitRestart Delay : %s" diff -urNd operstats-0.1.6/misc/makeconf operstats-0.2.0/misc/makeconf --- operstats-0.1.6/misc/makeconf Tue May 8 18:27:52 2001 +++ operstats-0.2.0/misc/makeconf Wed May 23 05:06:37 2001 @@ -175,7 +175,8 @@ echo " " echo "Please give the nickname for one SRA. If you want to define more," -echo "edit operstats.conf after you are done makeconf." +echo "edit operstats.conf after you are done makeconf. You must define" +echo "at least one SRA." echo2 "[$SRANICK] " read cc if [ ! -z "$cc" ]; then @@ -210,7 +211,7 @@ # Format: Info operstats.server.name Server Description # This is required. -Info $INFONAME OperStats v0.1.6 +Info $INFONAME OperStats v0.2.0 # Connection Information: Where should we connect to? # Note: The 'name.of.uplink' is important for sanity checks in JUPE. @@ -252,24 +253,24 @@ SRA $SRANICK $SRAPASS # OperServ Information - IRC Operator Service -# Format: OperServ NickName UserName HostName Modes RealName +# Format: OperatorService NickName UserName HostName Modes RealName # Mode suggestions: # UnrealIRCd: +ioS # IRCu : +iok # Other : +io # Comment to disable. -OperServ OperServ service $DOMAIN +io IRC Operator Service +OperatorService OperServ service $DOMAIN +io IRC Operator Service # StatServ Information - Statistical Service -# Format: StatServ NickName UserName HostName Modes RealName +# Format: StatisticalService NickName UserName HostName Modes RealName # Mode suggestions: # UnrealIRCd: +iS # IRCu : +ik # Other : +i # Comment to disable. -StatServ StatServ service $DOMAIN +i Statistical Service +StatisticalService StatServ service $DOMAIN +i Statistical Service # GlobalNoticer Information - Global Noticer # Needed by: OS:LOGONMSG, OS:GLOBAL @@ -300,6 +301,14 @@ SyncTime 20m +# Do you want to log the DataBase Syncs? Normally you won't need this; +# it'll just cause excessive logging. If you think some of your DB entries +# might be causing crashes, turn this on to see if it crashes during an +# update. +# Comment to disable. + +#LogUpdates + # How often should we PING the servers on the network to # keep an up to date lag count? Note that under most circumstances, # the servers on your network will be PINGed virtually at the same time, @@ -333,9 +342,9 @@ #SnoopChan #Snoop -# Should the pseudo clients join a channel? This could be the same as your Snoop -# channel, or something different. They'll join this channel and op themselves.. -# Nothing more. +# Should the pseudo clients join a channel? This could be the same as your +# Snoop channel, or something different. They'll join this channel and op +# themselves, nothing more. # Comment to disable. #JoinChan #Services @@ -369,7 +378,7 @@ LearnAKills -# Do you want OperStats to forget AKills placed from other services? +# Do you want OperStats to forget AKills removed from other services? # Comment to disable. ForgetAKills @@ -380,9 +389,10 @@ # this was 5, each user would be allowed 5 connections. If a 6th connected, # it would be killed. If this is not set, there will be no clone detection. # -# IMPORTANT: If you turn this on, make sure you set a Trigger for your -# Services and any other hostnames that exceed this number! Otherwise -# OperStats will kill those hosts upon linking. You've been warned. +# IMPORTANT: If you turn this on, make sure you set a Trigger or an +# Exception for your Services and any other hostnames that exceed this +# number! Otherwise OperStats will kill those hosts upon linking. You've +# been warned. # # Comment to disable. @@ -420,14 +430,6 @@ # Comment to disable. StampLogons - -# Do you want to log the DataBase Syncs? Normally you won't need this; -# it'll just cause excessive logging. If you think some of your DB entries -# might be causing crashes, turn this on to see if it crashes during an -# update. -# Comment to disable. - -LogUpdates # Do you want OperStats to generate an HTML list of channels? A script # included in misc/ can cp this file to another directory for you (See diff -urNd operstats-0.1.6/src/Makefile operstats-0.2.0/src/Makefile --- operstats-0.1.6/src/Makefile Tue May 15 08:19:44 2001 +++ operstats-0.2.0/src/Makefile Tue May 22 00:48:52 2001 @@ -2,7 +2,7 @@ include ../Makefile.inc -VERSION=0.1.6 +VERSION=0.2.0 OBJS=main.o shared.o operserv.o statserv.o process.o socket.o function.o \ server.o conf.o diff -urNd operstats-0.1.6/src/conf.c operstats-0.2.0/src/conf.c --- operstats-0.1.6/src/conf.c Tue May 15 08:02:38 2001 +++ operstats-0.2.0/src/conf.c Tue May 22 19:39:58 2001 @@ -157,7 +157,7 @@ if (s) memcpy (s_OperServ, s, sizeof (s_OperServ)); else - fatal ("Config: OperServ is not set properly: No nickname."); + fatal ("Config: OperatorService is not set properly: No nickname."); s = strtok (NULL, " "); strip (s); @@ -165,7 +165,7 @@ if (s) memcpy (os.user, s, sizeof (os.user)); else - fatal ("Config: OperServ is not set properly: No username."); + fatal ("Config: OperatorService is not set properly: No username."); s = strtok (NULL, " "); strip (s); @@ -173,7 +173,7 @@ if (s) memcpy (os.host, s, sizeof (os.host)); else - fatal ("Config: OperServ is not set properly: No hostname."); + fatal ("Config: OperatorService is not set properly: No hostname."); s = strtok (NULL, " "); strip (s); @@ -181,12 +181,12 @@ if (s) { if (!strchr (s, '+')) - fatal ("Config: OperServ: You need a + for modes!"); + fatal ("Config: OperatorService: You need a + for modes!"); memcpy (os.mode, s, sizeof (os.mode)); } else - fatal ("Config: OperServ is not set properly: No modes."); + fatal ("Config: OperatorService is not set properly: No modes."); s = strtok (NULL, ""); strip (s); @@ -194,7 +194,7 @@ if (s) memcpy (os.real, s, sizeof (os.real)); else - fatal ("Config: OperServ is not set properly: No realname."); + fatal ("Config: OperatorService is not set properly: No realname."); if (!(runflags & RUN_STARTING)) { @@ -242,7 +242,7 @@ if (s) memcpy (s_StatServ, s, sizeof (s_StatServ)); else - fatal ("Config: StatServ is not set properly: No nickname."); + fatal ("Config: StatisticalService is not set properly: No nickname."); s = strtok (NULL, " "); strip (s); @@ -250,7 +250,7 @@ if (s) memcpy (ss.user, s, sizeof (ss.user)); else - fatal ("Config: StatServ is not set properly: No username."); + fatal ("Config: StatisticalService is not set properly: No username."); s = strtok (NULL, " "); strip (s); @@ -258,7 +258,7 @@ if (s) memcpy (ss.host, s, sizeof (ss.host)); else - fatal ("Config: StatServ is not set properly: No hostname."); + fatal ("Config: StatisticalService is not set properly: No hostname."); s = strtok (NULL, " "); strip (s); @@ -266,12 +266,12 @@ if (s) { if (!strchr (s, '+')) - fatal ("Config: StatServ: You need a + for modes!"); + fatal ("Config: StatisticalService: You need a + for modes!"); memcpy (ss.mode, s, sizeof (ss.mode)); } else - fatal ("Config: StatServ is not set properly: No modes."); + fatal ("Config: StatisticalService is not set properly: No modes."); s = strtok (NULL, ""); strip (s); @@ -279,7 +279,7 @@ if (s) memcpy (ss.real, s, sizeof (ss.real)); else - fatal ("Config: StatServ is not set properly: No realname."); + fatal ("Config: StatisticalService is not set properly: No realname."); if (!(runflags & RUN_STARTING)) { @@ -655,7 +655,7 @@ fatal ("Config: You must have at least one SRA."); if (operserv_on == FALSE && statserv_on == FALSE) - fatal ("Config: OperServ and Statserv cannot both be disabled."); + fatal ("Config: OperatorService and StatisticalService cannot both be disabled."); if (operserv_on == FALSE) { diff -urNd operstats-0.1.6/src/main.c operstats-0.2.0/src/main.c --- operstats-0.1.6/src/main.c Thu May 17 15:38:14 2001 +++ operstats-0.2.0/src/main.c Sat May 26 03:36:49 2001 @@ -144,6 +144,10 @@ return 20; } +#if HAVE_UMASK + umask (077); +#endif + /* Parse our command line options */ for (i = 1; i < ac; ++i) { @@ -258,8 +262,8 @@ if (statserv_on == TRUE) { load_ss_dbase (); -/* load_tlds (); - load_zones (); */ + load_tlds (); + load_zones (); } /* Count our stuff */ diff -urNd operstats-0.1.6/src/operserv.c operstats-0.2.0/src/operserv.c --- operstats-0.1.6/src/operserv.c Tue May 15 08:12:20 2001 +++ operstats-0.2.0/src/operserv.c Wed May 23 05:12:56 2001 @@ -188,6 +188,27 @@ return NULL; } +/* Global Noticer routine. This is simply to reply to CTCPs. */ +void globalnoticer (const char *source, char *buf) +{ + char *cmd, *s; + + cmd = strtok (buf, " "); + + if (!cmd) + return; + + if (!stricmp (cmd, "\1PING")) + { + if (!(s = strtok (NULL, ""))) + s = "0"; + strip (s); + ctcpreply (s_GlobalNoticer, source, "PING %s", s); + } + else if (!stricmp (cmd, "\1VERSION\1")) + ctcpreply (s_GlobalNoticer, source, "VERSION OperStats v%s", version); +} + /* Main OperServ routine. */ void operserv (const char *source, char *buf) { @@ -659,14 +680,14 @@ #ifdef IRCUP9 /* We use 999999999 because we'll expire it ourselves. */ - send_cmd (me.name, "GLINE * +*@%s 999999999 :%s", - hostname, akill->reason); + send_cmd (me.name, "GLINE * +%s@%s 999999999 :%s", + username, hostname, akill->reason); #elif defined (BAHAMUT) - send_cmd (me.name, "AKILL %s * 0 %s %ld :%s", hostname, - s_OperServ, time (NULL), akill->reason); + send_cmd (me.name, "AKILL %s %s 0 %s %ld :%s", hostname, + username, s_OperServ, time (NULL), akill->reason); #else - send_cmd (me.name, "%s %s * :%s", me.token ? "V" : "AKILL", - hostname, akill->reason); + send_cmd (me.name, "%s %s %s :%s", me.token ? "V" : "AKILL", + hostname, username, akill->reason); #endif free (username); } @@ -687,7 +708,7 @@ u->host, akill->reason); #elif defined (BAHAMUT) send_cmd (me.name, "AKILL %s * 0 %s %ld :%s", u->host, - s_OperServ, time (NULL), akill->reason); + u->user, s_OperServ, time (NULL), akill->reason); #else send_cmd (me.name, "%s %s * :%s", me.token ? "V" : "AKILL", u->host, akill->reason); @@ -1126,7 +1147,7 @@ User *user; char *param = strtok (NULL, " "); char *limit = strtok (NULL, " "); - int i, j, max = 250, shown = 0; + int i, j, max = 250, shown = 0, count = 0; if (!param) { @@ -1158,10 +1179,18 @@ if (clone->cnt < 2) continue; + if (count >= max) + break; + + ++count; + for (j = 0; j < 1024; j++) { for (user = userlist[j]; user; user = user->next) { + if (stricmp (clone->host, user->host)) + continue; + /* Very few hosts will go over this.. */ notice (s_OperServ, source, "%s%-44s %s%s%s%s%s", shost ? "" : "\2", shost ? "" : clone->host, diff -urNd operstats-0.1.6/src/process.c operstats-0.2.0/src/process.c --- operstats-0.1.6/src/process.c Thu May 17 16:12:59 2001 +++ operstats-0.2.0/src/process.c Tue May 22 19:52:43 2001 @@ -1009,7 +1009,7 @@ { globops (operserv_on == TRUE ? s_OperServ : s_StatServ, "Sync'd to network in %s: %d users, %d channels, %d servers.", - duration (time (NULL) - burststart), userstat, countchans (0), + duration (time (NULL) - burststart), userstat, chanstat, servstat); } #endif @@ -1033,6 +1033,13 @@ if (!stricmp (av[0], s_StatServ) || !stricmp (av[0], buf)) { statserv (source, av[1]); + return; + } + + snprintf (buf, sizeof (buf), "%s@%s", s_GlobalNoticer, me.name); + if (!stricmp (av[0], s_GlobalNoticer) || !stricmp (av[0], buf)) + { + globalnoticer (source, av[1]); return; } } diff -urNd operstats-0.1.6/src/shared.c operstats-0.2.0/src/shared.c --- operstats-0.1.6/src/shared.c Thu May 17 16:13:19 2001 +++ operstats-0.2.0/src/shared.c Wed May 23 07:52:31 2001 @@ -54,7 +54,6 @@ else { u->flags |= UF_SRA; - globops (whoami, SH_NOW_SRA_GLOBOP, source, u->user, u->host); notice (whoami, source, SH_NOW_SRA); #ifdef UNREAL3 send_cmd (whoami, "%s %s :is a Services Root Admin", me.token ? "BA" : @@ -101,7 +100,6 @@ void do_inject (const char *whoami, const char *source) { char *text = strtok (NULL, ""); - char *origbuf = inbuf; if (!text) { @@ -112,12 +110,6 @@ { strscpy (inbuf, text, BUFSIZE); process(); - if (origbuf) - { - /* Something was in the buffer before, process it now. */ - strscpy (inbuf, origbuf, BUFSIZE); - process(); - } } } #endif /* RAWINJECT */ @@ -270,14 +262,15 @@ notice (whoami, source, SH_SETTINGS_UNREAL, unreal_numeric); #endif notice (whoami, source, SH_SETTINGS_SYNC, duration (update_timeout)); - if (statserv_on == TRUE) - notice (whoami, source, SH_SETTINGS_PING, duration (ping_delay)); if (strlen (snoopchan)) notice (whoami, source, SH_SETTINGS_SNOOPCHAN, snoopchan); if (strlen (joinchan)) notice (whoami, source, SH_SETTINGS_JOINCHAN, joinchan); - if (globalnoticer_on == TRUE) - notice (whoami, source, SH_SETTINGS_TLDS, tlds); + notice (whoami, source, SH_SETTINGS_RESTART, duration (wait_restart)); + notice (whoami, source, SH_SETTINGS_DEBUG, debuglevel, + debuglevel ? "" : " (Off)"); + notice (whoami, source, SH_SETTINGS_LOGUPDATES, + logupdates_on == TRUE ? "On" : "Off"); if (operserv_on == TRUE) { notice (whoami, source, SH_SETTINGS_AKILL, duration (def_akill_time)); @@ -289,28 +282,34 @@ notice (whoami, source, SH_SETTINGS_AKILLFORGET, forgetakills_on == TRUE ? "On" : "Off"); notice (whoami, source, SH_SETTINGS_NONWILD, nonwildreq); + notice (whoami, source, SH_SETTINGS_DETECTION, maxclones ? "On" : + "Off"); + if (maxclones) + { + notice (whoami, source, SH_SETTINGS_CLONES, maxclones); + notice (whoami, source, SH_SETTINGS_CLONEKILLS, maxclonekills); + } + if (globalnoticer_on == TRUE) + { + notice (whoami, source, SH_SETTINGS_TLDS, tlds); + notice (whoami, source, SH_SETTINGS_STAMPLOGON, + stamplogons_on == TRUE ? "On" : "Off"); + } } if (statserv_on == TRUE) { + notice (whoami, source, SH_SETTINGS_PING, duration (ping_delay)); notice (whoami, source, SH_SETTINGS_DUMPCHANS, dumpchans_on == TRUE ? "On" : "Off"); notice (whoami, source, SH_SETTINGS_JAVACLIENT, javaclient_on == TRUE ? "On" : "Off"); notice (whoami, source, SH_SETTINGS_DUMPSTATS, dumpstats_on == TRUE ? "On" : "Off"); + notice (whoami, source, SH_SETTINGS_LAGGLOBAL, + globalonlag_on == TRUE ? "On" : "Off"); + notice (whoami, source, SH_SETTINGS_LAGTHRESH, + duration (lagthreshold)); } - notice (whoami, source, SH_SETTINGS_LOGUPDATES, - logupdates_on == TRUE ? "On" : "Off"); - notice (whoami, source, SH_SETTINGS_STAMPLOGON, - logupdates_on == TRUE ? "On" : "Off"); - notice (whoami, source, SH_SETTINGS_LAGGLOBAL, - globalonlag_on == TRUE ? "On" : "Off"); - notice (whoami, source, SH_SETTINGS_LAGTHRESH, duration (lagthreshold)); - notice (whoami, source, SH_SETTINGS_CLONES, maxclones); - notice (whoami, source, SH_SETTINGS_CLONEKILLS, maxclonekills); - notice (whoami, source, SH_SETTINGS_RESTART, duration (wait_restart)); - notice (whoami, source, SH_SETTINGS_DEBUG, debuglevel, - debuglevel ? "" : " (Off)"); notice (whoami, source, " "); notice (whoami, source, SH_SETTINGS_END); } @@ -339,6 +338,15 @@ globalonakill_on = FALSE; stamplogons_on = FALSE; logupdates_on = FALSE; + dumpchans_on = FALSE; + javaclient_on = FALSE; + dumpstats_on = FALSE; + learnakills_on = FALSE; + dumptlds_on = FALSE; + forgetakills_on = FALSE; + globalonlag_on = FALSE; + maxclones = 0; + maxclonekills = 0; /* Flush TLDs, SRAs, and TimeZones (some might be removed) */ flushlists ();