Просмотр исходного кода

* Fixed some bad passes being generated/set beginning with -/+

svn: 1887
Bryan Drewery 21 лет назад
Родитель
Сommit
29c87e1c35
3 измененных файлов с 13 добавлено и 1 удалено
  1. 1 0
      doc/UPDATES
  2. 1 0
      src/eggdrop.h
  3. 11 1
      src/misc.c

+ 1 - 0
doc/UPDATES

@@ -30,6 +30,7 @@ Lines prefixxed with '-' were disabled before release and are not finishsed.
 * Upped user limit for processes to 60.
 * After you edit a binary with -C, the first bot will be sent a signal to reload the data from the binary.
   (Fixes old bots/uname/data showing up in conf after bot is updated)
+* Fixed some bad passes being generated/set beginning with -/+
 
 1.2.2
 * Don't sanity check flags for users on DCC CHAT if they are on the bot via .botcmd.

+ 1 - 0
src/eggdrop.h

@@ -52,6 +52,7 @@
 #define UHOSTLEN        UHOSTMAX + 1
 #define DIRLEN          DIRMAX + 1
 #define NOTENAMELEN     ((HANDLEN << 1) + 1)
+#define BADPASSCHARS    "-+"
 #define LISTSEPERATORS  ",=:; "
 
 

+ 11 - 1
src/misc.c

@@ -482,9 +482,12 @@ void make_rand_str(char *s, size_t len)
       s[j] = '!' + randint(15);
 
     if (s[j] == 33 || s[j] == 37 || s[j] == 34 || s[j] == 40 || s[j] == 41 || s[j] == 38 || s[j] == 36) /* no % ( ) & */
-      s[j] = 35;
+      s[j] = 'a' + randint(26);
   }
 
+  if (s[0] == '+' || s[0] == '-')
+    s[0] = 'a' + randint(26);
+
   s[len] = '\0';
 }
 
@@ -790,6 +793,11 @@ int goodpass(char *pass, int idx, char *nick)
   char tell[501] = "";
   int nalpha = 0, lcase = 0, ucase = 0, ocase = 0, tc;
 
+  if (strchr(BADPASSCHARS, pass[0])) {
+    sprintf(tell, "Passes may not begin with '-'");
+    goto fail;
+  }
+
   for (int i = 0; i < (signed) strlen(pass); i++) {
     tc = (int) pass[i];
     if (tc < 58 && tc > 47)
@@ -831,6 +839,8 @@ int goodpass(char *pass, int idx, char *nick)
     else
       strcat(tell, ">= 8 chars.");
 
+    fail:
+
     if (idx)
       dprintf(idx, "%s\n", tell);
     else if (nick[0])