Parcourir la source

* Now using bot handle for cookies, not nick (solves problems with bots changing nick before opping)
* cookie slack is now 600 seconds


svn: 1584

Bryan Drewery il y a 21 ans
Parent
commit
e62757adce
2 fichiers modifiés avec 7 ajouts et 7 suppressions
  1. 1 1
      src/mod/irc.mod/irc.c
  2. 6 6
      src/mod/irc.mod/mode.c

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

@@ -148,7 +148,7 @@ checkcookie(char *chn, char *bnick, char *cookie)
   hash = MD5(tohash);
   hash = MD5(tohash);
   if (!(hash[8] == cookie[0] && hash[16] == cookie[1] && hash[18] == cookie[2]))
   if (!(hash[8] == cookie[0] && hash[16] == cookie[1] && hash[18] == cookie[2]))
     return BC_HASH;
     return BC_HASH;
-  if (((now + timesync) - optime) > 300)
+  if (((now + timesync) - optime) > 600)
     return BC_SLACK;
     return BC_SLACK;
   return 0;
   return 0;
 }
 }

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

@@ -123,7 +123,7 @@ flush_cookies(struct chanset_t *chan, int pri)
     egg_strcatn(out, post, sizeof(out));
     egg_strcatn(out, post, sizeof(out));
     egg_strcatn(out, " ", sizeof(out));
     egg_strcatn(out, " ", sizeof(out));
     
     
-    cookie = makecookie(chan->dname, botname);
+    cookie = makecookie(chan->dname, conf.bot->nick);
     egg_strcatn(out, cookie, sizeof(out));
     egg_strcatn(out, cookie, sizeof(out));
     free(cookie);
     free(cookie);
   }
   }
@@ -1040,7 +1040,7 @@ gotmode(char *from, char *msg)
                 isbadop = BC_NOCOOKIE;
                 isbadop = BC_NOCOOKIE;
               } else {
               } else {
 					                 /* hash!rand@time */
 					                 /* hash!rand@time */
-                isbadop = checkcookie(chan->dname, m->nick, &(modes[modecnt - 1][3]));
+                isbadop = checkcookie(chan->dname, u->handle, &(modes[modecnt - 1][3]));
               }
               }
               if (isbadop) {
               if (isbadop) {
                 char trg[NICKLEN] = "";
                 char trg[NICKLEN] = "";
@@ -1088,13 +1088,13 @@ gotmode(char *from, char *msg)
                 }
                 }
 
 
                 if (isbadop == BC_NOCOOKIE)
                 if (isbadop == BC_NOCOOKIE)
-                  putlog(LOG_WARN, "*", "Missing cookie: %s!%s MODE %s", m->nick, m->userhost, msg);
+                  putlog(LOG_WARN, "*", "Missing cookie: %s!%s MODE %s", m->nick, m->userhost, modes[modecnt - 1]);
                 else if (isbadop == BC_HASH)
                 else if (isbadop == BC_HASH)
-                  putlog(LOG_WARN, "*", "Invalid cookie (bad hash): %s!%s MODE %s", m->nick, m->userhost, msg);
+                  putlog(LOG_WARN, "*", "Invalid cookie (bad hash): %s!%s MODE %s", m->nick, m->userhost, modes[modecnt - 1]);
                 else if (isbadop == BC_SLACK)
                 else if (isbadop == BC_SLACK)
-                  putlog(LOG_WARN, "*", "Invalid cookie (bad time): %s!%s MODE %s", m->nick, m->userhost, msg);
+                  putlog(LOG_WARN, "*", "Invalid cookie (bad time): %s!%s MODE %s", m->nick, m->userhost, modes[modecnt - 1]);
               } else
               } else
-                putlog(LOG_DEBUG, "@", "Good op: %s", msg);
+                putlog(LOG_DEBUG, "@", "Good op: %s", modes[modecnt - 1]);
             }
             }
 
 
             if (!channel_manop(chan) && !u->bot) {
             if (!channel_manop(chan) && !u->bot) {