Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Echos Protocol Version, Even When Not Supported #2

Open
TaylorSMarks opened this issue Nov 25, 2014 · 1 comment
Open

Echos Protocol Version, Even When Not Supported #2

TaylorSMarks opened this issue Nov 25, 2014 · 1 comment

Comments

@TaylorSMarks
Copy link

Currently in VncClient::frb_wait_for_version(), it simply echos the protocol version, even when it's unrecognized / not supported.

For example, the current version of RealVNC uses RFB 004.001. Thus far, this protocol hasn't been published (and I've heard that as of 2012, RFB 004.yyy won't have the protocol publicly released like the RFB 003.yyy series was.) Simply returning RFB 004.001 doesn't work, because the server never sends anything after the client sends ClientInit - most likely in this new version ClientInit requires something more to be sent than in prior versions.

As a work around, I have a few lines in VncClient::frb_wait_for_version() commented out and replaced with this:

write("RFB 003.008\n");
_proto_hi_version = 3;
_proto_lo_version = 8;

A better solution would be to check what you're given, and if it's recognized, echo that, and if it's not, echo RFB 003.008\n. (If I get around to doing this myself, I'll make a pull request.)

@samskiter
Copy link

here's my version of the else block:

else
      {
        char version_hi[] = { r[4] != '0' ? r[4] : (r[5] != '0' ? r[5] : r[6]), 0 };
        char version_lo[] = { r[8] != '0' ? r[8] : (r[9] != '0' ? r[9] : r[10]), 0 };

        _proto_hi_version = atoi(version_hi);
        _proto_lo_version = atoi(version_lo);

        if (_proto_hi_version > 3 || (_proto_hi_version == 3 && _proto_lo_version > 8))
        {
          //respond with 3.8
          _proto_hi_version = 3;
          _proto_lo_version = 8;
          std::string version = "RFB 003.008";
          write(&*version.begin(), &*version.begin() + 12);
        }
        else
        {
          // Simply respond with the same protocol version as we've got from server.
          write(&*r.begin(), &*r.begin() + 12);
        }

        eat(12);

        if (_proto_hi_version == 3 && _proto_lo_version < 7)
          _state = vnc_waiting_for_security_server;
        else
          _state = vnc_waiting_for_security_handshake;
      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants