From 3e2080cfd268c02eaa7fa9d5ddf7f74be2b179dc Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sat, 31 Mar 2007 02:20:01 +0000 Subject: [PATCH] If we fail to read the AuthRequest from an out of date client, don't stick a fork in the proceedings, pass the partially initialized request on to the authenticator who will either get a version of 0 or an out of date version and reject them properly. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4640 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/presents/net/AuthRequest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/java/com/threerings/presents/net/AuthRequest.java b/src/java/com/threerings/presents/net/AuthRequest.java index 032a1e6ad..e28799089 100644 --- a/src/java/com/threerings/presents/net/AuthRequest.java +++ b/src/java/com/threerings/presents/net/AuthRequest.java @@ -21,8 +21,12 @@ package com.threerings.presents.net; +import java.io.EOFException; +import java.io.IOException; import java.util.TimeZone; +import com.threerings.io.ObjectInputStream; + /** * Used to authenticate with the server. */ @@ -88,6 +92,21 @@ public class AuthRequest extends UpstreamMessage ", version=" + _version + "]"; } + /** + * Reads our custom streamable fields. + */ + public void readObject (ObjectInputStream in) + throws IOException, ClassNotFoundException + { + try { + in.defaultReadObject(); + } catch (EOFException eofe) { + // if we fail here because the client is old, leave ourselves with a partially + // initialized set of credentials, which the server will generally cope with by telling + // the client it is out of date + } + } + /** The credentials associated with this auth request. */ protected Credentials _creds;