Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2005:
[Freeciv-Dev] (PR#13177) pubserver crash with /away
Home

[Freeciv-Dev] (PR#13177) pubserver crash with /away

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#13177) pubserver crash with /away
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 25 May 2005 14:35:51 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13177 >

Here's a patch.  This also prevents observer connections from doing
/away on their players (/observe jdorje; /away).

-jason

Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.354.2.34
diff -u -r1.354.2.34 stdinhand.c
--- server/stdinhand.c  3 May 2005 20:08:25 -0000       1.354.2.34
+++ server/stdinhand.c  25 May 2005 21:28:53 -0000
@@ -1852,6 +1852,10 @@
   } else if (name && strlen(name) > 0) {
     notify_conn(&caller->self, _("Usage: away"));
     return FALSE;
+  } else if (!caller->player || caller->observer) {
+    /* This happens for detached or observer connections. */
+    notify_conn(&caller->self, _("Only players may use the away command."));
+    return FALSE;
   } else if (!caller->player->ai.control && !check) {
     notify_conn(&game.est_connections, _("%s set to away mode."), 
                 caller->player->name);

[Prev in Thread] Current Thread [Next in Thread]