From: Pasi Kallinen Date: Fri, 28 Dec 2007 10:01:35 +0000 (+0000) Subject: Fix the sqlite3 addition: Newly registered nicks shouldn't interfere with already... X-Git-Tag: v1.6.1-roc-dev~331 X-Git-Url: https://skyeroc.xyz/gitweb/?a=commitdiff_plain;h=0633108e742e43866a67391cdd79d527e9fe30dd;p=dgamelaunch Fix the sqlite3 addition: Newly registered nicks shouldn't interfere with already registered ones. git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@377 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- diff --git a/dgamelaunch.c b/dgamelaunch.c index 7b34c6f..3c017e7 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -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) {