static int protocol_client_auth(VncState *vs, uint8_t *data, size_t len)

{

    /* We only advertise 1 auth scheme at a time, so client

     * must pick the one we sent. Verify this */

    if (data[0] != vs->auth) { /* Reject auth */

       VNC_DEBUG("Reject auth %d because it didn't match advertized\n", (int)data[0]);

       vnc_write_u32(vs, 1);

       if (vs->minor >= 8) {

           static const char err[] = "Authentication failed";

           vnc_write_u32(vs, sizeof(err));

           vnc_write(vs, err, sizeof(err));

       }

       vnc_client_error(vs);

    } else { /* Accept requested auth */

       VNC_DEBUG("Client requested auth %d\n", (int)data[0]);

       switch (vs->auth) {

       case VNC_AUTH_NONE:

           VNC_DEBUG("Accept auth none\n");

           if (vs->minor >= 8) {

               vnc_write_u32(vs, 0); /* Accept auth completion */

               vnc_flush(vs);

           }

           start_client_init(vs);

           break;



       case VNC_AUTH_VNC:

           VNC_DEBUG("Start VNC auth\n");

           start_auth_vnc(vs);

           break;



       case VNC_AUTH_VENCRYPT:

           VNC_DEBUG("Accept VeNCrypt auth\n");

           start_auth_vencrypt(vs);

           break;



#ifdef CONFIG_VNC_SASL

       case VNC_AUTH_SASL:

           VNC_DEBUG("Accept SASL auth\n");

           start_auth_sasl(vs);

           break;

#endif /* CONFIG_VNC_SASL */



       default: /* Should not be possible, but just in case */

           VNC_DEBUG("Reject auth %d server code bug\n", vs->auth);

           vnc_write_u8(vs, 1);

           if (vs->minor >= 8) {

               static const char err[] = "Authentication failed";

               vnc_write_u32(vs, sizeof(err));

               vnc_write(vs, err, sizeof(err));

           }

           vnc_client_error(vs);

       }

    }

    return 0;

}

static int protocol_client_auth(VncState *vs, uint8_t *data, size_t len)

{

    



    if (data[0] != vs->auth) { 

       VNC_DEBUG("Reject auth %d because it didn't match advertized\n", (int)data[0]);

       vnc_write_u32(vs, 1);

       if (vs->minor >= 8) {

           static const char err[] = "Authentication failed";

           vnc_write_u32(vs, sizeof(err));

           vnc_write(vs, err, sizeof(err));

       }

       vnc_client_error(vs);

    } else { 

       VNC_DEBUG("Client requested auth %d\n", (int)data[0]);

       switch (vs->auth) {

       case VNC_AUTH_NONE:

           VNC_DEBUG("Accept auth none\n");

           if (vs->minor >= 8) {

               vnc_write_u32(vs, 0); 

               vnc_flush(vs);

           }

           start_client_init(vs);

           break;



       case VNC_AUTH_VNC:

           VNC_DEBUG("Start VNC auth\n");

           start_auth_vnc(vs);

           break;



       case VNC_AUTH_VENCRYPT:

           VNC_DEBUG("Accept VeNCrypt auth\n");

           start_auth_vencrypt(vs);

           break;



#ifdef CONFIG_VNC_SASL

       case VNC_AUTH_SASL:

           VNC_DEBUG("Accept SASL auth\n");

           start_auth_sasl(vs);

           break;

#endif 



       default: 

           VNC_DEBUG("Reject auth %d server code bug\n", vs->auth);

           vnc_write_u8(vs, 1);

           if (vs->minor >= 8) {

               static const char err[] = "Authentication failed";

               vnc_write_u32(vs, sizeof(err));

               vnc_write(vs, err, sizeof(err));

           }

           vnc_client_error(vs);

       }

    }

    return 0;

}

       VNC_DEBUG("Reject auth %d because it didn't match advertized\n", (int)data[0]);        VNC_DEBUG("Client requested auth %d\n", (int)data[0]);            VNC_DEBUG("Accept auth none\n");            VNC_DEBUG("Start VNC auth\n");            VNC_DEBUG("Accept VeNCrypt auth\n");            VNC_DEBUG("Accept SASL auth\n");            VNC_DEBUG("Reject auth %d server code bug\n", vs->auth);
