Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#9913) failed auth leaves client in inconsistent state
Home

[Freeciv-Dev] (PR#9913) failed auth leaves client in inconsistent state

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: kaufman@xxxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#9913) failed auth leaves client in inconsistent state
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Fri, 17 Sep 2004 08:52:28 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9913 >

> [kauf - Wed Sep 15 04:43:27 2004]:
> 
> here's the beginning of a fix for this problem. The server doesn't close
> the connection to the client completely on a rejection of connection.
> 
> -mike

This is wrong. Now the server crashes when someone tries to login with
the same name. We forget to close connection in unfail_authentication(),
not in reject_new_connection(). See attached patch. It reverts your
solution, fixes bug: When new password is wrong 3 times the client isn't
cut; and cuts a connection which sends unrequested packets.
--
mateusz
? civgame-3700.sav.gz
? civgame-3950.sav.gz
? freeciv_user_database
Index: connecthand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/connecthand.c,v
retrieving revision 1.30
diff -u -r1.30 connecthand.c
--- connecthand.c       15 Sep 2004 04:48:27 -0000      1.30
+++ connecthand.c       17 Sep 2004 15:50:04 -0000
@@ -196,7 +196,6 @@
   send_packet_server_join_reply(pconn, &packet);
   freelog(LOG_NORMAL, _("Client rejected: %s."), conn_description(pconn));
   flush_connection_send_buffer_all(pconn);
-  close_connection(pconn);
 }
 
 /**************************************************************************
@@ -365,6 +364,7 @@
   if (pconn->server.authentication_tries >= MAX_AUTHENTICATION_TRIES) {
     pconn->server.status = AS_NOT_ESTABLISHED;
     reject_new_connection(_("Sorry, too many wrong tries..."), pconn);
+    close_connection(pconn);
   } else {
     struct packet_authentication_req request;
 
@@ -389,10 +389,11 @@
     if (!is_good_password(password, msg)) {
       if (pconn->server.authentication_tries++ >= MAX_AUTHENTICATION_TRIES) {
         reject_new_connection(_("Sorry, too many wrong tries..."), pconn);
+       return FALSE;
       } else {
         dsend_packet_authentication_req(pconn, AUTH_NEWUSER_RETRY,msg);
+       return TRUE;
       }
-      return TRUE;
     }
 
     /* the new password is good, create a database entry for
@@ -426,6 +427,7 @@
   } else {
     freelog(LOG_VERBOSE, "%s is sending unrequested auth packets", 
             pconn->username);
+    return FALSE;
   }
 
   return TRUE;

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