Redmine#4718: fixing authentication state machine

Right now some command are forced to be read in correct order.
If agent is not following it it is NOT able to authenticate to server.
Merge pull request #1544 from pasinskim/old_proto_authentication_fix

Old proto authentication fix