Fix an apparently-harmless error spotted by Ben Rudiak-Gould:
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Tue, 21 Jun 2005 20:13:48 +0000 (20:13 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Tue, 21 Jun 2005 20:13:48 +0000 (20:13 +0000)
commit0e3607ed667182fb33bf93b9e7cd60a8e6e8af87
tree111dd1af33190723ece4fcedaedca142ebac27a6
parentcba1e4b5171a9ee902db283e21272984a6ddf79a
Fix an apparently-harmless error spotted by Ben Rudiak-Gould:
do_ssh2_transport() was returning the wrong value for rekeys after the first.
This apparent error was introduced in r4901, but we can't see any reason for
the change to have been made. If it turns out to be a mistake to revert it,
I'm sure we'll find out.

Here for posterity is Simon's analysis:

| A lot of the return values from do_ssh2_transport appear to be vestigial: it
| used to be that a zero return from do_ssh2_transport meant it had handled the
| packet internally, and a 1 return meant the packet wasn't a transport-layer
| one and needed to pass on to do_ssh2_authconn. Since r4901, however, the
| layer discrimination is done based on the message type ranges, and the only
| remaining dependency on the return value from do_ssh2_transport is a special
| case in ssh2_protocol which detects the first 1 return and makes the
| initialisation call to do_ssh2_authconn.
|
| Therefore, the gratuitous 1 return on every key exchange as a result of the
| confusing if statement is simply ignored in ssh2_protocol (because
| ssh->protocol_initial_phase_done is already TRUE). So the remaining question
| was, why does the _lack_ of that 1 return not cause a problem, if the if's
| sense is indeed reversed?
|
| The answer is that 1 is still returned, just not by the crReturn inside the
| if statement. It's returned by the next crReturn, just after
| wait_for_rekey(). Which suggests that in fact, the if statement has the
| correct sense, but the crReturn inside it has the wrong value - it should be
| returning _zero_, to indicate that every NEWKEYS after the first one is
| uninteresting to the authconn code, and on the very first run through that
| doesn't happen and the NEWKEYS gets all the way to the crReturn(1) later on.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5986 cda61777-01e9-0310-a592-d414129be87e
ssh.c