1
0
Эх сурвалжийг харах

* Fixed some botnet userfile sharing logs showing up on leaf bots.

svn: 1783
Bryan Drewery 21 жил өмнө
parent
commit
edd7e1a347

+ 1 - 0
doc/UPDATES

@@ -17,6 +17,7 @@ Lines prefixxed with '-' were disabled before release and are not finishsed.
 * cmd_cmdpass was not clear on usage.
 * cmd_cmdpass was not clear on usage.
 * Using a cmd with a cmdpass without proper flags now acts as if cmd is not valid (no longer spams wrong pass error)
 * Using a cmd with a cmdpass without proper flags now acts as if cmd is not valid (no longer spams wrong pass error)
 * cmd_deluser change: only allow a |m user to remove users whom they have added.
 * cmd_deluser change: only allow a |m user to remove users whom they have added.
+* Fixed some botnet userfile sharing logs showing up on leaf bots.
 
 
 1.2.2
 1.2.2
 * Don't sanity check flags for users on DCC CHAT if they are on the bot via .botcmd.
 * Don't sanity check flags for users on DCC CHAT if they are on the bot via .botcmd.

+ 60 - 7
src/mod/share.mod/share.c

@@ -133,7 +133,9 @@ share_stick_ban(int idx, char *par)
       struct chanset_t *chan = NULL;
       struct chanset_t *chan = NULL;
 #endif /* LEAF */
 #endif /* LEAF */
       if (u_setsticky_ban(NULL, host, yn) > 0) {
       if (u_setsticky_ban(NULL, host, yn) > 0) {
+#ifdef HUB
         putlog(LOG_CMDS, "@", "%s: %s %s", dcc[idx].nick, (yn) ? "stick" : "unstick", host);
         putlog(LOG_CMDS, "@", "%s: %s %s", dcc[idx].nick, (yn) ? "stick" : "unstick", host);
+#endif /* HUB */
         shareout_but(idx, "s %s %d\n", host, yn);
         shareout_but(idx, "s %s %d\n", host, yn);
       }
       }
 #ifdef LEAF
 #ifdef LEAF