static int FUNC_0(VncState *VAR_0, uint8_t *VAR_1, size_t VAR_2)

{

    



    if (VAR_1[0] != VAR_0->auth) { 

       VNC_DEBUG("Reject auth %d because it didn't match advertized\n", (int)VAR_1[0]);

       vnc_write_u32(VAR_0, 1);

       if (VAR_0->minor >= 8) {

           static const char VAR_4[] = "Authentication failed";

           vnc_write_u32(VAR_0, sizeof(VAR_4));

           vnc_write(VAR_0, VAR_4, sizeof(VAR_4));

       }

       vnc_client_error(VAR_0);

    } else { 

       VNC_DEBUG("Client requested auth %d\n", (int)VAR_1[0]);

       switch (VAR_0->auth) {

       case VNC_AUTH_NONE:

           VNC_DEBUG("Accept auth none\n");

           if (VAR_0->minor >= 8) {

               vnc_write_u32(VAR_0, 0); 

               vnc_flush(VAR_0);

           }

           start_client_init(VAR_0);

           break;



       case VNC_AUTH_VNC:

           VNC_DEBUG("Start VNC auth\n");

           start_auth_vnc(VAR_0);

           break;



       case VNC_AUTH_VENCRYPT:

           VNC_DEBUG("Accept VeNCrypt auth\n");

           start_auth_vencrypt(VAR_0);

           break;



#ifdef CONFIG_VNC_SASL

       case VNC_AUTH_SASL:

           VNC_DEBUG("Accept SASL auth\n");

           start_auth_sasl(VAR_0);

           break;

#endif 



       default: 

           VNC_DEBUG("Reject auth %d server code bug\n", VAR_0->auth);

           vnc_write_u8(VAR_0, 1);

           if (VAR_0->minor >= 8) {

               static const char VAR_4[] = "Authentication failed";

               vnc_write_u32(VAR_0, sizeof(VAR_4));

               vnc_write(VAR_0, VAR_4, sizeof(VAR_4));

           }

           vnc_client_error(VAR_0);

       }

    }

    return 0;

}

static int FUNC_0(VncState *VAR_0, uint8_t *VAR_1, size_t VAR_2)
{ if (VAR_1[0] != VAR_0->auth) { VNC_DEBUG("Reject auth %d because it didn't match advertized\n", (int)VAR_1[0]); vnc_write_u32(VAR_0, 1); if (VAR_0->minor >= 8) { static const char VAR_4[] = "Authentication failed"; vnc_write_u32(VAR_0, sizeof(VAR_4)); vnc_write(VAR_0, VAR_4, sizeof(VAR_4)); } vnc_client_error(VAR_0); } else { VNC_DEBUG("Client requested auth %d\n", (int)VAR_1[0]); switch (VAR_0->auth) { case VNC_AUTH_NONE:
VNC_DEBUG("Accept auth none\n"); if (VAR_0->minor >= 8) { vnc_write_u32(VAR_0, 0); vnc_flush(VAR_0); } start_client_init(VAR_0); break; case VNC_AUTH_VNC:
VNC_DEBUG("Start VNC auth\n"); start_auth_vnc(VAR_0); break; case VNC_AUTH_VENCRYPT:
VNC_DEBUG("Accept VeNCrypt auth\n"); start_auth_vencrypt(VAR_0); break; #ifdef CONFIG_VNC_SASL
case VNC_AUTH_SASL:
VNC_DEBUG("Accept SASL auth\n"); start_auth_sasl(VAR_0); break; #endif
default:
VNC_DEBUG("Reject auth %d server code bug\n", VAR_0->auth); vnc_write_u8(VAR_0, 1); if (VAR_0->minor >= 8) { static const char VAR_4[] = "Authentication failed"; vnc_write_u32(VAR_0, sizeof(VAR_4)); vnc_write(VAR_0, VAR_4, sizeof(VAR_4)); } vnc_client_error(VAR_0); } } return 0; }