Răsfoiți Sursa

* Quietly ignore/drop invalid nicks for telnet login.

svn: 1671
Bryan Drewery 21 ani în urmă
părinte
comite
1a59796e7e
2 a modificat fișierele cu 16 adăugiri și 25 ștergeri
  1. 1 0
      doc/UPDATES
  2. 15 25
      src/dcc.c

+ 1 - 0
doc/UPDATES

@@ -36,6 +36,7 @@ This is a summary of ChangeLog basically.
 * cmd_quit failed to log.
 * cmd_quit failed to log.
 * Now making a small attempt to auto make the tmpdir.
 * Now making a small attempt to auto make the tmpdir.
 * Increased password timeout to 40 seconds and auth timeout to 80 seconds.
 * Increased password timeout to 40 seconds and auth timeout to 80 seconds.
+* Quietly ignore/drop invalid nicks for telnet login.
 
 
 1.2
 1.2
 * No longer displaying SALTS on ./bin -v
 * No longer displaying SALTS on ./bin -v

+ 15 - 25
src/dcc.c

@@ -1547,17 +1547,6 @@ dcc_telnet_id(int idx, char *buf, int atr)
 
 
   nick[HANDLEN] = 0;
   nick[HANDLEN] = 0;
 
 
-  /* Toss out bad nicknames */
-  if ((dcc[idx].nick[0] != '@') && (!wild_match(dcc[idx].nick, nick))) {
-/* FIXME: if a bot gets this, they will try to decrypt it ;/ */
-    dprintf(idx, "Sorry, that nickname format is invalid.\n");
-    putlog(LOG_BOTS, "*", DCC_BADNICK, dcc[idx].host);
-    killsock(dcc[idx].sock);
-    lostdcc(idx);
-    return;
-  }
-
-
   dcc[idx].user = get_user_by_handle(userlist, nick);
   dcc[idx].user = get_user_by_handle(userlist, nick);
 
 
   /* FIXME: remove after 1.2.2 */
   /* FIXME: remove after 1.2.2 */
@@ -1571,26 +1560,27 @@ dcc_telnet_id(int idx, char *buf, int atr)
   }
   }
 */
 */
   bool ok = 0;
   bool ok = 0;
-  struct flag_record fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0 };
 
 
-  get_user_flagrec(dcc[idx].user, &fr, NULL);
+  if (dcc[idx].user) {
+    struct flag_record fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0 };
 
 
+    get_user_flagrec(dcc[idx].user, &fr, NULL);
 
 
-/*  if (!ok && glob_party(fr))
-    ok = 1;*/
-  ok = 1;
+    ok = 1;
 #ifdef HUB
 #ifdef HUB
-  if (!glob_huba(fr))
-    ok = 0;
+    if (!glob_huba(fr))
+      ok = 0;
 #else /* !HUB */
 #else /* !HUB */
-  /* if I am a chanhub and they dont have +c then drop */
-  if (ischanhub() && !glob_chuba(fr))
-    ok = 0;
-  if (!ischanhub())
-    ok = 0;
+    /* if I am a chanhub and they dont have +c then drop */
+    if (ischanhub() && !glob_chuba(fr))
+      ok = 0;
+    if (!ischanhub())
+      ok = 0;
 #endif /* HUB */
 #endif /* HUB */
-  if (!ok && glob_bot(fr))
-    ok = 1;
+    if (!ok && glob_bot(fr))
+      ok = 1;
+  }
+
   if (!ok) {
   if (!ok) {
     putlog(LOG_BOTS, "*", DCC_INVHANDLE, dcc[idx].host, nick);
     putlog(LOG_BOTS, "*", DCC_INVHANDLE, dcc[idx].host, nick);
     killsock(dcc[idx].sock);
     killsock(dcc[idx].sock);