[Freeciv-Dev] (PR#11289) allow HACK connections to use non-ascii names
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=11289 >
This patch allows HACK connections (including local connections) to use
non-ascii names for cities and leaders.
The ascii-name restriction is to prevent abuse in multi-player. It's
not a fairness issue but is a (game-level) security issue. So there is
no reason why it should be forced on HACK connections.
One problem though is that the function to check this is only passed a
player pointer. Finding the actual connection that requested the name
isn't possible without changing an unfortunately large amount of code.
Nor is there a pplayer->user pointer! This interface should be fixed,
but not in this patch. So, I just iterated over all connections
attached to the player and allowed the name if any of them have HACK.
This means a HACK connection observing a player will allow that player
to use non-ascii names.
This patch is intended for stable and development branches.
-jason
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.282
diff -u -r1.282 citytools.c
--- server/citytools.c 1 Dec 2004 06:46:31 -0000 1.282
+++ server/citytools.c 1 Dec 2004 23:10:24 -0000
@@ -306,7 +306,17 @@
}
}
+ /* To prevent abuse, only players with HACK access (usually local
+ * connections) can use non-ascii names. Otherwise players could use
+ * confusing garbage names in multi-player games. */
if (!is_ascii_name(city_name)) {
+ conn_list_iterate(pplayer->connections, pconn) {
+ /* FIXME: this check isn't very good. Why isn't there any
+ * pplayer->user pointer? */
+ if (pconn->access_level == ALLOW_HACK) {
+ return TRUE;
+ }
+ } conn_list_iterate_end;
if (error_buf) {
my_snprintf(error_buf, bufsz,
_("%s is not a valid name. Only ASCII or "
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.213
diff -u -r1.213 srv_main.c
--- server/srv_main.c 1 Dec 2004 22:15:23 -0000 1.213
+++ server/srv_main.c 1 Dec 2004 23:10:24 -0000
@@ -1117,8 +1117,17 @@
return TRUE;
}
- /* Otherwise only ascii names are allowed. */
+ /* To prevent abuse, only players with HACK access (usually local
+ * connections) can use non-ascii names. Otherwise players could use
+ * confusing garbage names in multi-player games. */
if (!is_ascii_name(name)) {
+ conn_list_iterate(pplayer->connections, pconn) {
+ /* FIXME: this check isn't very good. Why isn't there any
+ * pplayer->user pointer? */
+ if (pconn->access_level == ALLOW_HACK) {
+ return TRUE;
+ }
+ } conn_list_iterate_end;
if (error_buf) {
my_snprintf(error_buf, bufsz, _("Please choose a name containing "
"only ASCII characters."));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#11289) allow HACK connections to use non-ascii names,
Jason Short <=
|
|