Issue Information
-
#004700
-
2 - Fair
-
Fixed
Issue Confirmations
-
Yes (1)No (0)
Originally posted by EternalFriend
http://www.eathena.w...er&showbug=4700
Hello.
First encountered this problem - create a character with the same nicknames, which in turn are written differently:
TEST, Test, test, teSt - I can create.
In char_athena.conf - as it should - ban:
Tried to put a value of zero, the effect is not produced.
tried to put the latest on this day (14659) - the same thing.
Different keyboard layouts are excluded.
Sorry for my english, I'm from Russia.
Thx.
http://www.eathena.w...er&showbug=4700
Hello.
First encountered this problem - create a character with the same nicknames, which in turn are written differently:
TEST, Test, test, teSt - I can create.
In char_athena.conf - as it should - ban:
CODE
// Allow or not identical name for characters but with a different case (upper/lower):
// example: Test-test-TEST-TesT; Value: 0 not allowed (default), 1 allowed
name_ignoring_case: no
// example: Test-test-TEST-TesT; Value: 0 not allowed (default), 1 allowed
name_ignoring_case: no
Tried to put a value of zero, the effect is not produced.
tried to put the latest on this day (14659) - the same thing.
Different keyboard layouts are excluded.
Sorry for my english, I'm from Russia.
Thx.
Originally posted by xazax
The value is read in char server sql implementation, but not used.
My solution, ( I did not test it yet ):
The value is read in char server sql implementation, but not used.
My solution, ( I did not test it yet ):
<br />Index: char.c<br />===================================================================<br />--- char.c (revision 15270)<br />+++ char.c (working copy)<br />@@ -1327,11 +1327,31 @@<br /> }<br /><br /> // check name (already in use?)<br />- if( SQL_ERROR == Sql_Query(sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) )<br />+ if ( name_ignoring_case )<br /> {<br />- Sql_ShowDebug(sql_handle);<br />- return -2;<br />+ if( SQL_ERROR == Sql_Query(sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) )<br />+ {<br />+ Sql_ShowDebug(sql_handle);<br />+ return -2;<br />+ }<br /> }<br />+ else<br />+ {<br />+ char lower_esc_name[NAME_LENGTH*2+1];<br />+ int i = 0;<br />+ <br />+ while(esc_name[i])<br />+ {<br />+ lower_esc_name[i] = tolower(esc_name[i]);<br />+ ++i;<br />+ }<br />+ <br />+ if( SQL_ERROR == Sql_Query(sql_handle, "SELECT 1 FROM `%s` WHERE LOWER(`name`) = '%s' LIMIT 1", char_db, lower_esc_name) )<br />+ {<br />+ Sql_ShowDebug(sql_handle);<br />+ return -2;<br />+ }<br />+ }<br /> if( Sql_NumRows(sql_handle) > 0 )<br /> return -1; // name already exists<br /><br /><br />
Originally posted by arp
I've had a chat to xazax about this, and unfortunately his above provided is a little wrong. I've spent a little while looking at this, and have provided a patch that I'm confident will work as intended. It turns out that the piece of code used to lower() a string actually ended up adding garbage on to strings of len(str)==4.
I can't find an attach button, so here's the diff:
http://bawx.depha.se...issue_4700.diff
I've had a chat to xazax about this, and unfortunately his above provided is a little wrong. I've spent a little while looking at this, and have provided a patch that I'm confident will work as intended. It turns out that the piece of code used to lower() a string actually ended up adding garbage on to strings of len(str)==4.
I can't find an attach button, so here's the diff:
http://bawx.depha.se...issue_4700.diff
Originally posted by Ind
yours is a little wrong too XD I didn't test either yet but at taking a glance at the diff file, for example, you declare a lower_esc_name which is not used anywhereI've had a chat to xazax about this, and unfortunately his above provided is a little wrong. I've spent a little while looking at this, and have provided a patch that I'm confident will work as intended. It turns out that the piece of code used to lower() a string actually ended up adding garbage on to strings of len(str)==4.I can't find an attach button, so here's the diff:http://bawx.depha.se...issue_4700.diff
Originally posted by arp
Ah, I must have missed that out, lower_esc_name is from the old code and I forgot to remove it, I'll attach an updated diff.
Ah, I must have missed that out, lower_esc_name is from the old code and I forgot to remove it, I'll attach an updated diff.
Originally posted by arp
Diff has been updated to remove the two unused declarations.
Diff has been updated to remove the two unused declarations.
Originally posted by Ind
I've got to this and I've fixed it simply by adding a 'BINARY `name` = <name>'. Fixed in [rev=15374]
I've got to this and I've fixed it simply by adding a 'BINARY `name` = <name>'. Fixed in [rev=15374]