@@ -146,7 +148,9 @@ share_stick_ban(int idx, char *par)
 
 
       if ((chan != NULL) && (cr = get_chanrec(dcc[idx].user, par)))
       if ((chan != NULL) && (cr = get_chanrec(dcc[idx].user, par)))
         if (u_setsticky_ban(chan, host, yn) > 0) {
         if (u_setsticky_ban(chan, host, yn) > 0) {
+#ifdef HUB
           putlog(LOG_CMDS, "@", "%s: %s %s %s", dcc[idx].nick, (yn) ? "stick" : "unstick", host, par);
           putlog(LOG_CMDS, "@", "%s: %s %s %s", dcc[idx].nick, (yn) ? "stick" : "unstick", host, par);
+#endif /* HUB */
           shareout_but(idx, "s %s %d %s\n", host, yn, chan->dname);
           shareout_but(idx, "s %s %d %s\n", host, yn, chan->dname);
           noshare = 0;
           noshare = 0;
           return;
           return;
@@ -176,7 +180,9 @@ share_stick_exempt(int idx, char *par)
     noshare = 1;
     noshare = 1;
     if (!par[0]) {              /* Global exempt */
     if (!par[0]) {              /* Global exempt */
       if (u_setsticky_exempt(NULL, host, yn) > 0) {
       if (u_setsticky_exempt(NULL, host, yn) > 0) {
+#ifdef HUB
         putlog(LOG_CMDS, "@", "%s: %s %s", dcc[idx].nick, (yn) ? "stick" : "unstick", host);
         putlog(LOG_CMDS, "@", "%s: %s %s", dcc[idx].nick, (yn) ? "stick" : "unstick", host);
+#endif /* HUB */
         shareout_but(idx, "se %s %d\n", host, yn);
         shareout_but(idx, "se %s %d\n", host, yn);
       }
       }
     } else {
     } else {
@@ -185,7 +191,9 @@ share_stick_exempt(int idx, char *par)
 
 
       if ((chan != NULL) && (cr = get_chanrec(dcc[idx].user, par)))
       if ((chan != NULL) && (cr = get_chanrec(dcc[idx].user, par)))
         if (u_setsticky_exempt(chan, host, yn) > 0) {
         if (u_setsticky_exempt(chan, host, yn) > 0) {
+#ifdef HUB
           putlog(LOG_CMDS, "@", "%s: stick %s %c %s", dcc[idx].nick, host, yn ? 'y' : 'n', par);
           putlog(LOG_CMDS, "@", "%s: stick %s %c %s", dcc[idx].nick, host, yn ? 'y' : 'n', par);
+#endif /* HUB */
           shareout_but(idx, "se %s %d %s\n", host, yn, chan->dname);
           shareout_but(idx, "se %s %d %s\n", host, yn, chan->dname);
           noshare = 0;
           noshare = 0;
           return;
           return;
@@ -211,7 +219,9 @@ share_stick_invite(int idx, char *par)
     noshare = 1;
     noshare = 1;
     if (!par[0]) {              /* Global invite */
     if (!par[0]) {              /* Global invite */
       if (u_setsticky_invite(NULL, host, yn) > 0) {
       if (u_setsticky_invite(NULL, host, yn) > 0) {
+#ifdef HUB
         putlog(LOG_CMDS, "@", "%s: %s %s", dcc[idx].nick, (yn) ? "stick" : "unstick", host);
         putlog(LOG_CMDS, "@", "%s: %s %s", dcc[idx].nick, (yn) ? "stick" : "unstick", host);
+#endif /* HUB */
         shareout_but(idx, "sInv %s %d\n", host, yn);
         shareout_but(idx, "sInv %s %d\n", host, yn);
       }
       }
     } else {
     } else {
@@ -220,7 +230,9 @@ share_stick_invite(int idx, char *par)
 
 
       if ((chan != NULL) && (cr = get_chanrec(dcc[idx].user, par)))
       if ((chan != NULL) && (cr = get_chanrec(dcc[idx].user, par)))
         if (u_setsticky_invite(chan, host, yn) > 0) {
         if (u_setsticky_invite(chan, host, yn) > 0) {
+#ifdef HUB
           putlog(LOG_CMDS, "@", "%s: %s %s %s", dcc[idx].nick, (yn) ? "stick" : "unstick", host, par);
           putlog(LOG_CMDS, "@", "%s: %s %s %s", dcc[idx].nick, (yn) ? "stick" : "unstick", host, par);
+#endif /* HUB */
           shareout_but(idx, "sInv %s %d %s\n", host, yn, chan->dname);
           shareout_but(idx, "sInv %s %d %s\n", host, yn, chan->dname);
           noshare = 0;
           noshare = 0;
           return;
           return;
@@ -241,10 +253,15 @@ share_chhand(int idx, char *par)
     hand = newsplit(&par);
     hand = newsplit(&par);
     u = get_user_by_handle(userlist, hand);
     u = get_user_by_handle(userlist, hand);
     if (u) {
     if (u) {
+      int value = 0;
+
       shareout_but(idx, "h %s %s\n", hand, par);
       shareout_but(idx, "h %s %s\n", hand, par);
       noshare = 1;
       noshare = 1;
-      if (change_handle(u, par))
+      value = change_handle(u, par);
+#ifdef HUB
+      if (value)
         putlog(LOG_CMDS, "@", "%s: handle %s->%s", dcc[idx].nick, hand, par);
         putlog(LOG_CMDS, "@", "%s: handle %s->%s", dcc[idx].nick, hand, par);
+#endif /* HUB */
       noshare = 0;
       noshare = 0;
     }
     }
   }
   }
@@ -279,8 +296,10 @@ share_chattr(int idx, char *par)
           check_dcc_chanattrs(u, par, fr.chan, fr2.chan);
           check_dcc_chanattrs(u, par, fr.chan, fr2.chan);
           noshare = 0;
           noshare = 0;
           build_flags(s, &fr, 0);
           build_flags(s, &fr, 0);
+#ifdef HUB
           if (!(dcc[idx].status & STAT_GETTING))
           if (!(dcc[idx].status & STAT_GETTING))
             putlog(LOG_CMDS, "@", "%s: chattr %s %s %s", dcc[idx].nick, hand, s, par);
             putlog(LOG_CMDS, "@", "%s: chattr %s %s %s", dcc[idx].nick, hand, s, par);
+#endif /* HUB */
 #ifdef LEAF
 #ifdef LEAF
           recheck_channel(cst, 0);
           recheck_channel(cst, 0);
 #endif /* LEAF */
 #endif /* LEAF */
@@ -329,7 +348,9 @@ share_pls_chrec(int idx, char *par)
       shareout_but(idx, "+cr %s %s\n", user, par);
       shareout_but(idx, "+cr %s %s\n", user, par);
       if (!get_chanrec(u, par)) {
       if (!get_chanrec(u, par)) {
         add_chanrec(u, par);
         add_chanrec(u, par);
+#ifdef HUB
         putlog(LOG_CMDS, "@", "%s: +chrec %s %s", dcc[idx].nick, user, par);
         putlog(LOG_CMDS, "@", "%s: +chrec %s %s", dcc[idx].nick, user, par);
+#endif /* HUB */
       }
       }
       noshare = 0;
       noshare = 0;
     }
     }
@@ -351,7 +372,9 @@ share_mns_chrec(int idx, char *par)
       del_chanrec(u, par);
       del_chanrec(u, par);
       shareout_but(idx, "-cr %s %s\n", user, par);
       shareout_but(idx, "-cr %s %s\n", user, par);
       noshare = 0;
       noshare = 0;
+#ifdef HUB
       putlog(LOG_CMDS, "@", "%s: -chrec %s %s", dcc[idx].nick, user, par);
       putlog(LOG_CMDS, "@", "%s: -chrec %s %s", dcc[idx].nick, user, par);
+#endif /* HUB */
     }
     }
   }
   }
 }
 }
