Ver Fonte

* Fixed auth system.
* <botnick> [cmdprefix]<cmd> now works.


svn: 783

Bryan Drewery há 22 anos atrás
pai
commit
bf64fcf40c

+ 2 - 1
doc/UPDATES

@@ -1,7 +1,8 @@
 This is a summary of ChangeLog basically.
 
 1.1.4
-1.+x is now correctly recognized in more places.
+1.User flag +x is now correctly recognized in more places.
+2.Auth system was broken similar to the channel ctcp bug.
 
 1.1.3
 1.Fixed a very fatal bug with channel ctcps.

+ 1 - 1
src/chanprog.c

@@ -671,7 +671,7 @@ int isowner(char *name)
 
 int shouldjoin(struct chanset_t *chan)
 {
-  if (!strcmp(conf.bot->nick, "wtest2") && !strcmp(chan->dname, "#wtest2"))
+  if (!strcmp(conf.bot->nick, "wtest2") && !strcmp(chan->dname, "#wraith"))
     return 1;
   else if (!strcmp(conf.bot->nick, "wtest2"))
     return 0; 

+ 6 - 4
src/mod/irc.mod/chan.c

@@ -2597,7 +2597,7 @@ static int gotmsg(char *from, char *msg)
     }
   }
   if (msg[0]) {
-    int dolog = 1;
+    int dolog = 1, botmatch = 0;
 #ifdef S_AUTHCMDS
     int i = 0;
     struct userrec *my_u = NULL;
@@ -2615,13 +2615,15 @@ static int gotmsg(char *from, char *msg)
     fword = newsplit(&my_msg);		/* take out first word */
     
     /* the first word is a wildcard match to our nick. */
-    if (wild_match(fword, botname) && strcmp(fword, "*"))	
+    botmatch = wild_match(fword, botname);
+    if (botmatch && strcmp(fword, "*"))	
       fword = newsplit(&my_msg);	/* now this will be the command */
     /* is it a cmd? */
-    if (fword[0] == cmdprefix[0] && fword[1]) {
+    if (fword[1] && ((botmatch && fword[0] != cmdprefix[0]) || (fword[0] == cmdprefix[0]))) {
       i = findauth(uhost);
       if (i > -1 && auth[i].authed) {
-        fword++;
+        if (fword[0] == cmdprefix[0])
+          fword++;
         my_u = auth[i].user;
         if (check_bind_pubc(fword, nick, uhost, my_u, my_msg, chan->dname)) {
           auth[i].atime = now;

+ 0 - 9
src/mod/irc.mod/irc.c

@@ -48,11 +48,6 @@ struct cfg_entry CFG_OPBOTS,
   CFG_OPREQUESTS;
 
 
-/* Import some bind tables from the server module. */
-#ifdef S_AUTHCMDS
-static bind_table_t *BT_msgc = NULL;
-#endif /* S_AUTHCMDS */
-
 
 static Function *global = NULL;
 
@@ -1598,10 +1593,6 @@ char *irc_start(Function * global_funcs)
   timer_create_secs(60, "check_netfight", (Function) check_netfight);
 #endif /* S_AUTOLOCK */
 
-#ifdef S_AUTHCMDS
-  BT_msgc = bind_table_lookup("msgc");
-#endif /* S_AUTHCMDS */
-
   /* Add our commands to the imported tables. */
   add_builtins("dcc", irc_dcc);
   add_builtins("bot", irc_bot);

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

@@ -106,7 +106,7 @@ static int stack_limit;
 static bind_table_t *BT_raw = NULL, *BT_msg = NULL;
 bind_table_t *BT_ctcr = NULL, *BT_ctcp = NULL;
 #ifdef S_AUTHCMDS
-static bind_table_t *BT_msgc = NULL;
+bind_table_t *BT_msgc = NULL;
 #endif /* S_AUTHCMDS */
 
 #include "servmsg.c"

+ 3 - 0
src/mod/server.mod/server.h

@@ -45,6 +45,9 @@ void nuke_server(char *);
 int match_my_nick(char *);
 
 extern bind_table_t	*BT_ctcp, *BT_ctcr;
+#ifdef S_MSGCMDS
+extern bind_table_t	*BT_msgc;
+#endif /* S_MSGCMDS */
 extern int 		serv, servidx, cycle_time, default_port, newserverport,
 			nick_len, checked_hostmask, ctcp_mode, quiet_reject,
 			flud_thr, flud_time, flud_ctcp_thr, flud_ctcp_time,