Parcourir la source

* Port [3577] to 1.2.14
* Fix cmd/dcc prefix leaking to -p users (when chat is off) (fixes #376)


svn: 3578

Bryan Drewery il y a 18 ans
Parent
commit
b24edb0f5c
8 fichiers modifiés avec 17 ajouts et 15 suppressions
  1. 1 0
      doc/UPDATES
  2. 2 2
      src/botnet.c
  3. 5 5
      src/cmds.c
  4. 3 3
      src/core_binds.c
  5. 1 1
      src/dcc.c
  6. 2 1
      src/misc.c
  7. 1 1
      src/mod/channels.mod/cmdschan.c
  8. 2 2
      src/set.c

+ 1 - 0
doc/UPDATES

@@ -62,6 +62,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fix MODE parsing bug
 * Bot no longer requires (or uses) '-B' to spawn bots. (now: ./binary <botnick>)
 * Fixed +take opping the wrong clients due to desync (+take now sets +bitch)
+* Fix cmd/dcc prefix leaking to -p users (when chat is off) (fixes #376)
 
 1.2.13 - http://wraith.shatow.net/milestone/1.2.13
 * Fix cmd_chanset accepting invalid flags

+ 2 - 2
src/botnet.c

@@ -980,7 +980,7 @@ int botlink(char *linker, int idx, char *nick)
     if (!bi || !strlen(bi->address) || !bi->telnet_port || (bi->telnet_port <= 0)) {
       if (idx >= 0) {
 	dprintf(idx, "Invalid telnet address:port stored for '%s'.\n", nick);
-	dprintf(idx, "Use: %schaddr %s <address>:<port#>[/<relay-port#>]\n", settings.dcc_prefix, nick);
+	dprintf(idx, "Use: %schaddr %s <address>:<port#>[/<relay-port#>]\n", (dcc[idx].u.chat->channel >= 0) ? settings.dcc_prefix : "", nick);
       }
     } else if (dcc_total == max_dcc) {
       if (idx >= 0)
@@ -1135,7 +1135,7 @@ void tandem_relay(int idx, char *nick, register int i)
 
   if (!bi || !strlen(bi->address) || !bi->relay_port || (bi->relay_port <= 0)) {
     dprintf(idx, "Invalid telnet address:port stored for '%s'.\n", nick);
-    dprintf(idx, "Use: %schaddr %s <address>:<port#>[/<relay-port#>]\n", settings.dcc_prefix, nick);
+    dprintf(idx, "Use: %schaddr %s <address>:<port#>[/<relay-port#>]\n", (dcc[idx].u.chat->channel >= 0) ? settings.dcc_prefix : "", nick);
 
     return;
   }

+ 5 - 5
src/cmds.c

@@ -670,7 +670,7 @@ static void cmd_help(int idx, char *par)
   if (fnd) 
     dprintf(idx, "--End help listing\n");
   if (!strcmp(match, "*")) {
-    dprintf(idx, "For individual command help, type: %shelp <command>\n", settings.dcc_prefix);
+    dprintf(idx, "For individual command help, type: %shelp <command>\n", (dcc[idx].u.chat->channel >= 0) ? settings.dcc_prefix : "");
   } else if (!fnd) {
     dprintf(idx, "No match for '%s'.\n", match);
   }
@@ -763,7 +763,7 @@ static void cmd_matchbot(int idx, char *par)
 static void cmd_match(int idx, char *par)
 {
   match(idx, par, 0);
-  dprintf(idx, "- If trying to match a bot, please use '%smatchbot %s'\n", settings.dcc_prefix, par);
+  dprintf(idx, "- If trying to match a bot, please use '%smatchbot %s'\n", (dcc[idx].u.chat->channel >= 0) ? settings.dcc_prefix : "", par);
 }
 
 static void cmd_update(int idx, char *par)
@@ -861,7 +861,7 @@ static void cmd_channels(int idx, char *par) {
   }
 
   if ((dcc[idx].user->flags & USER_MASTER) && !(par && par[0]))
-    dprintf(idx, "You can also %schannels <user>\n", settings.dcc_prefix);
+    dprintf(idx, "You can also %schannels <user>\n", (dcc[idx].u.chat->channel >= 0) ? settings.dcc_prefix : "");
 }
 
 
@@ -1275,7 +1275,7 @@ static void cmd_chsecpass(int idx, char *par)
 static void cmd_botcmd(int idx, char *par)
 {
   if (dcc[idx].simul >= 0) {
-    dprintf(idx, "Sorry, you can't chain '%sbotcmd'.\n", settings.dcc_prefix);
+    dprintf(idx, "Sorry, you can't chain '%sbotcmd'.\n", (dcc[idx].u.chat->channel >= 0) ? settings.dcc_prefix : "");
     putlog(LOG_WARN, "*", "%s attempted to chain 'botcmd' over the botnet.", dcc[idx].nick);
     return;
   }
@@ -2144,7 +2144,7 @@ int check_dcc_attrs(struct userrec *u, flag_t oatr)
       if (!(oatr & USER_PARTY) && (u->flags & USER_PARTY) && dcc[i].u.chat->channel < 0) {
         dprintf(i, "-+- POOF! -+-\n");
         dprintf(i, "You now have party line chat access.\n");
-        dprintf(i, "To rejoin the partyline, type: %schat on\n", settings.dcc_prefix);
+        dprintf(i, "To rejoin the partyline, type: %schat on\n", (dcc[i].u.chat->channel >= 0) ? settings.dcc_prefix : "");
       }
 
       if (!(oatr & USER_OWNER) && (u->flags & USER_OWNER)) {

+ 3 - 3
src/core_binds.c

@@ -180,7 +180,7 @@ void real_check_bind_dcc(const char *cmd, int idx, const char *text, Auth *auth)
               strcpy(args, p);
             } else {
               dprintf(idx, "Invalid command password.\n");
-              dprintf(idx, "Use: $b%scommand <password> [arguments]$b\n", settings.dcc_prefix);
+              dprintf(idx, "Use: $b%scommand <password> [arguments]$b\n", (dcc[idx].u.chat->channel >= 0) ? settings.dcc_prefix : "");
               if (p)
                 p++;
               putlog(LOG_CMDS, "*", "$ #%s# %s **hidden** %s", dcc[idx].nick, entry->mask, p && *p ? p : "");
@@ -190,7 +190,7 @@ void real_check_bind_dcc(const char *cmd, int idx, const char *text, Auth *auth)
             }
           } else {
             putlog(LOG_CMDS, "*", "! #%s# %s %s", dcc[idx].nick, cmd, args);
-            dprintf(idx, "What?  You need '%shelp'\n", settings.dcc_prefix);
+            dprintf(idx, "What?  You need '%shelp'\n", (dcc[idx].u.chat->channel >= 0) ? settings.dcc_prefix : "");
             free(args);
             return;
           }
@@ -215,7 +215,7 @@ void real_check_bind_dcc(const char *cmd, int idx, const char *text, Auth *auth)
 
   if (hits == 0) {
     if (!check_aliases(idx, cmd, args)) 
-      dprintf(idx, "What?  You need '%shelp'\n", settings.dcc_prefix);
+      dprintf(idx, "What?  You need '%shelp'\n", (dcc[idx].u.chat->channel >= 0) ? settings.dcc_prefix : "");
     else
       log_bad = 0;
   } else if (hits > 1)

+ 1 - 1
src/dcc.c

@@ -1157,7 +1157,7 @@ dcc_chat(int idx, char *buf, int len)
       dprintf(idx, "Sure you want that going to the partyline? ;) (msg to partyline halted.)\n");
     } else if (!strncmp(buf, "+Auth ", 6)) {    /* ignore extra +Auth lines */
     } else if ((!strncmp(buf, settings.dcc_prefix, strlen(settings.dcc_prefix))) || (dcc[idx].u.chat->channel < 0)) {
-      if (!strncmp(buf, settings.dcc_prefix, strlen(settings.dcc_prefix)))        /* strip '.' out */
+      if (!strncmp(buf, settings.dcc_prefix, strlen(settings.dcc_prefix)) && (dcc[idx].u.chat->channel >= 0))        /* strip '.' out */
         buf++;
       v = newsplit(&buf);
       rmspace(buf);

+ 2 - 1
src/misc.c

@@ -1091,7 +1091,8 @@ void showhelp(int idx, struct flag_record *flags, char *string)
         }
       } else if (*(string + 1) == 'd') {
         string += 2;
-        strcat(helpstr, settings.dcc_prefix);        
+        if (dcc[idx].u.chat->channel >= 0)
+          strcat(helpstr, settings.dcc_prefix);        
       } else if (*(string + 1) == '%') {
         string += 2;
         strcat(helpstr, "%");        

+ 1 - 1
src/mod/channels.mod/cmdschan.c

@@ -1270,7 +1270,7 @@ static void cmd_chanset(int idx, char *par)
     all = 1;
     get_user_flagrec(dcc[idx].user, &user, chanset ? chanset->dname : "");
     if (!glob_master(user)) {
-      dprintf(idx, "You need to be a global master to use %schanset *.\n", settings.dcc_prefix);
+      dprintf(idx, "You need to be a global master to use '%schanset *'.\n", (dcc[idx].u.chat->channel >= 0) ? settings.dcc_prefix : "");
       return;
     }
     newsplit(&par);

+ 2 - 2
src/set.c

@@ -918,9 +918,9 @@ int cmd_set_real(const char *botnick, int idx, char *par)
       if (notyes) {
         dprintf(idx, "Using non-list functions on a list variable can be dangerous, please retype with -YES if you're sure:\n");
         if (botnick)
-          dprintf(idx, "%sbotset %s -YES %s ...\n", settings.dcc_prefix, botnick, var->name);
+          dprintf(idx, "%sbotset %s -YES %s ...\n", (dcc[idx].u.chat->channel >= 0) ? settings.dcc_prefix : "", botnick, var->name);
         else
-          dprintf(idx, "%sset -YES %s ...\n", settings.dcc_prefix, var->name);
+          dprintf(idx, "%sset -YES %s ...\n", (dcc[idx].u.chat->channel >= 0) ? settings.dcc_prefix : "", var->name);
         return 0;
       }
     }