]> jfr.im git - irc/quakenet/newserv.git/blobdiff - fsck/fsck.c
CHANSERV: tell user when they can't attempts to auth any more, and drop max attempts...
[irc/quakenet/newserv.git] / fsck / fsck.c
index 1f5bda035f42e8434b4ec75aefa48aba88e6bc4a..536fed2247e4cbfe2d6bd8f0798a3d4ee148eb32 100644 (file)
@@ -4,6 +4,9 @@
 #include "../nick/nick.h"
 #include "../channel/channel.h"
 #include "../server/server.h"
+#include "../lib/version.h"
+
+MODULE_VERSION("")
 
 int dofsck(void *source, int cargc, char **cargv);
 
@@ -22,6 +25,7 @@ int dofsck(void *source, int cargc, char **cargv) {
   realname *rnp;
   unsigned int nickmarker;
   int errors=0;
+  unsigned int nummask,mnum;
 
   /* Start off with strict nick consistency checks.. */
 
@@ -41,6 +45,11 @@ int dofsck(void *source, int cargc, char **cargv) {
   
   for (i=0;i<NICKHASHSIZE;i++) {
     for(np=nicktable[i];np;np=np->next) {
+      if (np->marker==nickmarker) {
+        controlreply(sender, "ERROR: bumped into the same nick %s/%s twice in hash table.",longtonumeric(np->numeric,5),np->nick);
+        errors++;
+      }
+      
       /* Mark this nick so we can check we found them all */
       np->marker=nickmarker;
 
@@ -129,13 +138,20 @@ int dofsck(void *source, int cargc, char **cargv) {
       
   for(i=0;i<MAXSERVERS;i++) {
     if (serverlist[i].linkstate != LS_INVALID) {
+      nummask=((MAXSERVERS-1)<<18) | serverlist[i].maxusernum;
       for (j=0;j<=serverlist[i].maxusernum;j++) {
        if ((np=servernicks[i][j])) {
+         mnum=(i<<18) | j;
+         if ((np->numeric & nummask) != mnum) {
+           controlreply(sender, "ERROR: nick %s/%s has wrong masked numeric.",longtonumeric(np->numeric,5),np->nick);
+           errors++;
+          }
          if (np->marker != nickmarker) {
            controlreply(sender, "ERROR: nick %s/%s in server user table but not hash!",
                         longtonumeric(np->numeric,5),np->nick);
            errors++;
          }
+         np->marker=0;
        }
       }
     }