@@ -397,9 +420,9 @@ share_newuser(int idx, char *par)
       set_user_flagrec(u, &fr, 0);
       set_user_flagrec(u, &fr, 0);
       fr.match = FR_CHAN;       /* why?? */
       fr.match = FR_CHAN;       /* why?? */
       noshare = 0;
       noshare = 0;
-#ifndef LEAF
+#ifdef HUB
       putlog(LOG_CMDS, "@", "%s: newuser %s %s", dcc[idx].nick, nick, s);
       putlog(LOG_CMDS, "@", "%s: newuser %s %s", dcc[idx].nick, nick, s);
-#endif /* LEAF */
+#endif /* HUB */
     }
     }
   }
   }
 }
 }
@@ -415,9 +438,9 @@ share_killuser(int idx, char *par)
     noshare = 1;
     noshare = 1;
     if (deluser(par)) {
     if (deluser(par)) {
       shareout_but(idx, "k %s\n", par);
       shareout_but(idx, "k %s\n", par);
-#ifndef LEAF
+#ifdef HUB
       putlog(LOG_CMDS, "@", "%s: killuser %s", dcc[idx].nick, par);
       putlog(LOG_CMDS, "@", "%s: killuser %s", dcc[idx].nick, par);
-#endif /* LEAF */
+#endif /* HUB */
     }
     }
     noshare = 0;
     noshare = 0;
   }
   }
@@ -462,10 +485,10 @@ share_pls_bothost(int idx, char *par)
     } else {
     } else {
       userlist = adduser(userlist, hand, par, "-", 0, 1);
       userlist = adduser(userlist, hand, par, "-", 0, 1);
     }
     }
-#ifndef LEAF
+#ifdef HUB
     if (!(dcc[idx].status & STAT_GETTING))
     if (!(dcc[idx].status & STAT_GETTING))
       putlog(LOG_CMDS, "@", "%s: +host %s %s", dcc[idx].nick, hand, par);
       putlog(LOG_CMDS, "@", "%s: +host %s %s", dcc[idx].nick, hand, par);
-#endif /* LEAF */
+#endif /* HUB */
   }
   }
 }
 }
 
 
@@ -557,7 +580,9 @@ share_chchinfo(int idx, char *par)
       noshare = 1;
       noshare = 1;
       set_handle_chaninfo(userlist, hand, chan, par);
       set_handle_chaninfo(userlist, hand, chan, par);
       noshare = 0;
       noshare = 0;
+#ifdef HUB
       putlog(LOG_CMDS, "@", "%s: change info %s %s", dcc[idx].nick, chan, hand);
       putlog(LOG_CMDS, "@", "%s: change info %s %s", dcc[idx].nick, chan, hand);
+#endif /* HUB */
     }
     }
   }
   }
 }
 }
@@ -567,7 +592,9 @@ share_mns_ban(int idx, char *par)
 {
 {
   if (dcc[idx].status & STAT_SHARE) {
   if (dcc[idx].status & STAT_SHARE) {
     shareout_but(idx, "-b %s\n", par);
     shareout_but(idx, "-b %s\n", par);
+#ifdef HUB
     putlog(LOG_CMDS, "@", "%s: cancel ban %s", dcc[idx].nick, par);
     putlog(LOG_CMDS, "@", "%s: cancel ban %s", dcc[idx].nick, par);
+#endif /* HUB */
     str_unescape(par, '\\');
     str_unescape(par, '\\');
     noshare = 1;
     noshare = 1;
     if (u_delmask('b', NULL, par, 1) > 0) {
     if (u_delmask('b', NULL, par, 1) > 0) {
@@ -587,7 +614,9 @@ share_mns_exempt(int idx, char *par)
 {
 {
   if (dcc[idx].status & STAT_SHARE) {
   if (dcc[idx].status & STAT_SHARE) {
     shareout_but(idx, "-e %s\n", par);
     shareout_but(idx, "-e %s\n", par);
+#ifdef HUB
     putlog(LOG_CMDS, "@", "%s: cancel exempt %s", dcc[idx].nick, par);
     putlog(LOG_CMDS, "@", "%s: cancel exempt %s", dcc[idx].nick, par);
+#endif /* HUB */
     str_unescape(par, '\\');
     str_unescape(par, '\\');
     noshare = 1;
     noshare = 1;
     if (u_delmask('e', NULL, par, 1) > 0) {
     if (u_delmask('e', NULL, par, 1) > 0) {
@@ -607,7 +636,9 @@ share_mns_invite(int idx, char *par)
 {
 {
   if (dcc[idx].status & STAT_SHARE) {
   if (dcc[idx].status & STAT_SHARE) {
     shareout_but(idx, "-inv %s\n", par);
     shareout_but(idx, "-inv %s\n", par);
+#ifdef HUB
     putlog(LOG_CMDS, "@", "%s: cancel invite %s", dcc[idx].nick, par);
     putlog(LOG_CMDS, "@", "%s: cancel invite %s", dcc[idx].nick, par);
+#endif /* HUB */
     str_unescape(par, '\\');
     str_unescape(par, '\\');
     noshare = 1;
     noshare = 1;
     if (u_delmask('I', NULL, par, 1) > 0) {
     if (u_delmask('I', NULL, par, 1) > 0) {
@@ -632,7 +663,9 @@ share_mns_banchan(int idx, char *par)
     chname = newsplit(&par);
     chname = newsplit(&par);
     chan = findchan_by_dname(chname);
     chan = findchan_by_dname(chname);
     shareout_but(idx, "-bc %s %s\n", chname, par);
     shareout_but(idx, "-bc %s %s\n", chname, par);
+#ifdef HUB
     putlog(LOG_CMDS, "@", "%s: cancel ban %s on %s", dcc[idx].nick, par, chname);
     putlog(LOG_CMDS, "@", "%s: cancel ban %s on %s", dcc[idx].nick, par, chname);
+#endif /* HUB */
     str_unescape(par, '\\');
     str_unescape(par, '\\');
     noshare = 1;
     noshare = 1;
 #ifdef LEAF
 #ifdef LEAF
@@ -656,7 +689,9 @@ share_mns_exemptchan(int idx, char *par)
     chname = newsplit(&par);
     chname = newsplit(&par);
     chan = findchan_by_dname(chname);
     chan = findchan_by_dname(chname);
     shareout_but(idx, "-ec %s %s\n", chname, par);
     shareout_but(idx, "-ec %s %s\n", chname, par);
+#ifdef HUB
     putlog(LOG_CMDS, "@", "%s: cancel exempt %s on %s", dcc[idx].nick, par, chname);
     putlog(LOG_CMDS, "@", "%s: cancel exempt %s on %s", dcc[idx].nick, par, chname);
+#endif /* HUB */
     str_unescape(par, '\\');
     str_unescape(par, '\\');
     noshare = 1;
     noshare = 1;
 #ifdef LEAF
 #ifdef LEAF
@@ -681,7 +716,9 @@ share_mns_invitechan(int idx, char *par)
     chname = newsplit(&par);
     chname = newsplit(&par);
     chan = findchan_by_dname(chname);
     chan = findchan_by_dname(chname);
     shareout_but(idx, "-invc %s %s\n", chname, par);
     shareout_but(idx, "-invc %s %s\n", chname, par);
+#ifdef HUB
     putlog(LOG_CMDS, "@", "%s: cancel invite %s on %s", dcc[idx].nick, par, chname);
     putlog(LOG_CMDS, "@", "%s: cancel invite %s on %s", dcc[idx].nick, par, chname);
+#endif /* HUB */
     str_unescape(par, '\\');
     str_unescape(par, '\\');
     noshare = 1;
     noshare = 1;
 #ifdef LEAF
 #ifdef LEAF
@@ -701,7 +738,9 @@ share_mns_ignore(int idx, char *par)
 {
 {
   if (dcc[idx].status & STAT_SHARE) {
   if (dcc[idx].status & STAT_SHARE) {
     shareout_but(idx, "-i %s\n", par);
     shareout_but(idx, "-i %s\n", par);
+#ifdef HUB
     putlog(LOG_CMDS, "@", "%s: cancel ignore %s", dcc[idx].nick, par);
     putlog(LOG_CMDS, "@", "%s: cancel ignore %s", dcc[idx].nick, par);
+#endif /* HUB */
     str_unescape(par, '\\');
     str_unescape(par, '\\');
     noshare = 1;
     noshare = 1;
     delignore(par);
     delignore(par);
@@ -739,7 +778,9 @@ share_pls_ban(int idx, char *par)
     if (expire_time != 0L)
     if (expire_time != 0L)
       expire_time += now;
       expire_time += now;
     u_addmask('b', NULL, ban, from, par, expire_time, flags);
     u_addmask('b', NULL, ban, from, par, expire_time, flags);
+#ifdef HUB
     putlog(LOG_CMDS, "@", "%s: global ban %s (%s:%s)", dcc[idx].nick, ban, from, par);
     putlog(LOG_CMDS, "@", "%s: global ban %s (%s:%s)", dcc[idx].nick, ban, from, par);
+#endif /* HUB */
     noshare = 0;
     noshare = 0;
 #ifdef LEAF
 #ifdef LEAF
     for (struct chanset_t *chan = chanset; chan != NULL; chan = chan->next)
     for (struct chanset_t *chan = chanset; chan != NULL; chan = chan->next)
@@ -776,7 +817,9 @@ share_pls_banchan(int idx, char *par)
     if (strchr(from, 'p'))
     if (strchr(from, 'p'))
       flags |= MASKREC_PERM;
       flags |= MASKREC_PERM;
     from = newsplit(&par);
     from = newsplit(&par);
+#ifdef HUB
     putlog(LOG_CMDS, "@", "%s: ban %s on %s (%s:%s)", dcc[idx].nick, ban, chname, from, par);
     putlog(LOG_CMDS, "@", "%s: ban %s on %s (%s:%s)", dcc[idx].nick, ban, chname, from, par);
+#endif /* HUB */
     noshare = 1;
     noshare = 1;
     expire_time = (time_t) atoi(tm);
     expire_time = (time_t) atoi(tm);
     if (expire_time != 0L)
     if (expire_time != 0L)
@@ -817,7 +860,9 @@ share_pls_exempt(int idx, char *par)
     if (expire_time != 0L)
     if (expire_time != 0L)
       expire_time += now;
       expire_time += now;
     u_addmask('e', NULL, exempt, from, par, expire_time, flags);
     u_addmask('e', NULL, exempt, from, par, expire_time, flags);
+#ifdef HUB
     putlog(LOG_CMDS, "@", "%s: global exempt %s (%s:%s)", dcc[idx].nick, exempt, from, par);
     putlog(LOG_CMDS, "@", "%s: global exempt %s (%s:%s)", dcc[idx].nick, exempt, from, par);
+#endif /* HUB */
     noshare = 0;
     noshare = 0;
 #ifdef LEAF
 #ifdef LEAF
     for (struct chanset_t *chan = chanset; chan != NULL; chan = chan->next)
     for (struct chanset_t *chan = chanset; chan != NULL; chan = chan->next)
@@ -856,7 +901,9 @@ share_pls_exemptchan(int idx, char *par)
     if (strchr(from, 'p'))
     if (strchr(from, 'p'))
       flags |= MASKREC_PERM;
       flags |= MASKREC_PERM;
     from = newsplit(&par);
     from = newsplit(&par);
+#ifdef HUB
     putlog(LOG_CMDS, "@", "%s: exempt %s on %s (%s:%s)", dcc[idx].nick, exempt, chname, from, par);
     putlog(LOG_CMDS, "@", "%s: exempt %s on %s (%s:%s)", dcc[idx].nick, exempt, chname, from, par);
+#endif /* HUB */
     noshare = 1;
     noshare = 1;
     expire_time = (time_t) atoi(tm);
     expire_time = (time_t) atoi(tm);
     if (expire_time != 0L)
     if (expire_time != 0L)
@@ -901,7 +948,9 @@ share_pls_invite(int idx, char *par)
     if (expire_time != 0L)
     if (expire_time != 0L)
       expire_time += now;
       expire_time += now;
     u_addmask('I', NULL, invite, from, par, expire_time, flags);
     u_addmask('I', NULL, invite, from, par, expire_time, flags);
+#ifdef HUB
     putlog(LOG_CMDS, "@", "%s: global invite %s (%s:%s)", dcc[idx].nick, invite, from, par);
     putlog(LOG_CMDS, "@", "%s: global invite %s (%s:%s)", dcc[idx].nick, invite, from, par);
+#endif /* HUB */
     noshare = 0;
     noshare = 0;
 #ifdef LEAF
 #ifdef LEAF
     for (struct chanset_t *chan = chanset; chan != NULL; chan = chan->next)
     for (struct chanset_t *chan = chanset; chan != NULL; chan = chan->next)
@@ -940,7 +989,9 @@ share_pls_invitechan(int idx, char *par)
     if (strchr(from, 'p'))
     if (strchr(from, 'p'))
       flags |= MASKREC_PERM;
       flags |= MASKREC_PERM;
     from = newsplit(&par);
     from = newsplit(&par);
+#ifdef HUB
     putlog(LOG_CMDS, "@", "%s: invite %s on %s (%s:%s)", dcc[idx].nick, invite, chname, from, par);
     putlog(LOG_CMDS, "@", "%s: invite %s on %s (%s:%s)", dcc[idx].nick, invite, chname, from, par);
+#endif /* HUB */
     noshare = 1;
     noshare = 1;
     expire_time = (time_t) atoi(tm);
     expire_time = (time_t) atoi(tm);
     if (expire_time != 0L)
     if (expire_time != 0L)
@@ -978,7 +1029,9 @@ share_pls_ignore(int idx, char *par)
     if (strlen(from) > HANDLEN + 1)
     if (strlen(from) > HANDLEN + 1)
       from[HANDLEN + 1] = 0;
       from[HANDLEN + 1] = 0;
     par[65] = 0;
     par[65] = 0;
+#ifdef HUB
     putlog(LOG_CMDS, "@", "%s: ignore %s (%s: %s)", dcc[idx].nick, ign, from, par);
     putlog(LOG_CMDS, "@", "%s: ignore %s (%s: %s)", dcc[idx].nick, ign, from, par);
+#endif /* HUB */
     addignore(ign, from, (const char *) par, expire_time);
     addignore(ign, from, (const char *) par, expire_time);
     noshare = 0;
     noshare = 0;
   }
   }