Author: muffin
Date: 2005-11-24 14:59:49 -0500 (Thu, 24 Nov 2005)
New Revision: 941

Modified:
   trunk/perl/client/lib/Haver/Client.pm
Log:
Have Client.pm set the host according to what the server says it is rather than 
what the user says it is.  This fixes AUTH not working when the server has a 
different host than the given one.


Modified: trunk/perl/client/lib/Haver/Client.pm
===================================================================
--- trunk/perl/client/lib/Haver/Client.pm       2005-11-24 01:54:27 UTC (rev 
940)
+++ trunk/perl/client/lib/Haver/Client.pm       2005-11-24 19:59:49 UTC (rev 
941)
@@ -135,7 +135,6 @@
        } else {
                $heap->{state} = S_CONN;
                $heap->{name}  = $opts{name};
-               $heap->{host} = $opts{host};
                $heap->{port}  = $opts{port};
                $heap->{password} = $opts{password} || "";
                if (!$heap->{resolver}) {
@@ -221,7 +220,7 @@
                InputEvent => 'input',
                ErrorEvent => 'error',
        );
-       $heap->{wheel}->put( ['HAVER', $heap->{version}, 'auth'] );
+       call('send_raw', 'HAVER', $heap->{version}, 'auth');
        # XXX: timeout
 }
 
@@ -332,9 +331,11 @@
 ## server-response stuff
 
 sub msg_HAVER {
-       my ($kernel, $heap) = @_[KERNEL,HEAP];
+       my ($kernel, $heap, $host, $version) = @_[KERNEL,HEAP,ARG1,ARG2];
        return if ($heap->{state} != S_INIT); # should never happen, unless the
                                                                                
  # server is non-compliant
+       # Set the host to what the server says it is, to avoid breaking AUTH.
+       $heap->{host} = $host;
        $kernel->yield('send_raw', 'IDENT', $heap->{name});
        $heap->{state} = S_LOGIN;
 }
@@ -383,7 +384,7 @@
        if (grep(/^AUTH:BASIC$/, @types)) {
                call('send_raw', qw( AUTH:TYPE AUTH:BASIC ));
        } else {
-                # This really oughtn't to happen.  Try it anyway, we might be 
lucky.
+               # This really oughtn't to happen.  Try it anyway, we might be 
lucky.
                # XXX - Something more appropriate should happen here.
                call('send_raw', qw( AUTH:TYPE AUTH:BASIC ));
        }


Reply via email to