]> skyeroc.xyz Git - dgamelaunch/commitdiff
Fix the sqlite3 addition: Newly registered nicks shouldn't interfere with already...
authorPasi Kallinen <paxed@alt.org>
Fri, 28 Dec 2007 10:01:35 +0000 (10:01 +0000)
committerPasi Kallinen <paxed@alt.org>
Fri, 28 Dec 2007 10:01:35 +0000 (10:01 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@377 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

dgamelaunch.c

index 7b34c6f56c95ae119faf6a9d1ff0b2cae7157ecb..3c017e7002ba376fca8d9deb2eb394774d4e8f5d 100644 (file)
@@ -1327,7 +1327,11 @@ userexist (char *cname, int isnew)
     char tmpbuf[32];
     strncpy(tmpbuf, cname, (isnew ? globalconfig.max_newnick_len : 20));
 
-    qbuf = sqlite3_mprintf("select * from dglusers where username='%q' limit 1", tmpbuf);
+    /* Check that the nick doesn't interfere with already registered nicks */
+    if (isnew && (strlen(cname) >= globalconfig.max_newnick_len))
+       strcat(tmpbuf, "%");
+
+    qbuf = sqlite3_mprintf("select * from dglusers where username like '%q' limit 1", tmpbuf);
 
     ret = sqlite3_open(DGL_SQLITE_DB, &db); /* FIXME: use globalconfig->passwd? */
     if (ret) {