Character Duping Fix

From: George (greerga@CIRCLEMUD.ORG)
Date: 01/15/98


Everyone please try out this patch to prevent character login duping.  I
have confirmed it does work for the case where one person logs in and
answers 'Y' to "Are you sure?"  The next login attempting to create that
name receives an 'Invalid name.' message.  Test to make sure there is no
other possibility I may have missed.

diff -uprN j13stk/ban.c nodupe/ban.c
--- j13stk/ban.c        Sun Jan  4 21:38:40 1998
+++ nodupe/ban.c        Thu Jan 15 22:36:54 1998
@@ -20,7 +20,7 @@
 #include "db.h"

 struct ban_list_element *ban_list = NULL;
-
+extern struct descriptor_data *descriptor_list;

 char *ban_types[] = {
   "no",
@@ -240,8 +240,18 @@ int num_invalid = 0;
 int Valid_Name(char *newname)
 {
   int i;
-
+  struct descriptor_data *dt;
   char tempname[MAX_INPUT_LENGTH];
+
+  /*
+   * Make sure someone isn't trying to create this same name.  We want to
+   * do a 'str_cmp' so people can't do 'Bob' and 'BoB'.  This check is done
+   * here because this will prevent multiple creations of the same name.
+   * Note that the creating login will not have a character name yet. -gg
+   */
+  for (dt = descriptor_list; dt; dt = dt->next)
+    if (GET_NAME(dt->character) && !str_cmp(GET_NAME(dt->character), newname))
+      return FALSE;

   /* return valid if list doesn't exist */
   if (!invalid_list || num_invalid < 1)

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST